diff options
| author | Brian Somers <brian@FreeBSD.org> | 1999-08-06 13:53:03 +0000 |
|---|---|---|
| committer | Brian Somers <brian@FreeBSD.org> | 1999-08-06 13:53:03 +0000 |
| commit | aab3beeede3032eef69a9bf581707f4ea77affe3 (patch) | |
| tree | 86fd5de1f953d933d2534030fd86f151b5bbed7a /sys/net/if_tun.c | |
| parent | 2e4e1ffe620d48454983a717e73881f63cc64801 (diff) | |
Notes
Diffstat (limited to 'sys/net/if_tun.c')
| -rw-r--r-- | sys/net/if_tun.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index 16542dec0f47..3cb8f6bab695 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -302,9 +302,12 @@ tunifioctl(ifp, cmd, data) ifp->if_name, ifp->if_unit); break; case SIOCSIFMTU: - ifp->if_mtu = ifr->ifr_mtu; - TUNDEBUG("%s%d: mtu set\n", - ifp->if_name, ifp->if_unit); + if (ifr->ifr_mtu < IF_MINMTU || ifr->ifr_mtu > IF_MAXMTU) + error = EINVAL; + else { + ifp->if_mtu = ifr->ifr_mtu; + TUNDEBUG("%s%d: mtu set\n", ifp->if_name, ifp->if_unit); + } break; case SIOCADDMULTI: case SIOCDELMULTI: @@ -435,6 +438,8 @@ tunioctl(dev, cmd, data, flag, p) switch (cmd) { case TUNSIFINFO: tunp = (struct tuninfo *)data; + if (tunp->mtu < IF_MINMTU || tunp->mtu > IF_MAXMTU) + return (EINVAL); tp->tun_if.if_mtu = tunp->mtu; tp->tun_if.if_type = tunp->type; tp->tun_if.if_baudrate = tunp->baudrate; |
