summaryrefslogtreecommitdiff
path: root/sys/netinet
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>2001-02-03 19:45:05 +0000
committerJason Wright <jason@cvs.openbsd.org>2001-02-03 19:45:05 +0000
commitd54787f2c0f2fde0a4d0213d367c261b73a08da6 (patch)
tree165b715ef6dd9a6f57ec0df0ea9b273cc325eb65 /sys/netinet
parent022c063a204e86613ef52bc28b25378832f047bc (diff)
KNF
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/ip_ether.c581
-rw-r--r--sys/netinet/ip_ether.h23
2 files changed, 297 insertions, 307 deletions
diff --git a/sys/netinet/ip_ether.c b/sys/netinet/ip_ether.c
index 67a2a31479c..158eb350936 100644
--- a/sys/netinet/ip_ether.c
+++ b/sys/netinet/ip_ether.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_ether.c,v 1.21 2001/02/02 08:28:20 jason Exp $ */
+/* $OpenBSD: ip_ether.c,v 1.22 2001/02/03 19:45:03 jason Exp $ */
/*
* The author of this code is Angelos D. Keromytis (kermit@adk.gr)
@@ -91,211 +91,201 @@ void
etherip_input(struct mbuf *m, ...)
#else
etherip_input(m, va_alist)
-struct mbuf *m;
-va_dcl
+ struct mbuf *m;
+ va_dcl
#endif
{
- union sockaddr_union ssrc, sdst;
- struct ether_header eh;
- struct mbuf *mrest, *m0;
- int iphlen, clen;
- struct etherip_header eip;
- u_int8_t v;
- va_list ap;
+ union sockaddr_union ssrc, sdst;
+ struct ether_header eh;
+ struct mbuf *mrest, *m0;
+ int iphlen, clen;
+ struct etherip_header eip;
+ u_int8_t v;
+ va_list ap;
#if NGIF > 0
- int i;
+ int i;
#endif /* NGIF */
- va_start(ap, m);
- iphlen = va_arg(ap, int);
- va_end(ap);
+ va_start(ap, m);
+ iphlen = va_arg(ap, int);
+ va_end(ap);
- etheripstat.etherip_ipackets++;
+ etheripstat.etherip_ipackets++;
- /* If we do not accept EtherIP explicitly, drop. */
- if (!etherip_allow && (m->m_flags & (M_AUTH|M_CONF)) == 0)
- {
- DPRINTF(("etherip_input(): dropped due to policy\n"));
- etheripstat.etherip_pdrops++;
- m_freem(m);
- return;
- }
-
- /*
- * Make sure there's at least an ethernet header's and an EtherIP header's
- * worth of worth of data after the outer IP header.
- */
- if (m->m_pkthdr.len < iphlen + sizeof(struct ether_header) +
- sizeof(struct etherip_header))
- {
- DPRINTF(("etherip_input(): encapsulated packet too short\n"));
- etheripstat.etherip_hdrops++;
- m_freem(m);
- return;
- }
-
- /* Verify EtherIP version number */
- m_copydata(m, iphlen, sizeof(struct etherip_header), (caddr_t)&eip);
- if ((eip.eip_ver & ETHERIP_VER_VERS_MASK) != ETHERIP_VERSION)
- {
- DPRINTF(("etherip_input(): received EtherIP version number %d not suppoorted\n", (v >> 4) & 0xff));
- etheripstat.etherip_adrops++;
- m_freem(m);
- return;
- }
-
- /*
- * Note that the other potential failure of the above check is that the
- * second nibble of the EtherIP header (the reserved part) is not
- * zero; this is also invalid protocol behaviour.
- */
- if (eip.eip_ver & ETHERIP_VER_RSVD_MASK)
- {
- DPRINTF(("etherip_input(): received EtherIP invalid EtherIP header (reserved field non-zero\n"));
- etheripstat.etherip_adrops++;
- m_freem(m);
- return;
- }
-
- /* Make sure the ethernet header at least is in the first mbuf. */
- if (m->m_len < iphlen + sizeof(struct ether_header) +
- sizeof(struct etherip_header))
- {
- if ((m = m_pullup(m, iphlen + sizeof(struct ether_header) +
- sizeof(struct etherip_header))) == NULL)
- {
- DPRINTF(("etherip_input(): m_pullup() failed\n"));
- etheripstat.etherip_adrops++;
- m_freem(m);
- return;
+ /* If we do not accept EtherIP explicitly, drop. */
+ if (!etherip_allow && (m->m_flags & (M_AUTH|M_CONF)) == 0) {
+ DPRINTF(("etherip_input(): dropped due to policy\n"));
+ etheripstat.etherip_pdrops++;
+ m_freem(m);
+ return;
+ }
+
+ /*
+ * Make sure there's at least an ethernet header's and an EtherIP
+ * header's of worth of data after the outer IP header.
+ */
+ if (m->m_pkthdr.len < iphlen + sizeof(struct ether_header) +
+ sizeof(struct etherip_header)) {
+ DPRINTF(("etherip_input(): encapsulated packet too short\n"));
+ etheripstat.etherip_hdrops++;
+ m_freem(m);
+ return;
+ }
+
+ /* Verify EtherIP version number */
+ m_copydata(m, iphlen, sizeof(struct etherip_header), (caddr_t)&eip);
+ if ((eip.eip_ver & ETHERIP_VER_VERS_MASK) != ETHERIP_VERSION) {
+ DPRINTF(("etherip_input(): received EtherIP version number %d not suppoorted\n", (v >> 4) & 0xff));
+ etheripstat.etherip_adrops++;
+ m_freem(m);
+ return;
}
- }
- /* Copy the addresses for use later */
- bzero(&ssrc, sizeof(ssrc));
- bzero(&sdst, sizeof(sdst));
+ /*
+ * Note that the other potential failure of the above check is that the
+ * second nibble of the EtherIP header (the reserved part) is not
+ * zero; this is also invalid protocol behaviour.
+ */
+ if (eip.eip_ver & ETHERIP_VER_RSVD_MASK) {
+ DPRINTF(("etherip_input(): received EtherIP invalid EtherIP header (reserved field non-zero\n"));
+ etheripstat.etherip_adrops++;
+ m_freem(m);
+ return;
+ }
+
+ /* Make sure the ethernet header at least is in the first mbuf. */
+ if (m->m_len < iphlen + sizeof(struct ether_header) +
+ sizeof(struct etherip_header)) {
+ if ((m = m_pullup(m, iphlen + sizeof(struct ether_header) +
+ sizeof(struct etherip_header))) == NULL) {
+ DPRINTF(("etherip_input(): m_pullup() failed\n"));
+ etheripstat.etherip_adrops++;
+ m_freem(m);
+ return;
+ }
+ }
- v = *mtod(m, u_int8_t *);
- switch (v >> 4)
- {
+ /* Copy the addresses for use later */
+ bzero(&ssrc, sizeof(ssrc));
+ bzero(&sdst, sizeof(sdst));
+
+ v = *mtod(m, u_int8_t *);
+ switch (v >> 4) {
#ifdef INET
case 4:
- ssrc.sa.sa_len = sdst.sa.sa_len = sizeof(struct sockaddr_in);
- ssrc.sa.sa_family = sdst.sa.sa_family = AF_INET;
- m_copydata(m, offsetof(struct ip, ip_src), sizeof(struct in_addr),
- (caddr_t) &ssrc.sin.sin_addr);
- m_copydata(m, offsetof(struct ip, ip_dst), sizeof(struct in_addr),
- (caddr_t) &sdst.sin.sin_addr);
- break;
+ ssrc.sa.sa_len = sdst.sa.sa_len = sizeof(struct sockaddr_in);
+ ssrc.sa.sa_family = sdst.sa.sa_family = AF_INET;
+ m_copydata(m, offsetof(struct ip, ip_src), sizeof(struct in_addr),
+ (caddr_t) &ssrc.sin.sin_addr);
+ m_copydata(m, offsetof(struct ip, ip_dst), sizeof(struct in_addr),
+ (caddr_t) &sdst.sin.sin_addr);
+ break;
#endif /* INET */
#ifdef INET6
case 6:
- ssrc.sa.sa_len = sdst.sa.sa_len = sizeof(struct sockaddr_in6);
- ssrc.sa.sa_family = sdst.sa.sa_family = AF_INET6;
- m_copydata(m, offsetof(struct ip6_hdr, ip6_src),
- sizeof(struct in6_addr),
- (caddr_t) &ssrc.sin6.sin6_addr);
- m_copydata(m, offsetof(struct ip6_hdr, ip6_dst),
- sizeof(struct in6_addr),
- (caddr_t) &sdst.sin6.sin6_addr);
- break;
+ ssrc.sa.sa_len = sdst.sa.sa_len = sizeof(struct sockaddr_in6);
+ ssrc.sa.sa_family = sdst.sa.sa_family = AF_INET6;
+ m_copydata(m, offsetof(struct ip6_hdr, ip6_src),
+ sizeof(struct in6_addr),
+ (caddr_t) &ssrc.sin6.sin6_addr);
+ m_copydata(m, offsetof(struct ip6_hdr, ip6_dst),
+ sizeof(struct in6_addr),
+ (caddr_t) &sdst.sin6.sin6_addr);
+ break;
#endif /* INET6 */
default:
- m_freem(m);
- etheripstat.etherip_hdrops++;
- return /* EAFNOSUPPORT */;
- }
-
- /* Chop off the `outer' IP and EtherIP headers and reschedule. */
- m_adj(m, iphlen + sizeof(struct etherip_header));
-
- /* Statistics */
- etheripstat.etherip_ibytes += m->m_pkthdr.len;
-
- /* Copy ethernet header */
- m_copydata(m, 0, sizeof(eh), (void *) &eh);
-
- m->m_flags &= ~(M_BCAST|M_MCAST);
- if (eh.ether_dhost[0] & 1)
- {
- if (bcmp((caddr_t) etherbroadcastaddr, (caddr_t) eh.ether_dhost,
- sizeof(etherbroadcastaddr)) == 0)
- m->m_flags |= M_BCAST;
- else
- m->m_flags |= M_MCAST;
- }
-
- /* Trim the beginning of the mbuf, to remove the ethernet header */
- m_adj(m, sizeof(struct ether_header));
-
- /* Copy out the first MHLEN bytes of data to ensure correct alignment */
- MGETHDR(m0, M_DONTWAIT, MT_DATA);
- if (m0 == NULL) {
- m_freem(m);
- etheripstat.etherip_adrops++;
- return;
- }
- M_COPY_PKTHDR(m0, m);
- clen = min(MHLEN, m->m_pkthdr.len);
- if (m->m_pkthdr.len == clen)
- mrest = NULL;
- else {
- mrest = m_split(m, clen, M_DONTWAIT);
- if (mrest == NULL) {
- m_freem(m);
- m_freem(m0);
- etheripstat.etherip_adrops++;
- return;
+ m_freem(m);
+ etheripstat.etherip_hdrops++;
+ return /* EAFNOSUPPORT */;
}
- }
- m0->m_next = mrest;
- m0->m_len = clen;
- m_copydata(m, 0, clen, mtod(m0, caddr_t));
- m_freem(m);
- m = m0;
-#if NGIF > 0
- /* Find appropriate gif(4) interface */
- for (i = 0; i < ngif; i++)
- {
- if ((gif[i].gif_psrc == NULL) || (gif[i].gif_pdst == NULL) ||
- !(gif[i].gif_if.if_flags & (IFF_UP|IFF_RUNNING)))
- continue;
-
- if (!bcmp(gif[i].gif_psrc, &sdst, gif[i].gif_psrc->sa_len) &&
- !bcmp(gif[i].gif_pdst, &ssrc, gif[i].gif_pdst->sa_len) &&
- gif[i].gif_if.if_bridge != NULL)
- break;
- }
-
- /* None found */
- if (i >= ngif)
- {
- DPRINTF(("etherip_input(): no interface found\n"));
- etheripstat.etherip_noifdrops++;
+ /* Chop off the `outer' IP and EtherIP headers and reschedule. */
+ m_adj(m, iphlen + sizeof(struct etherip_header));
+
+ /* Statistics */
+ etheripstat.etherip_ibytes += m->m_pkthdr.len;
+
+ /* Copy ethernet header */
+ m_copydata(m, 0, sizeof(eh), (void *) &eh);
+
+ m->m_flags &= ~(M_BCAST|M_MCAST);
+ if (eh.ether_dhost[0] & 1) {
+ if (bcmp((caddr_t) etherbroadcastaddr,
+ (caddr_t)eh.ether_dhost, sizeof(etherbroadcastaddr)) == 0)
+ m->m_flags |= M_BCAST;
+ else
+ m->m_flags |= M_MCAST;
+ }
+
+ /* Trim the beginning of the mbuf, to remove the ethernet header */
+ m_adj(m, sizeof(struct ether_header));
+
+ /* Copy out the first MHLEN bytes of data to ensure correct alignment */
+ MGETHDR(m0, M_DONTWAIT, MT_DATA);
+ if (m0 == NULL) {
+ m_freem(m);
+ etheripstat.etherip_adrops++;
+ return;
+ }
+ M_COPY_PKTHDR(m0, m);
+ clen = min(MHLEN, m->m_pkthdr.len);
+ if (m->m_pkthdr.len == clen)
+ mrest = NULL;
+ else {
+ mrest = m_split(m, clen, M_DONTWAIT);
+ if (mrest == NULL) {
+ m_freem(m);
+ m_freem(m0);
+ etheripstat.etherip_adrops++;
+ return;
+ }
+ }
+ m0->m_next = mrest;
+ m0->m_len = clen;
+ m_copydata(m, 0, clen, mtod(m0, caddr_t));
m_freem(m);
- return;
- }
+ m = m0;
+
+#if NGIF > 0
+ /* Find appropriate gif(4) interface */
+ for (i = 0; i < ngif; i++) {
+ if ((gif[i].gif_psrc == NULL) || (gif[i].gif_pdst == NULL) ||
+ !(gif[i].gif_if.if_flags & (IFF_UP|IFF_RUNNING)))
+ continue;
+
+ if (!bcmp(gif[i].gif_psrc, &sdst, gif[i].gif_psrc->sa_len) &&
+ !bcmp(gif[i].gif_pdst, &ssrc, gif[i].gif_pdst->sa_len) &&
+ gif[i].gif_if.if_bridge != NULL)
+ break;
+ }
+
+ /* None found */
+ if (i >= ngif) {
+ DPRINTF(("etherip_input(): no interface found\n"));
+ etheripstat.etherip_noifdrops++;
+ m_freem(m);
+ return;
+ }
#if NBRIDGE > 0
- /*
- * Tap the packet off here for a bridge. bridge_input() returns
- * NULL if it has consumed the packet. In the case of gif's,
- * bridge_input() returns non-NULL when an error occurs.
- */
- m->m_pkthdr.rcvif = &gif[i].gif_if;
- if (m->m_flags & (M_BCAST|M_MCAST))
- gif[i].gif_if.if_imcasts++;
- m = bridge_input(&gif[i].gif_if, &eh, m);
- if (m == NULL)
- return;
+ /*
+ * Tap the packet off here for a bridge. bridge_input() returns
+ * NULL if it has consumed the packet. In the case of gif's,
+ * bridge_input() returns non-NULL when an error occurs.
+ */
+ m->m_pkthdr.rcvif = &gif[i].gif_if;
+ if (m->m_flags & (M_BCAST|M_MCAST))
+ gif[i].gif_if.if_imcasts++;
+ m = bridge_input(&gif[i].gif_if, &eh, m);
+ if (m == NULL)
+ return;
#endif /* NBRIDGE */
#endif /* NGIF */
- etheripstat.etherip_noifdrops++;
- m_freem(m);
- return;
+ etheripstat.etherip_noifdrops++;
+ m_freem(m);
+ return;
}
#ifdef IPSEC
@@ -304,150 +294,151 @@ etherip_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip,
int protoff)
{
#ifdef INET
- struct ip *ipo;
+ struct ip *ipo;
#endif /* INET */
#ifdef INET6
- struct ip6_hdr *ip6;
+ struct ip6_hdr *ip6;
#endif /* INET6 */
- struct etherip_header eip;
- struct mbuf *m0;
- ushort hlen;
-
- /* Some address family sanity checks */
- if ((tdb->tdb_src.sa.sa_family != 0) &&
- (tdb->tdb_src.sa.sa_family != AF_INET) &&
- (tdb->tdb_src.sa.sa_family != AF_INET6))
- {
- DPRINTF(("etherip_output(): IP in protocol-family <%d> attempted, aborting", tdb->tdb_src.sa.sa_family));
- etheripstat.etherip_adrops++;
- m_freem(m);
- return EINVAL;
- }
-
- if ((tdb->tdb_dst.sa.sa_family != AF_INET) &&
- (tdb->tdb_dst.sa.sa_family != AF_INET6))
- {
- DPRINTF(("etherip_output(): IP in protocol-family <%d> attempted, aborting", tdb->tdb_dst.sa.sa_family));
- etheripstat.etherip_adrops++;
- m_freem(m);
- return EINVAL;
- }
+ struct etherip_header eip;
+ struct mbuf *m0;
+ ushort hlen;
+
+ /* Some address family sanity checks */
+ if ((tdb->tdb_src.sa.sa_family != 0) &&
+ (tdb->tdb_src.sa.sa_family != AF_INET) &&
+ (tdb->tdb_src.sa.sa_family != AF_INET6)) {
+ DPRINTF(("etherip_output(): IP in protocol-family <%d> attempted, aborting",
+ tdb->tdb_src.sa.sa_family));
+ etheripstat.etherip_adrops++;
+ m_freem(m);
+ return EINVAL;
+ }
- if (tdb->tdb_dst.sa.sa_family != tdb->tdb_src.sa.sa_family)
- {
- DPRINTF(("etherip_output(): mismatch in tunnel source and destination address protocol families (%d/%d), aborting", tdb->tdb_src.sa.sa_family, tdb->tdb_dst.sa.sa_family));
- etheripstat.etherip_adrops++;
- m_freem(m);
- return EINVAL;
- }
+ if ((tdb->tdb_dst.sa.sa_family != AF_INET) &&
+ (tdb->tdb_dst.sa.sa_family != AF_INET6)) {
+ DPRINTF(("etherip_output(): IP in protocol-family <%d> attempted, aborting",
+ tdb->tdb_dst.sa.sa_family));
+ etheripstat.etherip_adrops++;
+ m_freem(m);
+ return EINVAL;
+ }
+
+ if (tdb->tdb_dst.sa.sa_family != tdb->tdb_src.sa.sa_family) {
+ DPRINTF(("etherip_output(): mismatch in tunnel source and destination address protocol families (%d/%d), aborting",
+ tdb->tdb_src.sa.sa_family, tdb->tdb_dst.sa.sa_family));
+ etheripstat.etherip_adrops++;
+ m_freem(m);
+ return EINVAL;
+ }
- switch (tdb->tdb_dst.sa.sa_family)
- {
+ switch (tdb->tdb_dst.sa.sa_family) {
#ifdef INET
case AF_INET:
- hlen = sizeof(struct ip);
- break;
+ hlen = sizeof(struct ip);
+ break;
#endif /* INET */
#ifdef INET6
case AF_INET6:
- hlen = sizeof(struct ip6_hdr);
- break;
+ hlen = sizeof(struct ip6_hdr);
+ break;
#endif /* INET6 */
default:
- DPRINTF(("etherip_output(): unsupported tunnel protocol family <%d>, aborting", tdb->tdb_dst.sa.sa_family));
- etheripstat.etherip_adrops++;
- m_freem(m);
- return EINVAL;
- }
-
- /* Don't forget the EtherIP header */
- hlen += sizeof(struct etherip_header);
-
- MGETHDR(m0, M_DONTWAIT, MT_DATA);
- if (m0 == NULL) {
- DPRINTF(("etherip_output(): M_GETHDR failed\n"));
- etheripstat.etherip_adrops++;
- m_freem(m);
- return ENOBUFS;
- }
- M_COPY_PKTHDR(m0, m);
- m0->m_next = m;
- m0->m_len = hlen;
- m0->m_pkthdr.len += hlen;
- m = m0;
-
- /* Statistics */
- etheripstat.etherip_opackets++;
- etheripstat.etherip_obytes += m->m_pkthdr.len - hlen;
-
- switch (tdb->tdb_dst.sa.sa_family)
- {
+ DPRINTF(("etherip_output(): unsupported tunnel protocol family <%d>, aborting",
+ tdb->tdb_dst.sa.sa_family));
+ etheripstat.etherip_adrops++;
+ m_freem(m);
+ return EINVAL;
+ }
+
+ /* Don't forget the EtherIP header */
+ hlen += sizeof(struct etherip_header);
+
+ MGETHDR(m0, M_DONTWAIT, MT_DATA);
+ if (m0 == NULL) {
+ DPRINTF(("etherip_output(): M_GETHDR failed\n"));
+ etheripstat.etherip_adrops++;
+ m_freem(m);
+ return ENOBUFS;
+ }
+ M_COPY_PKTHDR(m0, m);
+ m0->m_next = m;
+ m0->m_len = hlen;
+ m0->m_pkthdr.len += hlen;
+ m = m0;
+
+ /* Statistics */
+ etheripstat.etherip_opackets++;
+ etheripstat.etherip_obytes += m->m_pkthdr.len - hlen;
+
+ switch (tdb->tdb_dst.sa.sa_family) {
#ifdef INET
case AF_INET:
- ipo = mtod(m, struct ip *);
-
- ipo->ip_v = IPVERSION;
- ipo->ip_hl = 5;
- ipo->ip_len = htons(m->m_pkthdr.len);
- ipo->ip_ttl = ip_defttl;
- ipo->ip_p = IPPROTO_ETHERIP;
- ipo->ip_tos = 0;
- ipo->ip_off = 0;
- ipo->ip_sum = 0;
- ipo->ip_id = ip_randomid();
- HTONS(ipo->ip_id);
-
- /*
- * We should be keeping tunnel soft-state and send back
- * ICMPs as needed.
- */
-
- ipo->ip_src = tdb->tdb_src.sin.sin_addr;
- ipo->ip_dst = tdb->tdb_dst.sin.sin_addr;
- break;
+ ipo = mtod(m, struct ip *);
+
+ ipo->ip_v = IPVERSION;
+ ipo->ip_hl = 5;
+ ipo->ip_len = htons(m->m_pkthdr.len);
+ ipo->ip_ttl = ip_defttl;
+ ipo->ip_p = IPPROTO_ETHERIP;
+ ipo->ip_tos = 0;
+ ipo->ip_off = 0;
+ ipo->ip_sum = 0;
+ ipo->ip_id = ip_randomid();
+ HTONS(ipo->ip_id);
+
+ /*
+ * We should be keeping tunnel soft-state and send back
+ * ICMPs as needed.
+ */
+
+ ipo->ip_src = tdb->tdb_src.sin.sin_addr;
+ ipo->ip_dst = tdb->tdb_dst.sin.sin_addr;
+ break;
#endif /* INET */
#ifdef INET6
case AF_INET6:
- ip6 = mtod(m, struct ip6_hdr *);
-
- ip6->ip6_flow = 0;
- ip6->ip6_vfc &= ~IPV6_VERSION_MASK;
- ip6->ip6_vfc |= IPV6_VERSION;
- ip6->ip6_plen = htons(m->m_pkthdr.len);
- ip6->ip6_hlim = ip_defttl;
- ip6->ip6_dst = tdb->tdb_dst.sin6.sin6_addr;
- ip6->ip6_src = tdb->tdb_src.sin6.sin6_addr;
- break;
+ ip6 = mtod(m, struct ip6_hdr *);
+
+ ip6->ip6_flow = 0;
+ ip6->ip6_vfc &= ~IPV6_VERSION_MASK;
+ ip6->ip6_vfc |= IPV6_VERSION;
+ ip6->ip6_plen = htons(m->m_pkthdr.len);
+ ip6->ip6_hlim = ip_defttl;
+ ip6->ip6_dst = tdb->tdb_dst.sin6.sin6_addr;
+ ip6->ip6_src = tdb->tdb_src.sin6.sin6_addr;
+ break;
#endif /* INET6 */
- }
+ }
- /* Set the version number */
- eip.eip_ver = ETHERIP_VERSION & ETHERIP_VER_VERS_MASK;
- m_copyback(m, hlen - sizeof(struct etherip_header),
- sizeof(struct etherip_header), (caddr_t)&eip);
+ /* Set the version number */
+ eip.eip_ver = ETHERIP_VERSION & ETHERIP_VER_VERS_MASK;
+ m_copyback(m, hlen - sizeof(struct etherip_header),
+ sizeof(struct etherip_header), (caddr_t)&eip);
- *mp = m;
+ *mp = m;
- return 0;
+ return 0;
}
#endif /* IPSEC */
int
-etherip_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp,
- void *newp, size_t newlen)
+etherip_sysctl(name, namelen, oldp, oldlenp, newp, newlen)
+ int *name;
+ u_int namelen;
+ void *oldp, *newp;
+ size_t *oldlenp, newlen;
{
- /* All sysctl names at this level are terminal. */
- if (namelen != 1)
- return (ENOTDIR);
+ /* All sysctl names at this level are terminal. */
+ if (namelen != 1)
+ return (ENOTDIR);
- switch (name[0])
- {
+ switch (name[0]) {
case ETHERIPCTL_ALLOW:
- return (sysctl_int(oldp, oldlenp, newp, newlen, &etherip_allow));
+ return (sysctl_int(oldp, oldlenp, newp, newlen, &etherip_allow));
default:
- return (ENOPROTOOPT);
- }
- /* NOTREACHED */
+ return (ENOPROTOOPT);
+ }
+ /* NOTREACHED */
}
diff --git a/sys/netinet/ip_ether.h b/sys/netinet/ip_ether.h
index 63171c03747..975f56e59a0 100644
--- a/sys/netinet/ip_ether.h
+++ b/sys/netinet/ip_ether.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_ether.h,v 1.7 2001/02/02 08:28:21 jason Exp $ */
+/* $OpenBSD: ip_ether.h,v 1.8 2001/02/03 19:45:04 jason Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@adk.gr)
@@ -27,17 +27,16 @@
* Ethernet-inside-IP processing.
*/
-struct etheripstat
-{
- u_int32_t etherip_hdrops; /* packet shorter than header shows */
- u_int32_t etherip_qfull; /* bridge queue full, packet dropped */
- u_int32_t etherip_noifdrops; /* no interface/bridge information */
- u_int32_t etherip_pdrops; /* packet dropped due to policy */
- u_int32_t etherip_adrops; /* all other drops */
- u_int32_t etherip_ipackets; /* total input packets */
- u_int32_t etherip_opackets; /* total output packets */
- u_int64_t etherip_ibytes; /* input bytes */
- u_int64_t etherip_obytes; /* output bytes */
+struct etheripstat {
+ u_int32_t etherip_hdrops; /* packet shorter than header shows */
+ u_int32_t etherip_qfull; /* bridge queue full, packet dropped */
+ u_int32_t etherip_noifdrops; /* no interface/bridge information */
+ u_int32_t etherip_pdrops; /* packet dropped due to policy */
+ u_int32_t etherip_adrops; /* all other drops */
+ u_int32_t etherip_ipackets; /* total input packets */
+ u_int32_t etherip_opackets; /* total output packets */
+ u_int64_t etherip_ibytes; /* input bytes */
+ u_int64_t etherip_obytes; /* output bytes */
};
struct etherip_header {