mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-06 13:09:50 +00:00
add SIOC{S,G}IFMEDIA ioctl support
This commit is contained in:
parent
1cde3a7e02
commit
a912e453bc
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=25434
18
sys/net/if.c
18
sys/net/if.c
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)if.c 8.3 (Berkeley) 1/4/94
|
||||
* $Id: if.c,v 1.46 1997/03/24 11:33:08 bde Exp $
|
||||
* $Id: if.c,v 1.47 1997/04/27 20:00:56 wollman Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -593,6 +593,22 @@ ifioctl(so, cmd, data, p)
|
||||
microtime(&ifp->if_lastchange);
|
||||
return error;
|
||||
|
||||
case SIOCSIFMEDIA:
|
||||
error = suser(p->p_ucred, &p->p_acflag);
|
||||
if (error)
|
||||
return (error);
|
||||
if (ifp->if_ioctl == 0)
|
||||
return (EOPNOTSUPP);
|
||||
error = (*ifp->if_ioctl)(ifp, cmd, data);
|
||||
if (error == 0)
|
||||
microtime(&ifp->if_lastchange);
|
||||
return error;
|
||||
|
||||
case SIOCGIFMEDIA:
|
||||
if (ifp->if_ioctl == 0)
|
||||
return (EOPNOTSUPP);
|
||||
return ((*ifp->if_ioctl)(ifp, cmd, data));
|
||||
|
||||
default:
|
||||
if (so->so_proto == 0)
|
||||
return (EOPNOTSUPP);
|
||||
|
13
sys/net/if.h
13
sys/net/if.h
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)if.h 8.1 (Berkeley) 6/10/93
|
||||
* $Id$
|
||||
* $Id: if.h,v 1.45 1997/02/22 09:40:58 peter Exp $
|
||||
*/
|
||||
|
||||
#ifndef _NET_IF_H_
|
||||
@ -153,6 +153,7 @@ struct ifreq {
|
||||
int ifru_metric;
|
||||
int ifru_mtu;
|
||||
int ifru_phys;
|
||||
int ifru_media;
|
||||
caddr_t ifru_data;
|
||||
} ifr_ifru;
|
||||
#define ifr_addr ifr_ifru.ifru_addr /* address */
|
||||
@ -162,6 +163,7 @@ struct ifreq {
|
||||
#define ifr_metric ifr_ifru.ifru_metric /* metric */
|
||||
#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */
|
||||
#define ifr_phys ifr_ifru.ifru_phys /* physical wire */
|
||||
#define ifr_media ifr_ifru.ifru_media /* physical media */
|
||||
#define ifr_data ifr_ifru.ifru_data /* for use by interface */
|
||||
};
|
||||
|
||||
@ -172,6 +174,15 @@ struct ifaliasreq {
|
||||
struct sockaddr ifra_mask;
|
||||
};
|
||||
|
||||
struct ifmediareq {
|
||||
char ifm_name[IFNAMSIZ]; /* if name, e.g. "en0" */
|
||||
int ifm_current; /* current media options */
|
||||
int ifm_mask; /* don't care mask */
|
||||
int ifm_status; /* media status */
|
||||
int ifm_active; /* active options */
|
||||
int ifm_count; /* # entries in ifm_ulist array */
|
||||
int *ifm_ulist; /* media words */
|
||||
};
|
||||
/*
|
||||
* Structure used in SIOCGIFCONF request.
|
||||
* Used to retrieve interface configuration
|
||||
|
Loading…
Reference in New Issue
Block a user