diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2000-03-21 23:31:28 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2000-03-21 23:31:28 +0000 |
commit | 01e49275e22f2613d4f14b83996403c02d3b2b7b (patch) | |
tree | 94649eb2bd557a632b33fdbefd1b8b07ae4f2f28 /sys/net/if.c | |
parent | 51e702ed655a3cf3dc83d34c06005da09e639698 (diff) |
add SIOCGIFMTU/SIOCSIFMTU; remediate redundant code of tun, ppp, sppp; chris@ ok
Diffstat (limited to 'sys/net/if.c')
-rw-r--r-- | sys/net/if.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index 9109dcbedb6..f1e8c498d04 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.28 2000/03/12 03:54:43 itojun Exp $ */ +/* $OpenBSD: if.c,v 1.29 2000/03/21 23:31:26 mickey Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -697,6 +697,10 @@ ifioctl(so, cmd, data, p) ifr->ifr_metric = ifp->if_metric; break; + case SIOCGIFMTU: + ifr->ifr_mtu = ifp->if_mtu; + break; + case SIOCGIFDATA: error = copyout((caddr_t)&ifp->if_data, ifr->ifr_data, sizeof(ifp->if_data)); @@ -727,6 +731,28 @@ ifioctl(so, cmd, data, p) ifp->if_metric = ifr->ifr_metric; break; + case SIOCSIFMTU: + { +#ifdef INET6 + int oldmtu = ifp->if_mtu; +#endif + + if ((error = suser(p->p_ucred, &p->p_acflag)) != 0) + return (error); + if (ifp->if_ioctl == NULL) + return (EOPNOTSUPP); + error = (*ifp->if_ioctl)(ifp, cmd, data); + + /* + * If the link MTU changed, do network layer specific procedure. + */ +#ifdef INET6 + if (ifp->if_mtu != oldmtu) + nd6_setmtu(ifp); +#endif + break; + } + case SIOCADDMULTI: case SIOCDELMULTI: case SIOCSIFMEDIA: |