summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2002-10-17 17:42:46 +0000
committerume <ume@FreeBSD.org>2002-10-17 17:42:46 +0000
commit685116d01884f51622ad2f4105b0387f2f1ddd1f (patch)
tree9414d21a62827f715a698d32bf9ec24138b36918
parent6a0b41fbefc5966d26a3da38abeb152ea7682c48 (diff)
downloadFreeBSD-src-685116d01884f51622ad2f4105b0387f2f1ddd1f.zip
FreeBSD-src-685116d01884f51622ad2f4105b0387f2f1ddd1f.tar.gz
- drop too short IPv6 frame
- NULL != 0 Obtained from: KAME MFC after: 3 weeks
-rw-r--r--sys/net/if_gif.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c
index a3d6be3..6186b07 100644
--- a/sys/net/if_gif.c
+++ b/sys/net/if_gif.c
@@ -278,6 +278,10 @@ gif_encapcheck(m, off, proto, arg)
return 0;
}
+ /* Bail on short packets */
+ if (m->m_pkthdr.len < sizeof(ip))
+ return 0;
+
m_copydata(m, 0, sizeof(ip), (caddr_t)&ip);
switch (ip.ip_v) {
@@ -401,7 +405,7 @@ gif_input(m, af, ifp)
struct ifnet *ifp;
{
int isr;
- struct ifqueue *ifq = 0;
+ struct ifqueue *ifq = NULL;
if (ifp == NULL) {
/* just in case */
@@ -491,7 +495,10 @@ gif_ioctl(ifp, cmd, data)
struct ifreq *ifr = (struct ifreq*)data;
int error = 0, size;
struct sockaddr *dst, *src;
-
+#ifdef SIOCSIFMTU /* xxx */
+ u_long mtu;
+#endif
+
switch (cmd) {
case SIOCSIFADDR:
ifp->if_flags |= IFF_UP;
@@ -509,18 +516,16 @@ gif_ioctl(ifp, cmd, data)
break;
case SIOCSIFMTU:
- {
- u_long mtu;
- mtu = ifr->ifr_mtu;
- if (mtu < GIF_MTU_MIN || mtu > GIF_MTU_MAX) {
- return (EINVAL);
- }
- ifp->if_mtu = mtu;
- }
+ mtu = ifr->ifr_mtu;
+ if (mtu < GIF_MTU_MIN || mtu > GIF_MTU_MAX)
+ return (EINVAL);
+ ifp->if_mtu = mtu;
break;
#endif /* SIOCSIFMTU */
+#ifdef INET
case SIOCSIFPHYADDR:
+#endif
#ifdef INET6
case SIOCSIFPHYADDR_IN6:
#endif /* INET6 */
OpenPOWER on IntegriCloud