gifconfig, gif_up() and IPv6 tunnels

Darren Pilgrim list_freebsd at bluerosetech.com
Mon Jan 6 12:55:44 UTC 2014


I'm setting up some 4in6 tunnels using gif interfaces on 9.2-R.  On the 
command line, they look like this:

# ifconfig gif0 create
# ifconfig gif0 ipv6 tunnel 2001:db8:1::1 2001:db8:2::1 mtu 1500 
-accept_rtadv
# ifconfig gif0 inet 10.0.1.1 10.0.2.1 netmask 0xffffffff

When I went to add it to /etc/rc.conf, I ran into a problem.  The 
gif_up() function hardcodes the contents of gifconfig_gif0 after the 
tunnel keyword, but ifconfig requires putting "inet6" before "tunnel" 
for IPv6 tunnels.  Ironically, ifconfig's output for such interfaces has 
those keywords transposed.  I didn't see any logic in network.subr to 
detect IPv4 vs IPv6 gif tunnels.

I worked around it using a hack with cloned_interfaces and aliases:

cloned_interfaces="gif0"
ifconfig_gif0="inet6 tunnel 2001:db8:1::1 2001:db8:2::1 mtu 1500"
ifconfig_gif0_alias0="inet 10.0.1.1 10.0.2.1 netmask 0xffffffff"

It seems like this is something network.subr should know how to do 
properly (i.e., feature parity with IPv4).  Did I overlook a formal way 
to configure IPv6 gif tunnels in /etc/rc.conf?

If this isn't possible, has this functionality been added to -current? 
If not, is anyone working on it?


More information about the freebsd-rc mailing list