diff options
author | shin <shin@FreeBSD.org> | 2000-03-11 11:17:24 +0000 |
---|---|---|
committer | shin <shin@FreeBSD.org> | 2000-03-11 11:17:24 +0000 |
commit | 4897d4b884a45fa62be25d44438c46c8b795c36c (patch) | |
tree | 62045144ea41cdf658b5188ff11cd090c84f819d /sys/net/if_gif.c | |
parent | 843cb7cecfa2978f81dbd98715c6cd6f8bc90bcf (diff) | |
download | FreeBSD-src-4897d4b884a45fa62be25d44438c46c8b795c36c.zip FreeBSD-src-4897d4b884a45fa62be25d44438c46c8b795c36c.tar.gz |
IPv6 6to4 support.
Now most big problem of IPv6 is getting IPv6 address
assignment.
6to4 solve the problem. 6to4 addr is defined like below,
2002: 4byte v4 addr : 2byte SLA ID : 8byte interface ID
The most important point of the address format is that an IPv4 addr
is embeded in it. So any user who has IPv4 addr can get IPv6 address
block with 2byte subnet space. Also, the IPv4 addr is used for
semi-automatic IPv6 over IPv4 tunneling.
With 6to4, getting IPv6 addr become dramatically easy.
The attached patch enable 6to4 extension, and confirmed to work,
between "Richard Seaman, Jr." <dick@tar.com> and me.
Approved by: jkh
Reviewed by: itojun
Diffstat (limited to 'sys/net/if_gif.c')
-rw-r--r-- | sys/net/if_gif.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c index 06a3469..0b32657 100644 --- a/sys/net/if_gif.c +++ b/sys/net/if_gif.c @@ -83,7 +83,7 @@ void gifattach __P((void *)); /* * gif global variable definitions */ -int ngif = NGIF; /* number of interfaces */ +int ngif = NGIF + 1; /* number of interfaces. +1 for stf. */ struct gif_softc *gif = 0; void @@ -95,7 +95,7 @@ gifattach(dummy) gif = sc = malloc (ngif * sizeof(struct gif_softc), M_DEVBUF, M_WAIT); bzero(sc, ngif * sizeof(struct gif_softc)); - for (i = 0; i < ngif; sc++, i++) { + for (i = 0; i < ngif - 1; sc++, i++) { /* leave last one for stf */ sc->gif_if.if_name = "gif"; sc->gif_if.if_unit = i; sc->gif_if.if_mtu = GIF_MTU; @@ -107,6 +107,16 @@ gifattach(dummy) if_attach(&sc->gif_if); bpfattach(&sc->gif_if, DLT_NULL, sizeof(u_int)); } + sc->gif_if.if_name = "stf"; + sc->gif_if.if_unit = 0; + sc->gif_if.if_mtu = GIF_MTU; + sc->gif_if.if_flags = IFF_MULTICAST; + sc->gif_if.if_ioctl = gif_ioctl; + sc->gif_if.if_output = gif_output; + sc->gif_if.if_type = IFT_GIF; + sc->gif_if.if_snd.ifq_maxlen = ifqmaxlen; + if_attach(&sc->gif_if); + bpfattach(&sc->gif_if, DLT_NULL, sizeof(u_int)); } PSEUDO_SET(gifattach, if_gif); @@ -323,6 +333,11 @@ gif_ioctl(ifp, cmd, data) /* only one gif can have dst = INADDR_ANY */ #define satosaddr(sa) (((struct sockaddr_in *)(sa))->sin_addr.s_addr) +#ifdef INET6 + if (bcmp(ifp->if_name, "stf", 3) == 0) + satosaddr(dst) = INADDR_BROADCAST; +#endif + if (satosaddr(dst) == INADDR_ANY) { int i; struct gif_softc *sc2; |