diff options
author | Bjoern A. Zeeb <bz@FreeBSD.org> | 2005-08-01 08:14:21 +0000 |
---|---|---|
committer | Bjoern A. Zeeb <bz@FreeBSD.org> | 2005-08-01 08:14:21 +0000 |
commit | 9e669156d49d639980264c8c064e9f95a4105cb6 (patch) | |
tree | f826c58d5d4c69db91f04f86b72fd6b772937391 /sys/net/if_gre.c | |
parent | 049d6489ab7f4fcf1f9949825674d5bd5b05c922 (diff) | |
download | src-9e669156d49d639980264c8c064e9f95a4105cb6.tar.gz src-9e669156d49d639980264c8c064e9f95a4105cb6.zip |
Notes
Diffstat (limited to 'sys/net/if_gre.c')
-rw-r--r-- | sys/net/if_gre.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c index 90f54c980e06..dc7355d21edc 100644 --- a/sys/net/if_gre.c +++ b/sys/net/if_gre.c @@ -8,6 +8,8 @@ * This code is derived from software contributed to The NetBSD Foundation * by Heiko W.Rupp <hwr@pilhuhn.de> * + * IPv6-over-GRE contributed by Gert Doering <gert@greenie.muc.de> + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -39,7 +41,7 @@ /* * Encapsulate L3 protocols into IP - * See RFC 1701 and 1702 for more details. + * See RFC 2784 (successor of RFC 1701 and 1702) for more details. * If_gre is compatible with Cisco GRE tunnels, so you can * have a NetBSD box as the other end of a tunnel interface of a Cisco * router. See gre(4) for more details. @@ -237,6 +239,8 @@ gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, struct gre_softc *sc = ifp->if_softc; struct greip *gh; struct ip *ip; + u_short ip_id = 0; + uint8_t ip_tos = 0; u_int16_t etype = 0; struct mobile_h mob_h; u_int32_t af; @@ -352,8 +356,16 @@ gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, switch (dst->sa_family) { case AF_INET: ip = mtod(m, struct ip *); + ip_tos = ip->ip_tos; + ip_id = ip->ip_id; etype = ETHERTYPE_IP; break; +#ifdef INET6 + case AF_INET6: + ip_id = ip_newid(); + etype = ETHERTYPE_IPV6; + break; +#endif #ifdef NETATALK case AF_APPLETALK: etype = ETHERTYPE_ATALK; @@ -393,8 +405,8 @@ gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, ((struct ip*)gh)->ip_v = IPPROTO_IPV4; ((struct ip*)gh)->ip_hl = (sizeof(struct ip)) >> 2; ((struct ip*)gh)->ip_ttl = GRE_TTL; - ((struct ip*)gh)->ip_tos = ip->ip_tos; - ((struct ip*)gh)->ip_id = ip->ip_id; + ((struct ip*)gh)->ip_tos = ip_tos; + ((struct ip*)gh)->ip_id = ip_id; gh->gi_len = m->m_pkthdr.len; } @@ -473,6 +485,10 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) case AF_INET: break; #endif +#ifdef INET6 + case AF_INET6: + break; +#endif default: error = EAFNOSUPPORT; break; |