Added ioctl support for SIOCGIFMTU and SIOCSIFMTU. These set the per-
interface MTU.
This commit is contained in:
parent
4db32b036d
commit
a7028af7f0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=1941
13
sys/net/if.c
13
sys/net/if.c
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)if.c 8.3 (Berkeley) 1/4/94
|
||||
* $Id$
|
||||
* $Id: if.c,v 1.2 1994/08/02 07:46:05 davidg Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -486,6 +486,10 @@ ifioctl(so, cmd, data, p)
|
||||
ifr->ifr_metric = ifp->if_metric;
|
||||
break;
|
||||
|
||||
case SIOCGIFMTU:
|
||||
ifr->ifr_mtu = ifp->if_mtu;
|
||||
break;
|
||||
|
||||
case SIOCSIFFLAGS:
|
||||
if (error = suser(p->p_ucred, &p->p_acflag))
|
||||
return (error);
|
||||
@ -511,6 +515,13 @@ ifioctl(so, cmd, data, p)
|
||||
ifp->if_metric = ifr->ifr_metric;
|
||||
break;
|
||||
|
||||
case SIOCSIFMTU:
|
||||
if (error = suser(p->p_ucred, &p->p_acflag))
|
||||
return (error);
|
||||
if (ifp->if_ioctl == NULL)
|
||||
return (EOPNOTSUPP);
|
||||
return ((*ifp->if_ioctl)(ifp, cmd, data));
|
||||
|
||||
case SIOCADDMULTI:
|
||||
case SIOCDELMULTI:
|
||||
if (error = suser(p->p_ucred, &p->p_acflag))
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)if.h 8.1 (Berkeley) 6/10/93
|
||||
* $Id$
|
||||
* $Id: if.h,v 1.3 1994/08/02 07:46:07 davidg Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -282,6 +282,7 @@ struct ifreq {
|
||||
struct sockaddr ifru_broadaddr;
|
||||
short ifru_flags;
|
||||
int ifru_metric;
|
||||
int ifru_mtu;
|
||||
caddr_t ifru_data;
|
||||
} ifr_ifru;
|
||||
#define ifr_addr ifr_ifru.ifru_addr /* address */
|
||||
@ -289,6 +290,7 @@ struct ifreq {
|
||||
#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */
|
||||
#define ifr_flags ifr_ifru.ifru_flags /* flags */
|
||||
#define ifr_metric ifr_ifru.ifru_metric /* metric */
|
||||
#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */
|
||||
#define ifr_data ifr_ifru.ifru_data /* for use by interface */
|
||||
};
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)sockio.h 8.1 (Berkeley) 3/28/94
|
||||
* $Id$
|
||||
* $Id: sockio.h,v 1.2 1994/08/02 07:53:37 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_SOCKIO_H_
|
||||
@ -74,5 +74,7 @@
|
||||
|
||||
#define SIOCADDMULTI _IOW('i', 49, struct ifreq) /* add m'cast addr */
|
||||
#define SIOCDELMULTI _IOW('i', 50, struct ifreq) /* del m'cast addr */
|
||||
#define SIOCGIFMTU _IOWR('i', 51, struct ifreq) /* get IF mtu */
|
||||
#define SIOCSIFMTU _IOW('i', 52, struct ifreq) /* set IF mtu */
|
||||
|
||||
#endif /* !_SYS_SOCKIO_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user