summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorAngelos D. Keromytis <angelos@cvs.openbsd.org>2000-12-30 19:03:45 +0000
committerAngelos D. Keromytis <angelos@cvs.openbsd.org>2000-12-30 19:03:45 +0000
commit43da9ca47ad5a9a175a60252d97e2e4d717f42a6 (patch)
treee3dee8f8fad0912330907ebe30a00086f2644216 /sys
parent1dbb807ff87988c20b8f4e4216d431742d918a63 (diff)
Send AF_LINK to etherip_output()
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/in_gif.c18
-rw-r--r--sys/netinet6/in6_gif.c19
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)) {