diff options
-rw-r--r-- | sys/netinet/in_gif.c | 18 | ||||
-rw-r--r-- | sys/netinet6/in6_gif.c | 19 |
2 files changed, 35 insertions, 2 deletions
diff --git a/sys/netinet/in_gif.c b/sys/netinet/in_gif.c index 1a6f8682ae6..3497b511506 100644 --- a/sys/netinet/in_gif.c +++ b/sys/netinet/in_gif.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in_gif.c,v 1.9 2000/05/25 01:22:00 itojun Exp $ */ +/* $OpenBSD: in_gif.c,v 1.10 2000/12/30 19:03:38 angelos Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -65,6 +65,7 @@ #include <net/if_gif.h> #include "gif.h" +#include "bridge.h" #include <machine/stdarg.h> @@ -141,6 +142,20 @@ in_gif_output(ifp, family, m, rt) return EAFNOSUPPORT; } +#if NBRIDGE > 0 + if (family == AF_LINK) { + mp = NULL; + error = etherip_output(m, &tdb, &mp, 0, 0); + if (error) + return error; + else if (mp == NULL) + return EFAULT; + + m = mp; + goto sendit; + } +#endif /* NBRIDGE */ + /* encapsulate into IPv4 packet */ mp = NULL; error = ipip_output(m, &tdb, &mp, hlen, poff); @@ -151,6 +166,7 @@ in_gif_output(ifp, family, m, rt) m = mp; + sendit: /* ip_output needs host-order length. it should be nuked */ m_copydata(m, offsetof(struct ip, ip_len), sizeof(u_int16_t), (caddr_t) &plen); diff --git a/sys/netinet6/in6_gif.c b/sys/netinet6/in6_gif.c index 7b52cf87a9d..7ac4da53d54 100644 --- a/sys/netinet6/in6_gif.c +++ b/sys/netinet6/in6_gif.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_gif.c,v 1.7 2000/02/07 06:18:44 itojun Exp $ */ +/* $OpenBSD: in6_gif.c,v 1.8 2000/12/30 19:03:44 angelos Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -67,6 +67,8 @@ #include <net/net_osdep.h> +#include "bridge.h" + #ifndef offsetof #define offsetof(s, e) ((int)&((s *)0)->e) #endif @@ -144,6 +146,20 @@ in6_gif_output(ifp, family, m, rt) return EAFNOSUPPORT; } +#if NBRIDGE > 0 + if (family == AF_LINK) { + mp = NULL; + error = etherip_output(m, &tdb, &mp, 0, 0); + if (error) + return error; + else if (mp == NULL) + return EFAULT; + + m = mp; + goto sendit; + } +#endif /* NBRIDGE */ + /* encapsulate into IPv6 packet */ mp = NULL; error = ipip_output(m, &tdb, &mp, hlen, poff); @@ -154,6 +170,7 @@ in6_gif_output(ifp, family, m, rt) m = mp; + sendit: /* See if out cached route remains the same */ if (dst->sin6_family != sin6_dst->sin6_family || !IN6_ARE_ADDR_EQUAL(&dst->sin6_addr, &sin6_dst->sin6_addr)) { |