Fix a bug whereby the physical endpoints of a gre(4) tunnel would not

be printed, if the module were loaded into a kernel which had INET6 enabled.

The gre(4) driver does not use INET6, nor is it specified for IPv6. The
tunnel_status() function in ifconfig(8) is somewhat overzealous and assumes
that all tunnel interfaces speak KAME ifioctls.

This fix follows the path of least resistance, by teaching gre(4) about
the two KAME ifioctls concerned.

PR:	bin/56341
This commit is contained in:
Bruce M Simpson 2003-11-14 20:58:00 +00:00
parent 1bf8720450
commit f16770ae7e
2 changed files with 12 additions and 2 deletions

View File

@ -1,13 +1,16 @@
# $FreeBSD$ # $FreeBSD$
.PATH: ${.CURDIR}/../../net ${.CURDIR}/../../netinet .PATH: ${.CURDIR}/../../net ${.CURDIR}/../../netinet ${.CURDIR}/../../netinet6
KMOD= if_gre KMOD= if_gre
SRCS= if_gre.c ip_gre.c opt_inet.h opt_atalk.h SRCS= if_gre.c ip_gre.c opt_inet.h opt_inet6.h opt_atalk.h
opt_inet.h: opt_inet.h:
echo "#define INET 1" > ${.TARGET} echo "#define INET 1" > ${.TARGET}
opt_inet6.h:
echo "#define INET6 1" > ${.TARGET}
opt_atalk.h: opt_atalk.h:
echo "#define NETATALK 1" > ${.TARGET} echo "#define NETATALK 1" > ${.TARGET}

View File

@ -48,6 +48,7 @@
#include "opt_atalk.h" #include "opt_atalk.h"
#include "opt_inet.h" #include "opt_inet.h"
#include "opt_inet6.h"
#include <sys/param.h> #include <sys/param.h>
#include <sys/kernel.h> #include <sys/kernel.h>
@ -585,6 +586,9 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
memcpy(&lifr->dstaddr, &si, sizeof(si)); memcpy(&lifr->dstaddr, &si, sizeof(si));
break; break;
case SIOCGIFPSRCADDR: case SIOCGIFPSRCADDR:
#ifdef INET6
case SIOCGIFPSRCADDR_IN6:
#endif
if (sc->g_src.s_addr == INADDR_ANY) { if (sc->g_src.s_addr == INADDR_ANY) {
error = EADDRNOTAVAIL; error = EADDRNOTAVAIL;
break; break;
@ -596,6 +600,9 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
bcopy(&si, &ifr->ifr_addr, sizeof(ifr->ifr_addr)); bcopy(&si, &ifr->ifr_addr, sizeof(ifr->ifr_addr));
break; break;
case SIOCGIFPDSTADDR: case SIOCGIFPDSTADDR:
#ifdef INET6
case SIOCGIFPDSTADDR_IN6:
#endif
if (sc->g_dst.s_addr == INADDR_ANY) { if (sc->g_dst.s_addr == INADDR_ANY) {
error = EADDRNOTAVAIL; error = EADDRNOTAVAIL;
break; break;