From: tedu Date: Fri, 19 Dec 2014 17:14:39 +0000 (+0000) Subject: unifdef INET in net code as a precursor to removing the pretend option. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=ad7d1a35772c9644798c16552534a957cfb9959d;p=openbsd unifdef INET in net code as a precursor to removing the pretend option. long live the one true internet. ok henning mikeb --- diff --git a/sys/net/bridgestp.c b/sys/net/bridgestp.c index b722bb12794..f86bef91d39 100644 --- a/sys/net/bridgestp.c +++ b/sys/net/bridgestp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bridgestp.c,v 1.50 2014/09/08 06:24:13 jsg Exp $ */ +/* $OpenBSD: bridgestp.c,v 1.51 2014/12/19 17:14:39 tedu Exp $ */ /* * Copyright (c) 2000 Jason L. Wright (jason@thought.net) @@ -52,11 +52,9 @@ #include #include -#ifdef INET #include #include #include -#endif #include diff --git a/sys/net/if.c b/sys/net/if.c index 50e87b33d9d..55161b8cd02 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.308 2014/12/18 15:29:30 krw Exp $ */ +/* $OpenBSD: if.c,v 1.309 2014/12/19 17:14:39 tedu Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -88,19 +88,14 @@ #include #include -#ifdef INET #include #include #include #ifdef MROUTING #include #endif -#endif #ifdef INET6 -#ifndef INET -#include -#endif #include #include #include @@ -501,7 +496,6 @@ if_detach(struct ifnet *ifp) bpfdetach(ifp); #endif rt_if_remove(ifp); -#ifdef INET rti_delete(ifp); #if NETHER > 0 && defined(NFSCLIENT) if (ifp == revarp_ifp) @@ -510,10 +504,7 @@ if_detach(struct ifnet *ifp) #ifdef MROUTING vif_delete(ifp); #endif -#endif -#ifdef INET in_ifdetach(ifp); -#endif #ifdef INET6 in6_ifdetach(ifp); #endif @@ -532,10 +523,8 @@ do { \ extern struct ifqueue x; \ if_detach_queues(ifp, & x); \ } while (0) -#ifdef INET IF_DETACH_QUEUES(arpintrq); IF_DETACH_QUEUES(ipintrq); -#endif #ifdef INET6 IF_DETACH_QUEUES(ip6intrq); #endif @@ -1526,18 +1515,14 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p) if (up) if_down(ifp); rt_if_remove(ifp); -#ifdef INET rti_delete(ifp); #ifdef MROUTING vif_delete(ifp); #endif -#endif #ifdef INET6 in6_ifdetach(ifp); #endif -#ifdef INET in_ifdetach(ifp); -#endif splx(s); } diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index f2b4fd6a6f9..4ef6e211c56 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bridge.c,v 1.229 2014/12/04 16:16:20 mikeb Exp $ */ +/* $OpenBSD: if_bridge.c,v 1.230 2014/12/19 17:14:39 tedu Exp $ */ /* * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net) @@ -51,13 +51,11 @@ #include #include -#ifdef INET #include #include #include #include #include -#endif #ifdef IPSEC #include @@ -143,10 +141,8 @@ struct mbuf *bridge_ip(struct bridge_softc *, int, struct ifnet *, int bridge_ifenqueue(struct bridge_softc *, struct ifnet *, struct mbuf *); void bridge_fragment(struct bridge_softc *, struct ifnet *, struct ether_header *, struct mbuf *); -#ifdef INET void bridge_send_icmp_err(struct bridge_softc *, struct ifnet *, struct ether_header *, struct mbuf *, int, struct llc *, int, int, int); -#endif #ifdef IPSEC int bridge_ipsec(struct bridge_softc *, struct ifnet *, struct ether_header *, int, struct llc *, @@ -1595,7 +1591,6 @@ bridge_localbroadcast(struct bridge_softc *sc, struct ifnet *ifp, struct mbuf *m1; u_int16_t etype; -#ifdef INET /* * quick optimisation, don't send packets up the stack if no * corresponding address has been specified. @@ -1610,7 +1605,6 @@ bridge_localbroadcast(struct bridge_softc *sc, struct ifnet *ifp, if (ifa == NULL) return; } -#endif m1 = m_copym2(m, 0, M_COPYALL, M_DONTWAIT); if (m1 == NULL) { @@ -2203,9 +2197,7 @@ bridge_ipsec(struct bridge_softc *sc, struct ifnet *ifp, u_int16_t cpi; int error, off, s; u_int8_t proto = 0; -#ifdef INET struct ip *ip; -#endif /* INET */ #ifdef INET6 struct ip6_hdr *ip6; #endif /* INET6 */ @@ -2215,7 +2207,6 @@ bridge_ipsec(struct bridge_softc *sc, struct ifnet *ifp, if (dir == BRIDGE_IN) { switch (af) { -#ifdef INET case AF_INET: if (m->m_pkthdr.len - hlen < 2 * sizeof(u_int32_t)) break; @@ -2247,7 +2238,6 @@ bridge_ipsec(struct bridge_softc *sc, struct ifnet *ifp, spi = ntohl(htons(cpi)); } break; -#endif /* INET */ #ifdef INET6 case AF_INET6: if (m->m_pkthdr.len - hlen < 2 * sizeof(u_int32_t)) @@ -2596,14 +2586,9 @@ bridge_fragment(struct bridge_softc *sc, struct ifnet *ifp, struct mbuf *m0; int s, error = 0; int hassnap = 0; -#ifdef INET u_int16_t etype; struct ip *ip; -#endif -#ifndef INET - goto dropit; -#else etype = ntohs(eh->ether_type); #if NVLAN > 0 if ((m->m_flags & M_VLANTAG) || etype == ETHERTYPE_VLAN || @@ -2699,7 +2684,6 @@ bridge_fragment(struct bridge_softc *sc, struct ifnet *ifp, ipstat.ips_fragmented++; return; -#endif /* INET */ dropit: if (m != NULL) m_freem(m); @@ -2777,7 +2761,6 @@ bridge_ifenqueue(struct bridge_softc *sc, struct ifnet *ifp, struct mbuf *m) return (0); } -#ifdef INET void bridge_send_icmp_err(struct bridge_softc *sc, struct ifnet *ifp, struct ether_header *eh, struct mbuf *n, int hassnap, struct llc *llc, @@ -2850,7 +2833,6 @@ bridge_send_icmp_err(struct bridge_softc *sc, struct ifnet *ifp, dropit: m_freem(n); } -#endif struct sockaddr * bridge_tunnel(struct mbuf *m) diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index a7ff5b1fc6a..27193378ab8 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ethersubr.c,v 1.183 2014/12/08 10:46:14 mpi Exp $ */ +/* $OpenBSD: if_ethersubr.c,v 1.184 2014/12/19 17:14:39 tedu Exp $ */ /* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */ /* @@ -312,7 +312,6 @@ ether_output(struct ifnet *ifp0, struct mbuf *m0, struct sockaddr *dst, } switch (dst->sa_family) { -#ifdef INET case AF_INET: if (!arpresolve(ac, rt, m, dst, edst)) return (0); /* if not yet resolved */ @@ -322,7 +321,6 @@ ether_output(struct ifnet *ifp0, struct mbuf *m0, struct sockaddr *dst, mcopy = m_copy(m, 0, (int)M_COPYALL); etype = htons(ETHERTYPE_IP); break; -#endif #ifdef INET6 case AF_INET6: if (!nd6_storelladdr(ifp, rt, m, dst, (u_char *)edst)) @@ -625,7 +623,6 @@ ether_input(struct ifnet *ifp0, struct ether_header *eh, struct mbuf *m) decapsulate: switch (etype) { -#ifdef INET case ETHERTYPE_IP: schednetisr(NETISR_IP); inq = &ipintrq; @@ -644,7 +641,6 @@ decapsulate: revarpinput(m); /* XXX queue? */ goto done; -#endif #ifdef INET6 /* * Schedule IPv6 software interrupt for incoming IPv6 packet. @@ -918,12 +914,10 @@ ether_crc32_be(const u_int8_t *buf, size_t len) return ether_crc32_be_update(0xffffffff, buf, len); } -#ifdef INET u_char ether_ipmulticast_min[ETHER_ADDR_LEN] = { 0x01, 0x00, 0x5e, 0x00, 0x00, 0x00 }; u_char ether_ipmulticast_max[ETHER_ADDR_LEN] = { 0x01, 0x00, 0x5e, 0x7f, 0xff, 0xff }; -#endif #ifdef INET6 u_char ether_ip6multicast_min[ETHER_ADDR_LEN] = @@ -940,9 +934,7 @@ int ether_multiaddr(struct sockaddr *sa, u_int8_t addrlo[ETHER_ADDR_LEN], u_int8_t addrhi[ETHER_ADDR_LEN]) { -#ifdef INET struct sockaddr_in *sin; -#endif /* INET */ #ifdef INET6 struct sockaddr_in6 *sin6; #endif /* INET6 */ @@ -954,7 +946,6 @@ ether_multiaddr(struct sockaddr *sa, u_int8_t addrlo[ETHER_ADDR_LEN], memcpy(addrhi, addrlo, ETHER_ADDR_LEN); break; -#ifdef INET case AF_INET: sin = satosin(sa); if (sin->sin_addr.s_addr == INADDR_ANY) { @@ -971,7 +962,6 @@ ether_multiaddr(struct sockaddr *sa, u_int8_t addrlo[ETHER_ADDR_LEN], memcpy(addrhi, addrlo, ETHER_ADDR_LEN); } break; -#endif #ifdef INET6 case AF_INET6: sin6 = satosin6(sa); diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c index 6d4333f62f5..1dd8cfec79e 100644 --- a/sys/net/if_gif.c +++ b/sys/net/if_gif.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_gif.c,v 1.71 2014/12/05 15:50:04 mpi Exp $ */ +/* $OpenBSD: if_gif.c,v 1.72 2014/12/19 17:14:39 tedu Exp $ */ /* $KAME: if_gif.c,v 1.43 2001/02/20 08:51:07 itojun Exp $ */ /* @@ -44,19 +44,14 @@ #include #include -#ifdef INET #include #include #include #include #include #include -#endif /* INET */ #ifdef INET6 -#ifndef INET -#include -#endif #include #include #include @@ -181,11 +176,9 @@ gif_start(struct ifnet *ifp) */ m->m_flags &= ~(M_BCAST|M_MCAST); switch (sc->gif_psrc->sa_family) { -#ifdef INET case AF_INET: error = in_gif_output(ifp, AF_LINK, &m); break; -#endif #ifdef INET6 case AF_INET6: error = in6_gif_output(ifp, AF_LINK, &m); @@ -210,12 +203,10 @@ gif_start(struct ifnet *ifp) /* must decapsulate outer header for bpf */ switch (sc->gif_psrc->sa_family) { -#ifdef INET case AF_INET: offset = sizeof(struct ip); proto = mtod(m, struct ip *)->ip_p; break; -#endif #ifdef INET6 case AF_INET6: offset = sizeof(struct ip6_hdr); @@ -259,11 +250,9 @@ gif_start(struct ifnet *ifp) /* XXX we should cache the outgoing route */ switch (sc->gif_psrc->sa_family) { -#ifdef INET case AF_INET: ip_output(m, NULL, NULL, 0, NULL, NULL, 0); break; -#endif #ifdef INET6 case AF_INET6: /* @@ -308,11 +297,9 @@ gif_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, * Encapsulate packet. Add IP or IP6 header depending on tunnel AF. */ switch (sc->gif_psrc->sa_family) { -#ifdef INET case AF_INET: error = in_gif_output(ifp, dst->sa_family, &m); break; -#endif #ifdef INET6 case AF_INET6: error = in6_gif_output(ifp, dst->sa_family, &m); @@ -380,14 +367,12 @@ gif_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) #endif /* INET6 */ case SIOCSLIFPHYADDR: switch (cmd) { -#ifdef INET case SIOCSIFPHYADDR: src = (struct sockaddr *) &(((struct in_aliasreq *)data)->ifra_addr); dst = (struct sockaddr *) &(((struct in_aliasreq *)data)->ifra_dstaddr); break; -#endif #ifdef INET6 case SIOCSIFPHYADDR_IN6: src = (struct sockaddr *) @@ -412,12 +397,10 @@ gif_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) /* validate sa_len */ switch (src->sa_family) { -#ifdef INET case AF_INET: if (src->sa_len != sizeof(struct sockaddr_in)) return (EINVAL); break; -#endif #ifdef INET6 case AF_INET6: if (src->sa_len != sizeof(struct sockaddr_in6)) @@ -428,12 +411,10 @@ gif_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) return (EAFNOSUPPORT); } switch (dst->sa_family) { -#ifdef INET case AF_INET: if (dst->sa_len != sizeof(struct sockaddr_in)) return (EINVAL); break; -#endif #ifdef INET6 case AF_INET6: if (dst->sa_len != sizeof(struct sockaddr_in6)) @@ -543,12 +524,10 @@ gif_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } src = sc->gif_psrc; switch (cmd) { -#ifdef INET case SIOCGIFPSRCADDR: dst = &ifr->ifr_addr; size = sizeof(ifr->ifr_addr); break; -#endif /* INET */ #ifdef INET6 case SIOCGIFPSRCADDR_IN6: dst = (struct sockaddr *) @@ -575,12 +554,10 @@ gif_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } src = sc->gif_pdst; switch (cmd) { -#ifdef INET case SIOCGIFPDSTADDR: dst = &ifr->ifr_addr; size = sizeof(ifr->ifr_addr); break; -#endif /* INET */ #ifdef INET6 case SIOCGIFPDSTADDR_IN6: dst = (struct sockaddr *) diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c index bd88af6d64c..ec4a9211710 100644 --- a/sys/net/if_gre.c +++ b/sys/net/if_gre.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_gre.c,v 1.72 2014/11/23 07:39:02 deraadt Exp $ */ +/* $OpenBSD: if_gre.c,v 1.73 2014/12/19 17:14:39 tedu Exp $ */ /* $NetBSD: if_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */ /* @@ -57,14 +57,10 @@ #include #include -#ifdef INET #include #include #include #include -#else -#error "if_gre used without inet" -#endif #if NBPFILTER > 0 #include diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c index f537f677311..b1477bea6e7 100644 --- a/sys/net/if_loop.c +++ b/sys/net/if_loop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_loop.c,v 1.61 2014/12/05 15:50:04 mpi Exp $ */ +/* $OpenBSD: if_loop.c,v 1.62 2014/12/19 17:14:39 tedu Exp $ */ /* $NetBSD: if_loop.c,v 1.15 1996/05/07 02:40:33 thorpej Exp $ */ /* @@ -123,15 +123,10 @@ #include #include -#ifdef INET #include #include -#endif #ifdef INET6 -#ifndef INET -#include -#endif #include #endif @@ -235,12 +230,10 @@ looutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, ifp->if_obytes += m->m_pkthdr.len; switch (dst->sa_family) { -#ifdef INET case AF_INET: ifq = &ipintrq; isr = NETISR_IP; break; -#endif #ifdef INET6 case AF_INET6: ifq = &ip6intrq; diff --git a/sys/net/if_mpe.c b/sys/net/if_mpe.c index 897ebd1b375..c998efd4d64 100644 --- a/sys/net/if_mpe.c +++ b/sys/net/if_mpe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_mpe.c,v 1.39 2014/12/05 15:50:04 mpi Exp $ */ +/* $OpenBSD: if_mpe.c,v 1.40 2014/12/19 17:14:39 tedu Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard @@ -30,16 +30,11 @@ #include #include -#ifdef INET #include #include -#endif #ifdef INET6 #include -#ifndef INET -#include -#endif #endif /* INET6 */ #include "bpfilter.h" @@ -214,7 +209,6 @@ mpeoutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, error = 0; switch (dst->sa_family) { -#ifdef INET case AF_INET: if (rt && rt->rt_flags & RTF_MPLS) { shim.shim_label = @@ -243,7 +237,6 @@ mpeoutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, m_copyback(m, sizeof(sa_family_t), sizeof(in_addr_t), (caddr_t)&((satosin(dst)->sin_addr)), M_NOWAIT); break; -#endif default: m_freem(m); error = EPFNOSUPPORT; diff --git a/sys/net/if_pflog.c b/sys/net/if_pflog.c index 4c660d3dc76..dd23c716e52 100644 --- a/sys/net/if_pflog.c +++ b/sys/net/if_pflog.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pflog.c,v 1.66 2014/12/05 15:50:04 mpi Exp $ */ +/* $OpenBSD: if_pflog.c,v 1.67 2014/12/19 17:14:39 tedu Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -49,18 +49,13 @@ #include #include -#ifdef INET #include #include #include #include #include -#endif #ifdef INET6 -#ifndef INET -#include -#endif #include #include #endif /* INET6 */ diff --git a/sys/net/if_pflow.c b/sys/net/if_pflow.c index 43d78ca1516..ac27853cfb5 100644 --- a/sys/net/if_pflow.c +++ b/sys/net/if_pflow.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pflow.c,v 1.48 2014/11/20 14:51:42 krw Exp $ */ +/* $OpenBSD: if_pflow.c,v 1.49 2014/12/19 17:14:39 tedu Exp $ */ /* * Copyright (c) 2011 Florian Obser @@ -38,13 +38,11 @@ #include #include -#ifdef INET #include #include #include #include #include -#endif /* INET */ #include #include diff --git a/sys/net/if_pfsync.c b/sys/net/if_pfsync.c index f9a3d2a4c45..9438606d2e1 100644 --- a/sys/net/if_pfsync.c +++ b/sys/net/if_pfsync.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pfsync.c,v 1.214 2014/12/17 09:57:13 mpi Exp $ */ +/* $OpenBSD: if_pfsync.c,v 1.215 2014/12/19 17:14:39 tedu Exp $ */ /* * Copyright (c) 2002 Michael Shalayeff @@ -64,11 +64,9 @@ #include #include -#ifdef INET #include #include #include -#endif #ifdef INET6 #include @@ -1776,13 +1774,11 @@ pfsync_undefer(struct pfsync_deferral *pd, int drop) else { if (pd->pd_st->rule.ptr->rt == PF_ROUTETO) { switch (pd->pd_st->key[PF_SK_WIRE]->af) { -#ifdef INET case AF_INET: pf_route(&pd->pd_m, pd->pd_st->rule.ptr, pd->pd_st->direction, pd->pd_st->rt_kif->pfik_ifp, pd->pd_st); break; -#endif /* INET */ #ifdef INET6 case AF_INET6: pf_route6(&pd->pd_m, pd->pd_st->rule.ptr, @@ -1793,12 +1789,10 @@ pfsync_undefer(struct pfsync_deferral *pd, int drop) } } else { switch (pd->pd_st->key[PF_SK_WIRE]->af) { -#ifdef INET case AF_INET: ip_output(pd->pd_m, NULL, NULL, 0, NULL, NULL, 0); break; -#endif /* INET */ #ifdef INET6 case AF_INET6: ip6_output(pd->pd_m, NULL, NULL, 0, diff --git a/sys/net/if_ppp.c b/sys/net/if_ppp.c index ce8471271f9..5169800b4f3 100644 --- a/sys/net/if_ppp.c +++ b/sys/net/if_ppp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ppp.c,v 1.79 2014/12/13 21:05:33 doug Exp $ */ +/* $OpenBSD: if_ppp.c,v 1.80 2014/12/19 17:14:39 tedu Exp $ */ /* $NetBSD: if_ppp.c,v 1.39 1997/05/17 21:11:59 christos Exp $ */ /* @@ -126,16 +126,8 @@ #include #include -#ifdef INET #include #include -#else -#ifdef _KERNEL -#ifdef VJC -#error ppp device with VJC assumes INET -#endif -#endif -#endif #include "bpfilter.h" @@ -705,7 +697,6 @@ pppoutput(struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst, */ m0->m_flags &= ~M_HIGHPRI; switch (dst->sa_family) { -#ifdef INET case AF_INET: address = PPP_ALLSTATIONS; control = PPP_UI; @@ -720,7 +711,6 @@ pppoutput(struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst, if (ip->ip_tos & IPTOS_LOWDELAY) m0->m_flags |= M_HIGHPRI; break; -#endif case AF_UNSPEC: address = PPP_ADDRESS(dst->sa_data); control = PPP_CONTROL(dst->sa_data); @@ -1459,7 +1449,6 @@ ppp_inproc(struct ppp_softc *sc, struct mbuf *m) rv = 0; switch (proto) { -#ifdef INET case PPP_IP: /* * IP packet - take off the ppp header and pass it up to IP. @@ -1476,7 +1465,6 @@ ppp_inproc(struct ppp_softc *sc, struct mbuf *m) schednetisr(NETISR_IP); inq = &ipintrq; break; -#endif default: /* diff --git a/sys/net/if_pppx.c b/sys/net/if_pppx.c index a95d91ac593..085507e2f71 100644 --- a/sys/net/if_pppx.c +++ b/sys/net/if_pppx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pppx.c,v 1.34 2014/09/08 06:24:13 jsg Exp $ */ +/* $OpenBSD: if_pppx.c,v 1.35 2014/12/19 17:14:39 tedu Exp $ */ /* * Copyright (c) 2010 Claudio Jeker @@ -69,11 +69,9 @@ #include #include -#ifdef INET #include #include #include -#endif #ifdef INET6 #include @@ -381,12 +379,10 @@ pppxwrite(dev_t dev, struct uio *uio, int ioflag) m_adj(top, sizeof(struct pppx_hdr)); switch (ntohl(th->pppx_proto)) { -#ifdef INET case AF_INET: ifq = &ipintrq; isr = NETISR_IP; break; -#endif #ifdef INET6 case AF_INET6: ifq = &ip6intrq; diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c index 8a2dbc488ea..4f02e529f3c 100644 --- a/sys/net/if_spppsubr.c +++ b/sys/net/if_spppsubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_spppsubr.c,v 1.128 2014/12/05 15:50:04 mpi Exp $ */ +/* $OpenBSD: if_spppsubr.c,v 1.129 2014/12/19 17:14:39 tedu Exp $ */ /* * Synchronous PPP/Cisco link level subroutines. * Keepalive protocol implemented in both Cisco and PPP modes. @@ -56,13 +56,11 @@ #include -#ifdef INET #include #include #include #include #include -#endif #ifdef INET6 #include @@ -375,11 +373,7 @@ static const struct cp lcp = { static const struct cp ipcp = { PPP_IPCP, IDX_IPCP, -#ifdef INET /* don't run IPCP if there's no IPv4 support */ CP_NCP, -#else - 0, -#endif "ipcp", sppp_ipcp_up, sppp_ipcp_down, sppp_ipcp_open, sppp_ipcp_close, sppp_ipcp_TO, sppp_ipcp_RCR, sppp_ipcp_RCN_rej, sppp_ipcp_RCN_nak, @@ -537,7 +531,6 @@ sppp_input(struct ifnet *ifp, struct mbuf *m) sppp_chap_input(sp, m); m_freem (m); return; -#ifdef INET case PPP_IPCP: if (sp->pp_phase == PHASE_NETWORK) sppp_cp_input(&ipcp, sp, m); @@ -550,7 +543,6 @@ sppp_input(struct ifnet *ifp, struct mbuf *m) sp->pp_last_activity = tv.tv_sec; } break; -#endif #ifdef INET6 case PPP_IPV6CP: if (sp->pp_phase == PHASE_NETWORK) @@ -587,12 +579,10 @@ sppp_input(struct ifnet *ifp, struct mbuf *m) sppp_cisco_input ((struct sppp*) ifp, m); m_freem (m); return; -#ifdef INET case ETHERTYPE_IP: schednetisr (NETISR_IP); inq = &ipintrq; break; -#endif #ifdef INET6 case ETHERTYPE_IPV6: schednetisr (NETISR_IPV6); @@ -677,7 +667,6 @@ sppp_output(struct ifnet *ifp, struct mbuf *m, s = splnet(); } -#ifdef INET /* * Put low delay, telnet, rlogin and ftp control packets * in front of the queue. @@ -717,7 +706,6 @@ sppp_output(struct ifnet *ifp, struct mbuf *m, return (0); } } -#endif if (sp->pp_flags & PP_NOFRAMING) goto skip_header; @@ -748,7 +736,6 @@ sppp_output(struct ifnet *ifp, struct mbuf *m, skip_header: switch (dst->sa_family) { -#ifdef INET case AF_INET: /* Internet Protocol */ if (sp->pp_flags & PP_CISCO) protocol = htons (ETHERTYPE_IP); @@ -767,7 +754,6 @@ sppp_output(struct ifnet *ifp, struct mbuf *m, rv = ENETDOWN; } break; -#endif #ifdef INET6 case AF_INET6: /* Internet Protocol v6 */ if (sp->pp_flags & PP_CISCO) diff --git a/sys/net/if_trunk.c b/sys/net/if_trunk.c index e45bfb887c1..d384c86b331 100644 --- a/sys/net/if_trunk.c +++ b/sys/net/if_trunk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_trunk.c,v 1.93 2014/12/04 00:01:53 tedu Exp $ */ +/* $OpenBSD: if_trunk.c,v 1.94 2014/12/19 17:14:39 tedu Exp $ */ /* * Copyright (c) 2005, 2006, 2007 Reyk Floeter @@ -40,11 +40,9 @@ #include #endif -#ifdef INET #include #include #include -#endif #ifdef INET6 #include @@ -729,10 +727,8 @@ trunk_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; case SIOCSIFADDR: ifp->if_flags |= IFF_UP; -#ifdef INET if (ifa->ifa_addr->sa_family == AF_INET) arp_ifinit(&tr->tr_ac, ifa); -#endif /* INET */ error = ENETRESET; break; case SIOCSIFFLAGS: @@ -977,9 +973,7 @@ trunk_hashmbuf(struct mbuf *m, SIPHASH_KEY *key) u_int16_t *vlan, vlanbuf[2]; int off; struct ether_header *eh; -#ifdef INET struct ip *ip, ipbuf; -#endif #ifdef INET6 u_int32_t flow; struct ip6_hdr *ip6, ip6buf; @@ -1010,7 +1004,6 @@ trunk_hashmbuf(struct mbuf *m, SIPHASH_KEY *key) } switch (etype) { -#ifdef INET case ETHERTYPE_IP: if ((ip = (struct ip *) trunk_gethdr(m, off, sizeof(*ip), &ipbuf)) == NULL) @@ -1018,7 +1011,6 @@ trunk_hashmbuf(struct mbuf *m, SIPHASH_KEY *key) SipHash24_Update(&ctx, &ip->ip_src, sizeof(struct in_addr)); SipHash24_Update(&ctx, &ip->ip_dst, sizeof(struct in_addr)); break; -#endif #ifdef INET6 case ETHERTYPE_IPV6: if ((ip6 = (struct ip6_hdr *) diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index 2350c436e5e..accd04e4777 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tun.c,v 1.129 2014/10/21 10:52:53 yasuoka Exp $ */ +/* $OpenBSD: if_tun.c,v 1.130 2014/12/19 17:14:40 tedu Exp $ */ /* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */ /* @@ -61,11 +61,9 @@ #include #include -#ifdef INET #include #include #include -#endif #ifdef PIPEX #include @@ -414,7 +412,6 @@ tuninit(struct tun_softc *tp) tp->tun_flags &= ~(TUN_IASET|TUN_DSTADDR|TUN_BRDADDR); TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { -#ifdef INET if (ifa->ifa_addr->sa_family == AF_INET) { struct sockaddr_in *sin; @@ -436,7 +433,6 @@ tuninit(struct tun_softc *tp) } else tp->tun_flags &= ~TUN_BRDADDR; } -#endif #ifdef INET6 if (ifa->ifa_addr->sa_family == AF_INET6) { struct sockaddr_in6 *sin; @@ -478,11 +474,9 @@ tun_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) TUNDEBUG(("%s: address set\n", ifp->if_xname)); if (tp->tun_flags & TUN_LAYER2) { switch (ifa->ifa_addr->sa_family) { -#ifdef INET case AF_INET: arp_ifinit(&tp->arpcom, ifa); break; -#endif default: break; } @@ -893,12 +887,10 @@ tunwrite(dev_t dev, struct uio *uio, int ioflag) top->m_pkthdr.ph_rtableid = ifp->if_rdomain; switch (ntohl(*th)) { -#ifdef INET case AF_INET: ifq = &ipintrq; isr = NETISR_IP; break; -#endif #ifdef INET6 case AF_INET6: ifq = &ip6intrq; diff --git a/sys/net/if_vether.c b/sys/net/if_vether.c index 1274e4e5a92..cb9d35d48da 100644 --- a/sys/net/if_vether.c +++ b/sys/net/if_vether.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vether.c,v 1.21 2014/11/23 07:39:02 deraadt Exp $ */ +/* $OpenBSD: if_vether.c,v 1.22 2014/12/19 17:14:40 tedu Exp $ */ /* * Copyright (c) 2009 Theo de Raadt @@ -27,10 +27,8 @@ #include #include -#ifdef INET #include #include -#endif void vetherattach(int); int vetherioctl(struct ifnet *, u_long, caddr_t); @@ -139,19 +137,15 @@ int vetherioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct vether_softc *sc = (struct vether_softc *)ifp->if_softc; -#ifdef INET struct ifaddr *ifa = (struct ifaddr *)data; -#endif struct ifreq *ifr = (struct ifreq *)data; int error = 0, link_state; switch (cmd) { case SIOCSIFADDR: ifp->if_flags |= IFF_UP; -#ifdef INET if (ifa->ifa_addr->sa_family == AF_INET) arp_ifinit(&sc->sc_ac, ifa); -#endif /* FALLTHROUGH */ case SIOCSIFFLAGS: diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index e4188c22b43..5b04560b007 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vlan.c,v 1.110 2014/11/23 07:39:02 deraadt Exp $ */ +/* $OpenBSD: if_vlan.c,v 1.111 2014/12/19 17:14:40 tedu Exp $ */ /* * Copyright 1998 Massachusetts Institute of Technology @@ -67,10 +67,8 @@ #include #include -#ifdef INET #include #include -#endif #include @@ -540,10 +538,8 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) case SIOCSIFADDR: if (ifv->ifv_p != NULL) { ifp->if_flags |= IFF_UP; -#ifdef INET if (ifa->ifa_addr->sa_family == AF_INET) arp_ifinit(&ifv->ifv_ac, ifa); -#endif } else error = EINVAL; break; diff --git a/sys/net/if_vxlan.c b/sys/net/if_vxlan.c index 8489b9a33da..ed312d67db2 100644 --- a/sys/net/if_vxlan.c +++ b/sys/net/if_vxlan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vxlan.c,v 1.19 2014/12/17 09:57:13 mpi Exp $ */ +/* $OpenBSD: if_vxlan.c,v 1.20 2014/12/19 17:14:40 tedu Exp $ */ /* * Copyright (c) 2013 Reyk Floeter @@ -141,9 +141,7 @@ vxlan_clone_create(struct if_clone *ifc, int unit) * at least 1550 bytes. The following is disabled by default. */ ifp->if_mtu = ETHERMTU - sizeof(struct ether_header); -#ifdef INET ifp->if_mtu -= sizeof(struct vxlanudpiphdr); -#endif #endif LIST_INSERT_HEAD(&vxlan_tagh[VXLAN_TAGHASH(0)], sc, sc_entry); @@ -281,9 +279,7 @@ int vxlan_config(struct ifnet *ifp, struct sockaddr *src, struct sockaddr *dst) { struct vxlan_softc *sc = (struct vxlan_softc *)ifp->if_softc; -#ifdef INET struct sockaddr_in *src4, *dst4; -#endif int reset = 0, error; if (src != NULL && dst != NULL) { @@ -297,24 +293,20 @@ vxlan_config(struct ifnet *ifp, struct sockaddr *src, struct sockaddr *dst) reset = 1; } -#ifdef INET src4 = satosin(src); dst4 = satosin(dst); if (src4->sin_len != sizeof(*src4) || dst4->sin_len != sizeof(*dst4)) return (EINVAL); -#endif vxlan_multicast_cleanup(ifp); -#ifdef INET if (IN_MULTICAST(dst4->sin_addr.s_addr)) { if ((error = vxlan_multicast_join(ifp, src4, dst4)) != 0) return (error); } if (dst4->sin_port) sc->sc_dstport = dst4->sin_port; -#endif if (!reset) { bzero(&sc->sc_src, sizeof(sc->sc_src)); @@ -335,9 +327,7 @@ int vxlanioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct vxlan_softc *sc = (struct vxlan_softc *)ifp->if_softc; -#ifdef INET struct ifaddr *ifa = (struct ifaddr *)data; -#endif struct ifreq *ifr = (struct ifreq *)data; struct if_laddrreq *lifr = (struct if_laddrreq *)data; struct proc *p = curproc; @@ -346,10 +336,8 @@ vxlanioctl(struct ifnet *ifp, u_long cmd, caddr_t data) switch (cmd) { case SIOCSIFADDR: ifp->if_flags |= IFF_UP; -#ifdef INET if (ifa->ifa_addr->sa_family == AF_INET) arp_ifinit(&sc->sc_ac, ifa); -#endif /* FALLTHROUGH */ case SIOCSIFFLAGS: @@ -560,18 +548,15 @@ int vxlan_output(struct ifnet *ifp, struct mbuf *m) { struct vxlan_softc *sc = (struct vxlan_softc *)ifp->if_softc; -#ifdef INET struct udpiphdr *ui; struct vxlanudpiphdr *vi; u_int16_t len = m->m_pkthdr.len; struct ip *ip; #if NBRIDGE > 0 struct sockaddr_in *sin; -#endif #endif int error; -#ifdef INET /* VXLAN header */ M_PREPEND(m, sizeof(*vi), M_DONTWAIT); if (m == NULL) { @@ -624,7 +609,6 @@ vxlan_output(struct ifnet *ifp, struct mbuf *m) /* UDP checksum should be 0 */ ui->ui_sum = 0; -#endif ifp->if_opackets++; ifp->if_obytes += m->m_pkthdr.len; @@ -635,12 +619,10 @@ vxlan_output(struct ifnet *ifp, struct mbuf *m) pf_pkt_addr_changed(m); #endif -#ifdef INET if ((error = ip_output(m, NULL, NULL, IP_RAWOUTPUT, &sc->sc_imo, NULL, 0))) { ifp->if_oerrors++; } -#endif return (error); } diff --git a/sys/net/if_vxlan.h b/sys/net/if_vxlan.h index a704816d5ed..f937de21143 100644 --- a/sys/net/if_vxlan.h +++ b/sys/net/if_vxlan.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vxlan.h,v 1.5 2014/04/11 08:44:37 mpi Exp $ */ +/* $OpenBSD: if_vxlan.h,v 1.6 2014/12/19 17:14:40 tedu Exp $ */ /* * Copyright (c) 2013 Reyk Floeter @@ -33,13 +33,11 @@ struct vxlan_header { #define VXLAN_RESERVED2 0x000000ff } __packed; -#ifdef INET struct vxlanudpiphdr { struct ipovly ui_i; struct udphdr ui_u; struct vxlan_header ui_v; } __packed; -#endif #ifdef _KERNEL struct vxlan_softc { diff --git a/sys/net/netisr.c b/sys/net/netisr.c index 7093418194a..27c88a83d90 100644 --- a/sys/net/netisr.c +++ b/sys/net/netisr.c @@ -39,14 +39,12 @@ netintr(void *unused) /* ARGSUSED */ while ((n = netisr) != 0) { atomic_clearbits_int(&netisr, n); -#ifdef INET #if NETHER > 0 if (n & (1 << NETISR_ARP)) arpintr(); #endif if (n & (1 << NETISR_IP)) ipintr(); -#endif #ifdef INET6 if (n & (1 << NETISR_IPV6)) ip6intr(); diff --git a/sys/net/pf.c b/sys/net/pf.c index 886f75abad1..4217404a935 100644 --- a/sys/net/pf.c +++ b/sys/net/pf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf.c,v 1.897 2014/12/11 08:45:44 mpi Exp $ */ +/* $OpenBSD: pf.c,v 1.898 2014/12/19 17:14:40 tedu Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -307,14 +307,12 @@ __inline int pf_addr_compare(struct pf_addr *a, struct pf_addr *b, sa_family_t af) { switch (af) { -#ifdef INET case AF_INET: if (a->addr32[0] > b->addr32[0]) return (1); if (a->addr32[0] < b->addr32[0]) return (-1); break; -#endif /* INET */ #ifdef INET6 case AF_INET6: if (a->addr32[3] > b->addr32[3]) @@ -362,11 +360,9 @@ void pf_addrcpy(struct pf_addr *dst, struct pf_addr *src, sa_family_t af) { switch (af) { -#ifdef INET case AF_INET: dst->addr32[0] = src->addr32[0]; break; -#endif /* INET */ case AF_INET6: dst->addr32[0] = src->addr32[0]; dst->addr32[1] = src->addr32[1]; @@ -450,12 +446,10 @@ pf_src_connlimit(struct pf_state **state) bzero(&p, sizeof(p)); p.pfra_af = (*state)->key[PF_SK_WIRE]->af; switch ((*state)->key[PF_SK_WIRE]->af) { -#ifdef INET case AF_INET: p.pfra_net = 32; p.pfra_ip4addr = sn->addr.v4; break; -#endif /* INET */ #ifdef INET6 case AF_INET6: p.pfra_net = 128; @@ -1411,7 +1405,6 @@ void pf_print_host(struct pf_addr *addr, u_int16_t p, sa_family_t af) { switch (af) { -#ifdef INET case AF_INET: { u_int32_t a = ntohl(addr->addr32[0]); addlog("%u.%u.%u.%u", (a>>24)&255, (a>>16)&255, @@ -1422,7 +1415,6 @@ pf_print_host(struct pf_addr *addr, u_int16_t p, sa_family_t af) } break; } -#endif /* INET */ #ifdef INET6 case AF_INET6: { u_int16_t b; @@ -1710,7 +1702,6 @@ pf_icmp_mapping(struct pf_pdesc *pd, u_int8_t type, int *icmp_dir, int *multi, /* Queries (and responses) */ switch (pd->af) { -#ifdef INET case AF_INET: switch (type) { case ICMP_ECHO: @@ -1786,7 +1777,6 @@ pf_icmp_mapping(struct pf_pdesc *pd, u_int8_t type, int *icmp_dir, int *multi, break; } break; -#endif /* INET */ #ifdef INET6 case AF_INET6: switch (type) { @@ -2325,9 +2315,7 @@ pf_send_tcp(const struct pf_rule *r, sa_family_t af, { struct mbuf *m; int len, tlen; -#ifdef INET struct ip *h; -#endif /* INET */ #ifdef INET6 struct ip6_hdr *h6; #endif /* INET6 */ @@ -2340,11 +2328,9 @@ pf_send_tcp(const struct pf_rule *r, sa_family_t af, tlen += 4; switch (af) { -#ifdef INET case AF_INET: len = sizeof(struct ip) + tlen; break; -#endif /* INET */ #ifdef INET6 case AF_INET6: len = sizeof(struct ip6_hdr) + tlen; @@ -2370,7 +2356,6 @@ pf_send_tcp(const struct pf_rule *r, sa_family_t af, m->m_pkthdr.csum_flags |= M_TCP_CSUM_OUT; bzero(m->m_data, len); switch (af) { -#ifdef INET case AF_INET: h = mtod(m, struct ip *); h->ip_p = IPPROTO_TCP; @@ -2387,7 +2372,6 @@ pf_send_tcp(const struct pf_rule *r, sa_family_t af, th = (struct tcphdr *)((caddr_t)h + sizeof(struct ip)); break; -#endif /* INET */ #ifdef INET6 case AF_INET6: h6 = mtod(m, struct ip6_hdr *); @@ -2421,7 +2405,6 @@ pf_send_tcp(const struct pf_rule *r, sa_family_t af, } switch (af) { -#ifdef INET case AF_INET: if (eh == NULL) { ip_output(m, NULL, NULL, 0, NULL, NULL, 0); @@ -2444,7 +2427,6 @@ pf_send_tcp(const struct pf_rule *r, sa_family_t af, ip_output(m, NULL, &ro, IP_ROUTETOETHER, NULL, NULL, 0); } break; -#endif /* INET */ #ifdef INET6 case AF_INET6: ip6_output(m, NULL, NULL, 0, NULL, NULL, NULL); @@ -2470,11 +2452,9 @@ pf_send_icmp(struct mbuf *m, u_int8_t type, u_int8_t code, sa_family_t af, m0->m_pkthdr.pf.qid = r->qid; switch (af) { -#ifdef INET case AF_INET: icmp_error(m0, type, code, 0, 0); break; -#endif /* INET */ #ifdef INET6 case AF_INET6: icmp6_error(m0, type, code, 0); @@ -2495,13 +2475,11 @@ pf_match_addr(u_int8_t n, struct pf_addr *a, struct pf_addr *m, int match = 0; switch (af) { -#ifdef INET case AF_INET: if ((a->addr32[0] & m->addr32[0]) == (b->addr32[0] & m->addr32[0])) match++; break; -#endif /* INET */ #ifdef INET6 case AF_INET6: if (((a->addr32[0] & m->addr32[0]) == @@ -2537,13 +2515,11 @@ pf_match_addr_range(struct pf_addr *b, struct pf_addr *e, struct pf_addr *a, sa_family_t af) { switch (af) { -#ifdef INET case AF_INET: if ((ntohl(a->addr32[0]) < ntohl(b->addr32[0])) || (ntohl(a->addr32[0]) > ntohl(e->addr32[0]))) return (0); break; -#endif /* INET */ #ifdef INET6 case AF_INET6: { int i; @@ -2737,12 +2713,10 @@ pf_poolmask(struct pf_addr *naddr, struct pf_addr *raddr, struct pf_addr *rmask, struct pf_addr *saddr, sa_family_t af) { switch (af) { -#ifdef INET case AF_INET: naddr->addr32[0] = (raddr->addr32[0] & rmask->addr32[0]) | ((rmask->addr32[0] ^ 0xffffffff ) & saddr->addr32[0]); break; -#endif /* INET */ case AF_INET6: naddr->addr32[0] = (raddr->addr32[0] & rmask->addr32[0]) | ((rmask->addr32[0] ^ 0xffffffff ) & saddr->addr32[0]); @@ -2760,11 +2734,9 @@ void pf_addr_inc(struct pf_addr *addr, sa_family_t af) { switch (af) { -#ifdef INET case AF_INET: addr->addr32[0] = htonl(ntohl(addr->addr32[0]) + 1); break; -#endif /* INET */ case AF_INET6: if (addr->addr32[3] == 0xffffffff) { addr->addr32[3] = 0; @@ -2832,7 +2804,6 @@ pf_socket_lookup(struct pf_pdesc *pd) daddr = pd->src; } switch (pd->af) { -#ifdef INET case AF_INET: /* * Fails when rtable is changed while evaluating the ruleset @@ -2847,7 +2818,6 @@ pf_socket_lookup(struct pf_pdesc *pd) return (-1); } break; -#endif /* INET */ #ifdef INET6 case AF_INET6: inp = in6_pcbhashlookup(tb, &saddr->v6, sport, &daddr->v6, @@ -2950,9 +2920,7 @@ pf_get_mss(struct pf_pdesc *pd) u_int16_t pf_calc_mss(struct pf_addr *addr, sa_family_t af, int rtableid, u_int16_t offer) { -#ifdef INET struct sockaddr_in *dst; -#endif /* INET */ #ifdef INET6 struct sockaddr_in6 *dst6; #endif /* INET6 */ @@ -2964,7 +2932,6 @@ pf_calc_mss(struct pf_addr *addr, sa_family_t af, int rtableid, u_int16_t offer) memset(&ss, 0, sizeof(ss)); switch (af) { -#ifdef INET case AF_INET: hlen = sizeof(struct ip); dst = (struct sockaddr_in *)&ss; @@ -2973,7 +2940,6 @@ pf_calc_mss(struct pf_addr *addr, sa_family_t af, int rtableid, u_int16_t offer) dst->sin_addr = addr->v4; rt = rtalloc(sintosa(dst), RT_REPORT, rtableid); break; -#endif /* INET */ #ifdef INET6 case AF_INET6: hlen = sizeof(struct ip6_hdr); @@ -3007,14 +2973,12 @@ pf_set_rt_ifp(struct pf_state *s, struct pf_addr *saddr) return; bzero(sns, sizeof(sns)); switch (s->key[PF_SK_WIRE]->af) { -#ifdef INET case AF_INET: pf_map_addr(AF_INET, r, saddr, &s->rt_addr, NULL, sns, &r->route, PF_SN_ROUTE); s->rt_kif = r->route.kif; s->natrule.ptr = r; break; -#endif /* INET */ #ifdef INET6 case AF_INET6: pf_map_addr(AF_INET6, r, saddr, &s->rt_addr, NULL, sns, @@ -3048,12 +3012,10 @@ pf_tcp_iss(struct pf_pdesc *pd) SHA512Update(&ctx, &pd->hdr.tcp->th_sport, sizeof(u_short)); SHA512Update(&ctx, &pd->hdr.tcp->th_dport, sizeof(u_short)); switch (pd->af) { -#ifdef INET case AF_INET: SHA512Update(&ctx, &pd->src->v4, sizeof(struct in_addr)); SHA512Update(&ctx, &pd->dst->v4, sizeof(struct in_addr)); break; -#endif /* INET */ #ifdef INET6 case AF_INET6: SHA512Update(&ctx, &pd->src->v6, sizeof(struct in6_addr)); @@ -3140,7 +3102,6 @@ pf_test_rule(struct pf_pdesc *pd, struct pf_rule **rm, struct pf_state **sm, } switch (pd->virtual_proto) { -#ifdef INET case IPPROTO_ICMP: icmptype = pd->hdr.icmp->icmp_type; icmpcode = pd->hdr.icmp->icmp_code; @@ -3154,7 +3115,6 @@ pf_test_rule(struct pf_pdesc *pd, struct pf_rule **rm, struct pf_state **sm, pd->odport = pd->ndport = virtual_id; } break; -#endif /* INET */ #ifdef INET6 case IPPROTO_ICMPV6: icmptype = pd->hdr.icmp6->icmp6_type; @@ -3712,7 +3672,6 @@ pf_translate(struct pf_pdesc *pd, struct pf_addr *saddr, u_int16_t sport, } break; -#ifdef INET case IPPROTO_ICMP: /* pf_translate() is also used when logging invalid packets */ if (pd->af != AF_INET) @@ -3750,7 +3709,6 @@ pf_translate(struct pf_pdesc *pd, struct pf_addr *saddr, u_int16_t sport, } } break; -#endif /* INET */ #ifdef INET6 case IPPROTO_ICMPV6: @@ -3759,13 +3717,11 @@ pf_translate(struct pf_pdesc *pd, struct pf_addr *saddr, u_int16_t sport, return (0); if (afto) { -#ifdef INET /* ip_sum will be recalculated in pf_translate_af */ if (pf_translate_icmp_af(AF_INET, pd->hdr.icmp6)) return (0); pd->proto = IPPROTO_ICMP; rewrite = 1; -#endif /* INET */ } else { if (PF_ANEQ(saddr, pd->src, pd->af)) { pf_change_a6(pd, pd->src, saddr); @@ -3793,7 +3749,6 @@ pf_translate(struct pf_pdesc *pd, struct pf_addr *saddr, u_int16_t sport, default: switch (pd->af) { -#ifdef INET case AF_INET: if (!afto && PF_ANEQ(saddr, pd->src, pd->af)) { pf_change_a(pd, &pd->src->v4.s_addr, @@ -3806,7 +3761,6 @@ pf_translate(struct pf_pdesc *pd, struct pf_addr *saddr, u_int16_t sport, rewrite = 1; } break; -#endif /* INET */ #ifdef INET6 case AF_INET6: if (!afto && PF_ANEQ(saddr, pd->src, pd->af)) { @@ -4518,11 +4472,9 @@ pf_test_state_icmp(struct pf_pdesc *pd, struct pf_state **state, struct pf_state_key_cmp key; switch (pd->proto) { -#ifdef INET case IPPROTO_ICMP: icmptype = pd->hdr.icmp->icmp_type; break; -#endif /* INET */ #ifdef INET6 case IPPROTO_ICMPV6: icmptype = pd->hdr.icmp6->icmp6_type; @@ -4574,7 +4526,6 @@ pf_test_state_icmp(struct pf_pdesc *pd, struct pf_state **state, pd->m->m_pkthdr.ph_rtableid = nk->rdomain; switch (pd->af) { -#ifdef INET case AF_INET: #ifdef INET6 if (afto) { @@ -4608,17 +4559,14 @@ pf_test_state_icmp(struct pf_pdesc *pd, struct pf_state **state, pd->hdr.icmp, M_NOWAIT); copyback = 1; break; -#endif /* INET */ #ifdef INET6 case AF_INET6: -#ifdef INET if (afto) { if (pf_translate_icmp_af(AF_INET, pd->hdr.icmp6)) return (PF_DROP); pd->proto = IPPROTO_ICMP; } -#endif /* INET */ if (!afto && PF_ANEQ(pd->src, &nk->addr[sidx], AF_INET6)) pf_change_a6(pd, saddr, @@ -4662,9 +4610,7 @@ pf_test_state_icmp(struct pf_pdesc *pd, struct pf_state **state, * Extract the inner TCP/UDP header and search for that state. */ struct pf_pdesc pd2; -#ifdef INET struct ip h2; -#endif /* INET */ #ifdef INET6 struct ip6_hdr h2_6; #endif /* INET6 */ @@ -4681,7 +4627,6 @@ pf_test_state_icmp(struct pf_pdesc *pd, struct pf_state **state, pd2.sidx = (pd2.dir == PF_IN) ? 1 : 0; pd2.didx = (pd2.dir == PF_IN) ? 0 : 1; switch (pd->af) { -#ifdef INET case AF_INET: /* offset of h2 in mbuf chain */ ipoff2 = pd->off + ICMP_MINLEN; @@ -4709,7 +4654,6 @@ pf_test_state_icmp(struct pf_pdesc *pd, struct pf_state **state, pd2.src = (struct pf_addr *)&h2.ip_src; pd2.dst = (struct pf_addr *)&h2.ip_dst; break; -#endif /* INET */ #ifdef INET6 case AF_INET6: ipoff2 = pd->off + sizeof(struct icmp6_hdr); @@ -4897,14 +4841,12 @@ pf_test_state_icmp(struct pf_pdesc *pd, struct pf_state **state, if (copyback) { switch (pd2.af) { -#ifdef INET case AF_INET: m_copyback(pd->m, pd->off, ICMP_MINLEN, pd->hdr.icmp, M_NOWAIT); m_copyback(pd2.m, ipoff2, sizeof(h2), &h2, M_NOWAIT); break; -#endif /* INET */ #ifdef INET6 case AF_INET6: m_copyback(pd->m, pd->off, @@ -5012,14 +4954,12 @@ pf_test_state_icmp(struct pf_pdesc *pd, struct pf_state **state, nk->port[pd2.didx], pd2.af); switch (pd2.af) { -#ifdef INET case AF_INET: m_copyback(pd->m, pd->off, ICMP_MINLEN, pd->hdr.icmp, M_NOWAIT); m_copyback(pd2.m, ipoff2, sizeof(h2), &h2, M_NOWAIT); break; -#endif /* INET */ #ifdef INET6 case AF_INET6: m_copyback(pd->m, pd->off, @@ -5037,7 +4977,6 @@ pf_test_state_icmp(struct pf_pdesc *pd, struct pf_state **state, } break; } -#ifdef INET case IPPROTO_ICMP: { struct icmp iih; @@ -5145,7 +5084,6 @@ pf_test_state_icmp(struct pf_pdesc *pd, struct pf_state **state, } break; } -#endif /* INET */ #ifdef INET6 case IPPROTO_ICMPV6: { struct icmp6_hdr iih; @@ -5196,7 +5134,6 @@ pf_test_state_icmp(struct pf_pdesc *pd, struct pf_state **state, didx = afto ? pd2.sidx : pd2.didx; iidx = afto ? !iidx : iidx; -#ifdef INET if (afto) { if (nk->af != AF_INET) return (PF_DROP); @@ -5230,7 +5167,6 @@ pf_test_state_icmp(struct pf_pdesc *pd, struct pf_state **state, pd->naf = nk->af; return (PF_AFRT); } -#endif /* INET */ if (PF_ANEQ(pd2.src, &nk->addr[pd2.sidx], pd2.af) || @@ -5303,14 +5239,12 @@ pf_test_state_icmp(struct pf_pdesc *pd, struct pf_state **state, pd2.af); switch (pd2.af) { -#ifdef INET case AF_INET: m_copyback(pd->m, pd->off, ICMP_MINLEN, pd->hdr.icmp, M_NOWAIT); m_copyback(pd2.m, ipoff2, sizeof(h2), &h2, M_NOWAIT); break; -#endif /* INET */ #ifdef INET6 case AF_INET6: m_copyback(pd->m, pd->off, @@ -5344,7 +5278,6 @@ pf_pull_hdr(struct mbuf *m, int off, void *p, int len, u_short *actionp, u_short *reasonp, sa_family_t af) { switch (af) { -#ifdef INET case AF_INET: { struct ip *h = mtod(m, struct ip *); u_int16_t fragoff = (ntohs(h->ip_off) & IP_OFFMASK) << 3; @@ -5366,7 +5299,6 @@ pf_pull_hdr(struct mbuf *m, int off, void *p, int len, } break; } -#endif /* INET */ #ifdef INET6 case AF_INET6: { struct ip6_hdr *h = mtod(m, struct ip6_hdr *); @@ -5403,7 +5335,6 @@ pf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kif *kif, check_mpath = 0; memset(&ss, 0, sizeof(ss)); switch (af) { -#ifdef INET case AF_INET: dst = (struct sockaddr_in *)&ss; dst->sin_family = AF_INET; @@ -5412,7 +5343,6 @@ pf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kif *kif, if (ipmultipath) check_mpath = 1; break; -#endif /* INET */ #ifdef INET6 case AF_INET6: /* @@ -5481,14 +5411,12 @@ pf_rtlabel_match(struct pf_addr *addr, sa_family_t af, struct pf_addr_wrap *aw, memset(&ss, 0, sizeof(ss)); switch (af) { -#ifdef INET case AF_INET: dst = (struct sockaddr_in *)&ss; dst->sin_family = AF_INET; dst->sin_len = sizeof(*dst); dst->sin_addr = addr->v4; break; -#endif /* INET */ #ifdef INET6 case AF_INET6: dst6 = (struct sockaddr_in6 *)&ss; @@ -5509,7 +5437,6 @@ pf_rtlabel_match(struct pf_addr *addr, sa_family_t af, struct pf_addr_wrap *aw, return (ret); } -#ifdef INET void pf_route(struct mbuf **m, struct pf_rule *r, int dir, struct ifnet *oifp, struct pf_state *s) @@ -5686,7 +5613,6 @@ bad: m_freem(m0); goto done; } -#endif /* INET */ #ifdef INET6 void @@ -5859,7 +5785,6 @@ pf_check_proto_cksum(struct pf_pdesc *pd, int off, int len, u_int8_t p, udpstat.udps_inswcsum++; switch (af) { -#ifdef INET case AF_INET: if (pd->m->m_len < sizeof(struct ip)) { pd->csum_status = PF_CSUM_BAD; @@ -5867,7 +5792,6 @@ pf_check_proto_cksum(struct pf_pdesc *pd, int off, int len, u_int8_t p, } sum = in4_cksum(pd->m, (p == IPPROTO_ICMP ? 0 : p), off, len); break; -#endif /* INET */ #ifdef INET6 case AF_INET6: if (pd->m->m_len < sizeof(struct ip6_hdr)) { @@ -6132,7 +6056,6 @@ pf_setup_pdesc(struct pf_pdesc *pd, void *pdhdrs, sa_family_t af, int dir, pd->rdomain = rtable_l2(pd->m->m_pkthdr.ph_rtableid); switch (pd->af) { -#ifdef INET case AF_INET: { struct ip *h; @@ -6166,7 +6089,6 @@ pf_setup_pdesc(struct pf_pdesc *pd, void *pdhdrs, sa_family_t af, int dir, break; } -#endif /* INET */ #ifdef INET6 case AF_INET6: { struct ip6_hdr *h; @@ -6425,11 +6347,9 @@ pf_test(sa_family_t af, int fwdir, struct ifnet *ifp, struct mbuf **m0, /* packet normalization and reassembly */ switch (pd.af) { -#ifdef INET case AF_INET: action = pf_normalize_ip(&pd, &reason); break; -#endif #ifdef INET6 case AF_INET6: action = pf_normalize_ip6(&pd, &reason); diff --git a/sys/net/pf_if.c b/sys/net/pf_if.c index 0e2d6441269..451380ea03d 100644 --- a/sys/net/pf_if.c +++ b/sys/net/pf_if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf_if.c,v 1.76 2014/12/05 15:50:04 mpi Exp $ */ +/* $OpenBSD: pf_if.c,v 1.77 2014/12/19 17:14:40 tedu Exp $ */ /* * Copyright 2005 Henning Brauer @@ -320,7 +320,6 @@ int pfi_match_addr(struct pfi_dynaddr *dyn, struct pf_addr *a, sa_family_t af) { switch (af) { -#ifdef INET case AF_INET: switch (dyn->pfid_acnt4) { case 0: @@ -332,7 +331,6 @@ pfi_match_addr(struct pfi_dynaddr *dyn, struct pf_addr *a, sa_family_t af) return (pfr_match_addr(dyn->pfid_kt, a, AF_INET)); } break; -#endif /* INET */ #ifdef INET6 case AF_INET6: switch (dyn->pfid_acnt6) { diff --git a/sys/net/pf_ioctl.c b/sys/net/pf_ioctl.c index b84e900a91b..19691a9c8d5 100644 --- a/sys/net/pf_ioctl.c +++ b/sys/net/pf_ioctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf_ioctl.c,v 1.279 2014/12/09 07:05:06 doug Exp $ */ +/* $OpenBSD: pf_ioctl.c,v 1.280 2014/12/19 17:14:40 tedu Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -1081,10 +1081,8 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) switch (rule->af) { case 0: break; -#ifdef INET case AF_INET: break; -#endif /* INET */ #ifdef INET6 case AF_INET6: break; @@ -1257,10 +1255,8 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) switch (newrule->af) { case 0: break; -#ifdef INET case AF_INET: break; -#endif /* INET */ #ifdef INET6 case AF_INET6: break; diff --git a/sys/net/pf_lb.c b/sys/net/pf_lb.c index bd7180c02c0..29cd783667a 100644 --- a/sys/net/pf_lb.c +++ b/sys/net/pf_lb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf_lb.c,v 1.39 2014/12/19 13:04:08 reyk Exp $ */ +/* $OpenBSD: pf_lb.c,v 1.40 2014/12/19 17:14:40 tedu Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -117,13 +117,11 @@ pf_hash(struct pf_addr *inaddr, struct pf_addr *hash, #endif switch (af) { -#ifdef INET case AF_INET: res = SipHash24((SIPHASH_KEY *)key, &inaddr->addr32[0], sizeof(inaddr->addr32[0])); hash->addr32[0] = res; break; -#endif /* INET */ #ifdef INET6 case AF_INET6: res = SipHash24((SIPHASH_KEY *)key, &inaddr->addr32[0], @@ -353,7 +351,6 @@ pf_map_addr(sa_family_t af, struct pf_rule *r, struct pf_addr *saddr, return (1); if (rpool->addr.type == PF_ADDR_DYNIFTL) { switch (af) { -#ifdef INET case AF_INET: if (rpool->addr.p.dyn->pfid_acnt4 < 1 && !PF_POOL_DYNTYPE(rpool->opts)) @@ -361,7 +358,6 @@ pf_map_addr(sa_family_t af, struct pf_rule *r, struct pf_addr *saddr, raddr = &rpool->addr.p.dyn->pfid_addr4; rmask = &rpool->addr.p.dyn->pfid_mask4; break; -#endif /* INET */ #ifdef INET6 case AF_INET6: if (rpool->addr.p.dyn->pfid_acnt6 < 1 && @@ -404,11 +400,9 @@ pf_map_addr(sa_family_t af, struct pf_rule *r, struct pf_addr *saddr, PF_ACPY(naddr, &rpool->counter, af); } else if (init_addr != NULL && PF_AZERO(init_addr, af)) { switch (af) { -#ifdef INET case AF_INET: rpool->counter.addr32[0] = htonl(arc4random()); break; -#endif /* INET */ #ifdef INET6 case AF_INET6: if (rmask->addr32[3] != 0xffffffff) diff --git a/sys/net/pf_norm.c b/sys/net/pf_norm.c index 2ec32c0700e..0f97a746453 100644 --- a/sys/net/pf_norm.c +++ b/sys/net/pf_norm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf_norm.c,v 1.171 2014/12/05 15:50:04 mpi Exp $ */ +/* $OpenBSD: pf_norm.c,v 1.172 2014/12/19 17:14:40 tedu Exp $ */ /* * Copyright 2001 Niels Provos @@ -905,13 +905,11 @@ pf_normalize_tcp_init(struct pf_pdesc *pd, struct pf_state_peer *src, bzero(src->scrub, sizeof(*src->scrub)); switch (pd->af) { -#ifdef INET case AF_INET: { struct ip *h = mtod(pd->m, struct ip *); src->scrub->pfss_ttl = h->ip_ttl; break; } -#endif /* INET */ #ifdef INET6 case AF_INET6: { struct ip6_hdr *h = mtod(pd->m, struct ip6_hdr *); @@ -1006,7 +1004,6 @@ pf_normalize_tcp_stateful(struct pf_pdesc *pd, u_short *reason, * firewall state code. */ switch (pd->af) { -#ifdef INET case AF_INET: { if (src->scrub) { struct ip *h = mtod(pd->m, struct ip *); @@ -1016,7 +1013,6 @@ pf_normalize_tcp_stateful(struct pf_pdesc *pd, u_short *reason, } break; } -#endif /* INET */ #ifdef INET6 case AF_INET6: { if (src->scrub) { diff --git a/sys/net/pf_table.c b/sys/net/pf_table.c index cf7a56442e4..9ee25780988 100644 --- a/sys/net/pf_table.c +++ b/sys/net/pf_table.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf_table.c,v 1.103 2014/09/08 06:24:13 jsg Exp $ */ +/* $OpenBSD: pf_table.c,v 1.104 2014/12/19 17:14:40 tedu Exp $ */ /* * Copyright (c) 2002 Cedric Berger @@ -720,12 +720,10 @@ pfr_validate_addr(struct pfr_addr *ad) int i; switch (ad->pfra_af) { -#ifdef INET case AF_INET: if (ad->pfra_net > 32) return (-1); break; -#endif /* INET */ #ifdef INET6 case AF_INET6: if (ad->pfra_net > 128) @@ -2055,14 +2053,12 @@ pfr_match_addr(struct pfr_ktable *kt, struct pf_addr *a, sa_family_t af) return (0); switch (af) { -#ifdef INET case AF_INET: pfr_sin.sin_addr.s_addr = a->addr32[0]; ke = (struct pfr_kentry *)rn_match(&pfr_sin, kt->pfrkt_ip4); if (ke && KENTRY_RNF_ROOT(ke)) ke = NULL; break; -#endif /* INET */ #ifdef INET6 case AF_INET6: bcopy(a, &pfr_sin6.sin6_addr, sizeof(pfr_sin6.sin6_addr)); @@ -2096,14 +2092,12 @@ pfr_update_stats(struct pfr_ktable *kt, struct pf_addr *a, struct pf_pdesc *pd, return; switch (af) { -#ifdef INET case AF_INET: pfr_sin.sin_addr.s_addr = a->addr32[0]; ke = (struct pfr_kentry *)rn_match(&pfr_sin, kt->pfrkt_ip4); if (ke && KENTRY_RNF_ROOT(ke)) ke = NULL; break; -#endif /* INET */ #ifdef INET6 case AF_INET6: bcopy(a, &pfr_sin6.sin6_addr, sizeof(pfr_sin6.sin6_addr)); @@ -2363,11 +2357,9 @@ pfr_kentry_byidx(struct pfr_ktable *kt, int idx, int af) w.pfrw_cnt = idx; switch (af) { -#ifdef INET case AF_INET: rn_walktree(kt->pfrkt_ip4, pfr_walktree, &w); return (w.pfrw_kentry); -#endif /* INET */ #ifdef INET6 case AF_INET6: rn_walktree(kt->pfrkt_ip6, pfr_walktree, &w); @@ -2437,12 +2429,10 @@ pfr_kentry_byaddr(struct pfr_ktable *kt, struct pf_addr *addr, sa_family_t af, bzero(&p, sizeof(p)); p.pfra_af = af; switch (af) { -#ifdef INET case AF_INET: p.pfra_net = 32; p.pfra_ip4addr = addr->v4; break; -#endif /* INET */ #ifdef INET6 case AF_INET6: p.pfra_net = 128; diff --git a/sys/net/pfkeyv2.c b/sys/net/pfkeyv2.c index ae5f4db1f5c..0af998fcf4d 100644 --- a/sys/net/pfkeyv2.c +++ b/sys/net/pfkeyv2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfkeyv2.c,v 1.137 2014/11/25 13:10:03 mpi Exp $ */ +/* $OpenBSD: pfkeyv2.c,v 1.138 2014/12/19 17:14:40 tedu Exp $ */ /* * @(#)COPYRIGHT 1.1 (NRL) 17 January 1995 @@ -369,14 +369,12 @@ pfkeyv2_policy(struct ipsec_acquire *ipa, void **headers, void **buffer) bzero(&sunion, sizeof(union sockaddr_union)); switch (ipa->ipa_info.sen_type) { -#ifdef INET case SENT_IP4: i += 4 * PADUP(sizeof(struct sockaddr_in)); sunion.sa.sa_family = AF_INET; sunion.sa.sa_len = sizeof(struct sockaddr_in); dir = ipa->ipa_info.sen_direction; break; -#endif /* INET */ #ifdef INET6 case SENT_IP6: @@ -402,12 +400,10 @@ pfkeyv2_policy(struct ipsec_acquire *ipa, void **headers, void **buffer) else headers[SADB_X_EXT_DST_FLOW] = p; switch (sunion.sa.sa_family) { -#ifdef INET case AF_INET: sunion.sin.sin_addr = ipa->ipa_info.sen_ip_src; sunion.sin.sin_port = ipa->ipa_info.sen_sport; break; -#endif /* INET */ #ifdef INET6 case AF_INET6: @@ -423,12 +419,10 @@ pfkeyv2_policy(struct ipsec_acquire *ipa, void **headers, void **buffer) else headers[SADB_X_EXT_DST_MASK] = p; switch (sunion.sa.sa_family) { -#ifdef INET case AF_INET: sunion.sin.sin_addr = ipa->ipa_mask.sen_ip_src; sunion.sin.sin_port = ipa->ipa_mask.sen_sport; break; -#endif /* INET */ #ifdef INET6 case AF_INET6: @@ -444,12 +438,10 @@ pfkeyv2_policy(struct ipsec_acquire *ipa, void **headers, void **buffer) else headers[SADB_X_EXT_SRC_FLOW] = p; switch (sunion.sa.sa_family) { -#ifdef INET case AF_INET: sunion.sin.sin_addr = ipa->ipa_info.sen_ip_dst; sunion.sin.sin_port = ipa->ipa_info.sen_dport; break; -#endif /* INET */ #ifdef INET6 case AF_INET6: @@ -465,12 +457,10 @@ pfkeyv2_policy(struct ipsec_acquire *ipa, void **headers, void **buffer) else headers[SADB_X_EXT_SRC_MASK] = p; switch (sunion.sa.sa_family) { -#ifdef INET case AF_INET: sunion.sin.sin_addr = ipa->ipa_mask.sen_ip_dst; sunion.sin.sin_port = ipa->ipa_mask.sen_dport; break; -#endif /* INET */ #ifdef INET6 case AF_INET6: @@ -486,13 +476,11 @@ pfkeyv2_policy(struct ipsec_acquire *ipa, void **headers, void **buffer) sp->sadb_protocol_len = sizeof(struct sadb_protocol) / sizeof(u_int64_t); switch (sunion.sa.sa_family) { -#ifdef INET case AF_INET: if (ipa->ipa_mask.sen_proto) sp->sadb_protocol_proto = ipa->ipa_info.sen_proto; sp->sadb_protocol_direction = ipa->ipa_info.sen_direction; break; -#endif /* INET */ #ifdef INET6 case AF_INET6: @@ -567,12 +555,10 @@ pfkeyv2_get(struct tdb *sa, void **headers, void **buffer, int *lenp) /* We'll need four of them: src, src mask, dst, dst mask. */ switch (sa->tdb_filter.sen_type) { -#ifdef INET case SENT_IP4: i += 4 * PADUP(sizeof(struct sockaddr_in)); i += 4 * sizeof(struct sadb_address); break; -#endif /* INET */ #ifdef INET6 case SENT_IP6: i += 4 * PADUP(sizeof(struct sockaddr_in6)); @@ -2314,12 +2300,10 @@ pfkeyv2_dump_policy(struct ipsec_policy *ipo, void **headers, void **buffer, /* We'll need four of them: src, src mask, dst, dst mask. */ switch (ipo->ipo_addr.sen_type) { -#ifdef INET case SENT_IP4: i += 4 * PADUP(sizeof(struct sockaddr_in)); i += 4 * sizeof(struct sadb_address); break; -#endif /* INET */ #ifdef INET6 case SENT_IP6: i += 4 * PADUP(sizeof(struct sockaddr_in6)); @@ -2334,12 +2318,10 @@ pfkeyv2_dump_policy(struct ipsec_policy *ipo, void **headers, void **buffer, switch (ipo->ipo_src.sa.sa_family) { case 0: break; -#ifdef INET case AF_INET: i += PADUP(sizeof(struct sockaddr_in)); i += sizeof(struct sadb_address); break; -#endif /* INET */ #ifdef INET6 case AF_INET6: i += PADUP(sizeof(struct sockaddr_in6)); @@ -2354,12 +2336,10 @@ pfkeyv2_dump_policy(struct ipsec_policy *ipo, void **headers, void **buffer, switch (ipo->ipo_dst.sa.sa_family) { case 0: break; -#ifdef INET case AF_INET: i += PADUP(sizeof(struct sockaddr_in)); i += sizeof(struct sadb_address); break; -#endif /* INET */ #ifdef INET6 case AF_INET6: i += PADUP(sizeof(struct sockaddr_in6)); diff --git a/sys/net/pfkeyv2_convert.c b/sys/net/pfkeyv2_convert.c index 6b20cfcb8f5..b6e4c65a5df 100644 --- a/sys/net/pfkeyv2_convert.c +++ b/sys/net/pfkeyv2_convert.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfkeyv2_convert.c,v 1.43 2014/07/12 18:44:22 tedu Exp $ */ +/* $OpenBSD: pfkeyv2_convert.c,v 1.44 2014/12/19 17:14:40 tedu Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@keromytis.org) * @@ -475,7 +475,6 @@ import_flow(struct sockaddr_encap *flow, struct sockaddr_encap *flowmask, switch (src->sa.sa_family) { -#ifdef INET case AF_INET: /* netmask handling */ rt_maskedcopy(&src->sa, &src->sa, &srcmask->sa); @@ -498,7 +497,6 @@ import_flow(struct sockaddr_encap *flow, struct sockaddr_encap *flowmask, if (transproto) flowmask->sen_proto = 0xff; break; -#endif /* INET */ #ifdef INET6 case AF_INET6: @@ -617,11 +615,9 @@ export_flow(void **p, u_int8_t ftype, struct sockaddr_encap *flow, } switch (flow->sen_type) { -#ifdef INET case SENT_IP4: sab->sadb_protocol_direction = flow->sen_direction; break; -#endif /* INET */ #ifdef INET6 case SENT_IP6: sab->sadb_protocol_direction = flow->sen_ip6_direction; @@ -635,11 +631,9 @@ export_flow(void **p, u_int8_t ftype, struct sockaddr_encap *flow, sab->sadb_protocol_len = sizeof(struct sadb_protocol) / sizeof(uint64_t); switch (flow->sen_type) { -#ifdef INET case SENT_IP4: sab->sadb_protocol_proto = flow->sen_proto; break; -#endif /* INET */ #ifdef INET6 case SENT_IP6: sab->sadb_protocol_proto = flow->sen_ip6_proto; @@ -678,11 +672,9 @@ import_address(struct sockaddr *sa, struct sadb_address *sadb_address) salen = ssa->sa_len; else switch (ssa->sa_family) { -#ifdef INET case AF_INET: salen = sizeof(struct sockaddr_in); break; -#endif /* INET */ #ifdef INET6 case AF_INET6: diff --git a/sys/net/pipex.c b/sys/net/pipex.c index 2021eebbf93..c1de0ef540e 100644 --- a/sys/net/pipex.c +++ b/sys/net/pipex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pipex.c,v 1.64 2014/12/01 06:55:05 yasuoka Exp $ */ +/* $OpenBSD: pipex.c,v 1.65 2014/12/19 17:14:40 tedu Exp $ */ /*- * Copyright (c) 2009 Internet Initiative Japan Inc. @@ -62,7 +62,6 @@ #include #endif -#ifdef INET #include #include #ifdef INET6 @@ -72,7 +71,6 @@ #include #include #include -#endif #include /* drop static for ddb debuggability */ diff --git a/sys/net/radix_mpath.c b/sys/net/radix_mpath.c index 50c7af2bd77..b5f14ba3b32 100644 --- a/sys/net/radix_mpath.c +++ b/sys/net/radix_mpath.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radix_mpath.c,v 1.26 2014/11/18 02:37:31 tedu Exp $ */ +/* $OpenBSD: radix_mpath.c,v 1.27 2014/12/19 17:14:40 tedu Exp $ */ /* $KAME: radix_mpath.c,v 1.13 2002/10/28 21:05:59 itojun Exp $ */ /* @@ -386,10 +386,8 @@ struct rtentry * rtalloc_mpath(struct sockaddr *dst, u_int32_t *srcaddrp, u_int rtableid) { struct rtentry *rt; -#if defined(INET) || defined(INET6) struct radix_node *rn; int hash, npaths, threshold; -#endif rt = rtalloc(dst, RT_REPORT|RT_RESOLVE, rtableid); @@ -399,16 +397,13 @@ rtalloc_mpath(struct sockaddr *dst, u_int32_t *srcaddrp, u_int rtableid) /* check if multipath routing is enabled for the specified protocol */ if (!(0 -#ifdef INET || (ipmultipath && dst->sa_family == AF_INET) -#endif #ifdef INET6 || (ip6_multipath && dst->sa_family == AF_INET6) #endif )) return (rt); -#if defined(INET) || defined(INET6) /* gw selection by Hash-Threshold (RFC 2992) */ rn = (struct radix_node *)rt; npaths = rn_mpath_active_count(rn); @@ -426,7 +421,6 @@ rtalloc_mpath(struct sockaddr *dst, u_int32_t *srcaddrp, u_int rtableid) rt = (struct rtentry *)rn; rt->rt_refcnt++; } -#endif return (rt); } @@ -471,7 +465,6 @@ rn_mpath_hash(struct sockaddr *dst, u_int32_t *srcaddrp) c = hashjitter; switch (dst->sa_family) { -#ifdef INET case AF_INET: { struct sockaddr_in *sin_dst; @@ -482,7 +475,6 @@ rn_mpath_hash(struct sockaddr *dst, u_int32_t *srcaddrp) mix(a, b, c); break; } -#endif /* INET */ #ifdef INET6 case AF_INET6: { diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index 8834b70ffc2..d49a55cc537 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ether.c,v 1.138 2014/12/05 15:50:04 mpi Exp $ */ +/* $OpenBSD: if_ether.c,v 1.139 2014/12/19 17:14:40 tedu Exp $ */ /* $NetBSD: if_ether.c,v 1.31 1996/05/11 12:59:58 mycroft Exp $ */ /* @@ -38,7 +38,6 @@ * add "inuse/lock" bit (or ref. count) along with valid bit */ -#ifdef INET #include "carp.h" #include "bridge.h" @@ -1149,4 +1148,3 @@ db_show_arptab(void) return (0); } #endif -#endif /* INET */ diff --git a/sys/netinet/in.c b/sys/netinet/in.c index ac707dc4ed5..0e3bb357182 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in.c,v 1.112 2014/11/25 15:35:10 mpi Exp $ */ +/* $OpenBSD: in.c,v 1.113 2014/12/19 17:14:40 tedu Exp $ */ /* $NetBSD: in.c,v 1.26 1996/02/13 23:41:39 christos Exp $ */ /* @@ -86,7 +86,6 @@ #include "ether.h" -#ifdef INET void in_socktrim(struct sockaddr_in *); void in_len2mask(struct in_addr *, int); @@ -1004,7 +1003,6 @@ in_delmulti(struct in_multi *inm) } } -#endif void in_ifdetach(struct ifnet *ifp) diff --git a/sys/netinet/ip_ah.c b/sys/netinet/ip_ah.c index 35b0ead560e..58f2e23d4d1 100644 --- a/sys/netinet/ip_ah.c +++ b/sys/netinet/ip_ah.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ah.c,v 1.112 2014/12/05 15:50:04 mpi Exp $ */ +/* $OpenBSD: ip_ah.c,v 1.113 2014/12/19 17:14:40 tedu Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -47,16 +47,11 @@ #include #include -#ifdef INET #include #include #include -#endif /* INET */ #ifdef INET6 -#ifndef INET -#include -#endif /* INET */ #include #endif /* INET6 */ @@ -210,9 +205,7 @@ ah_massage_headers(struct mbuf **m0, int proto, int skip, int alg, int out) unsigned char *ptr; int off, count; -#ifdef INET struct ip *ip; -#endif /* INET */ #ifdef INET6 struct ip6_ext *ip6e; @@ -221,7 +214,6 @@ ah_massage_headers(struct mbuf **m0, int proto, int skip, int alg, int out) #endif /* INET6 */ switch (proto) { -#ifdef INET case AF_INET: /* * This is the least painful way of dealing with IPv4 header @@ -353,7 +345,6 @@ ah_massage_headers(struct mbuf **m0, int proto, int skip, int alg, int out) } break; -#endif /* INET */ #ifdef INET6 case AF_INET6: /* Ugly... */ @@ -1038,7 +1029,6 @@ ah_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip, rplen = AH_FLENGTH + sizeof(u_int32_t); switch (tdb->tdb_dst.sa.sa_family) { -#ifdef INET case AF_INET: /* Check for IP maximum packet size violations. */ if (rplen + ahx->authsize + m->m_pkthdr.len > IP_MAXPACKET) { @@ -1050,7 +1040,6 @@ ah_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip, return EMSGSIZE; } break; -#endif /* INET */ #ifdef INET6 case AF_INET6: @@ -1209,7 +1198,6 @@ ah_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip, * header length as it will be fixed by our caller. */ switch (tdb->tdb_dst.sa.sa_family) { -#ifdef INET case AF_INET: bcopy(((caddr_t)(tc + 1)) + offsetof(struct ip, ip_len), @@ -1218,7 +1206,6 @@ ah_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip, m_copyback(m, offsetof(struct ip, ip_len), sizeof(u_int16_t), &iplen, M_NOWAIT); break; -#endif /* INET */ #ifdef INET6 case AF_INET6: diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c index 12421a403a1..92d822270ca 100644 --- a/sys/netinet/ip_carp.c +++ b/sys/netinet/ip_carp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_carp.c,v 1.242 2014/12/17 09:57:13 mpi Exp $ */ +/* $OpenBSD: ip_carp.c,v 1.243 2014/12/19 17:14:40 tedu Exp $ */ /* * Copyright (c) 2002 Michael Shalayeff. All rights reserved. @@ -56,7 +56,6 @@ #include -#ifdef INET #include #include #include @@ -66,7 +65,6 @@ #include #include -#endif #ifdef INET6 #include @@ -306,7 +304,6 @@ carp_hmac_prepare_ctx(struct carp_vhost_entry *vhe, u_int8_t ctx) SHA1Update(&vhe->vhe_sha1[ctx], (void *)&vhid, sizeof(vhid)); /* Hash the addresses from smallest to largest, not interface order */ -#ifdef INET cur.s_addr = 0; do { found = 0; @@ -326,7 +323,6 @@ carp_hmac_prepare_ctx(struct carp_vhost_entry *vhe, u_int8_t ctx) SHA1Update(&vhe->vhe_sha1[ctx], (void *)&cur, sizeof(cur)); } while (found); -#endif /* INET */ #ifdef INET6 memset(&cur6, 0x00, sizeof(cur6)); do { @@ -1000,7 +996,6 @@ carp_send_ad(void *v) sc->cur_vhe = vhe; /* we need the vhe later on the output path */ -#ifdef INET if (sc->sc_naddrs) { struct ip *ip; @@ -1090,7 +1085,6 @@ carp_send_ad(void *v) } } } -#endif /* INET */ #ifdef INET6 if (sc->sc_naddrs6) { struct ip6_hdr *ip6; @@ -1597,11 +1591,9 @@ carp_setrun(struct carp_vhost_entry *vhe, sa_family_t af) if (vhe->vhe_leader) sc->sc_delayed_arp = -1; switch (af) { -#ifdef INET case AF_INET: timeout_add(&vhe->md_tmo, tvtohz(&tv)); break; -#endif /* INET */ #ifdef INET6 case AF_INET6: timeout_add(&vhe->md6_tmo, tvtohz(&tv)); @@ -2068,7 +2060,6 @@ carp_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr) case SIOCSIFADDR: s = splnet(); switch (ifa->ifa_addr->sa_family) { -#ifdef INET case AF_INET: sc->sc_if.if_flags |= IFF_UP; /* @@ -2079,7 +2070,6 @@ carp_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr) error = carp_set_addr(sc, satosin(ifa->ifa_addr)); break; -#endif /* INET */ #ifdef INET6 case AF_INET6: sc->sc_if.if_flags |= IFF_UP; diff --git a/sys/netinet/ip_ecn.c b/sys/netinet/ip_ecn.c index aed51e08e84..b26c73e447f 100644 --- a/sys/netinet/ip_ecn.c +++ b/sys/netinet/ip_ecn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ecn.c,v 1.6 2014/07/22 11:06:10 mpi Exp $ */ +/* $OpenBSD: ip_ecn.c,v 1.7 2014/12/19 17:14:40 tedu Exp $ */ /* $KAME: ip_ecn.c,v 1.9 2000/10/01 12:44:48 itojun Exp $ */ /* @@ -39,15 +39,10 @@ #include #include -#ifdef INET #include #include -#endif #ifdef INET6 -#ifndef INET -#include -#endif #include #endif diff --git a/sys/netinet/ip_esp.c b/sys/netinet/ip_esp.c index b26f2d4b4c2..69a23037d6a 100644 --- a/sys/netinet/ip_esp.c +++ b/sys/netinet/ip_esp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_esp.c,v 1.128 2014/12/05 15:50:04 mpi Exp $ */ +/* $OpenBSD: ip_esp.c,v 1.129 2014/12/19 17:14:40 tedu Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -46,16 +46,11 @@ #include #include -#ifdef INET #include #include #include -#endif /* INET */ #ifdef INET6 -#ifndef INET -#include -#endif #include #endif /* INET6 */ @@ -820,7 +815,6 @@ esp_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip, espstat.esps_output++; switch (tdb->tdb_dst.sa.sa_family) { -#ifdef INET case AF_INET: /* Check for IP maximum packet size violations. */ if (skip + hlen + rlen + padding + alen > IP_MAXPACKET) { @@ -832,7 +826,6 @@ esp_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip, return EMSGSIZE; } break; -#endif /* INET */ #ifdef INET6 case AF_INET6: diff --git a/sys/netinet/ip_ether.c b/sys/netinet/ip_ether.c index 3b5d19b36ce..9c7def0c6a9 100644 --- a/sys/netinet/ip_ether.c +++ b/sys/netinet/ip_ether.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ether.c,v 1.69 2014/09/14 14:17:26 jsg Exp $ */ +/* $OpenBSD: ip_ether.c,v 1.70 2014/12/19 17:14:40 tedu Exp $ */ /* * The author of this code is Angelos D. Keromytis (kermit@adk.gr) * @@ -40,12 +40,10 @@ #include #include -#ifdef INET #include #include #include #include -#endif /* INET */ #include #include @@ -86,7 +84,6 @@ int etherip_allow = 0; struct etheripstat etheripstat; -#ifdef INET /* * etherip_input gets called when we receive an encapsulated packet. * Only a wrapper for the IPv4 case. @@ -129,7 +126,6 @@ etherip_input(struct mbuf *m, ...) return; } } -#endif #ifdef INET6 int @@ -366,7 +362,6 @@ etherip_getgif(struct mbuf *m) 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; @@ -377,7 +372,6 @@ etherip_getgif(struct mbuf *m) 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); @@ -423,9 +417,7 @@ etherip_getgif(struct mbuf *m) int etherip_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int proto) { -#ifdef INET struct ip *ipo; -#endif /* INET */ #ifdef INET6 struct ip6_hdr *ip6; #endif /* INET6 */ @@ -462,11 +454,9 @@ etherip_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int proto) } switch (tdb->tdb_dst.sa.sa_family) { -#ifdef INET case AF_INET: hlen = sizeof(struct ip); break; -#endif /* INET */ #ifdef INET6 case AF_INET6: hlen = sizeof(struct ip6_hdr); @@ -508,7 +498,6 @@ etherip_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int proto) 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 *); @@ -530,7 +519,6 @@ etherip_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int proto) 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 *); diff --git a/sys/netinet/ip_gre.c b/sys/netinet/ip_gre.c index 282091d4c80..6d713b6d388 100644 --- a/sys/netinet/ip_gre.c +++ b/sys/netinet/ip_gre.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_gre.c,v 1.51 2014/09/14 14:17:26 jsg Exp $ */ +/* $OpenBSD: ip_gre.c,v 1.52 2014/12/19 17:14:40 tedu Exp $ */ /* $NetBSD: ip_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */ /* @@ -52,16 +52,12 @@ #include #include -#ifdef INET #include #include #include #include #include #include -#else -#error "ip_gre used without inet" -#endif #ifdef MPLS #include diff --git a/sys/netinet/ip_ipcomp.c b/sys/netinet/ip_ipcomp.c index 0ba657ad093..2aa111d506b 100644 --- a/sys/netinet/ip_ipcomp.c +++ b/sys/netinet/ip_ipcomp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ipcomp.c,v 1.38 2014/12/05 15:50:04 mpi Exp $ */ +/* $OpenBSD: ip_ipcomp.c,v 1.39 2014/12/19 17:14:40 tedu Exp $ */ /* * Copyright (c) 2001 Jean-Jacques Bernard-Gundol (jj@wabbitt.org) @@ -38,16 +38,11 @@ #include #include -#ifdef INET #include #include #include -#endif /* INET */ #ifdef INET6 -#ifndef INET -#include -#endif #include #endif /* INET6 */ @@ -409,7 +404,6 @@ ipcomp_output(m, tdb, mp, skip, protoff) ipcompstat.ipcomps_output++; switch (tdb->tdb_dst.sa.sa_family) { -#ifdef INET case AF_INET: /* Check for IPv4 maximum packet size violations */ /* @@ -424,7 +418,6 @@ ipcomp_output(m, tdb, mp, skip, protoff) return EMSGSIZE; } break; -#endif /* INET */ #ifdef INET6 case AF_INET6: @@ -556,9 +549,7 @@ ipcomp_output_cb(cp) struct mbuf *m, *mo; int error, s, skip, rlen; u_int16_t cpi; -#ifdef INET struct ip *ip; -#endif #ifdef INET6 struct ip6_hdr *ip6; #endif @@ -636,13 +627,11 @@ ipcomp_output_cb(cp) /* m_pullup before ? */ switch (tdb->tdb_dst.sa.sa_family) { -#ifdef INET case AF_INET: ip = mtod(m, struct ip *); ipcomp->ipcomp_nh = ip->ip_p; ip->ip_p = IPPROTO_IPCOMP; break; -#endif /* INET */ #ifdef INET6 case AF_INET6: ip6 = mtod(m, struct ip6_hdr *); diff --git a/sys/netinet/ip_ipip.c b/sys/netinet/ip_ipip.c index c138e7cb49d..d427512beb5 100644 --- a/sys/netinet/ip_ipip.c +++ b/sys/netinet/ip_ipip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ipip.c,v 1.55 2014/12/05 15:50:04 mpi Exp $ */ +/* $OpenBSD: ip_ipip.c,v 1.56 2014/12/19 17:14:40 tedu Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -106,7 +106,6 @@ ip4_input6(struct mbuf **m, int *offp, int proto) } #endif /* INET6 */ -#ifdef INET /* * Really only a wrapper for ipip_input(), for use with IPv4. */ @@ -133,7 +132,6 @@ ip4_input(struct mbuf *m, ...) ipip_input(m, iphlen, NULL, ip->ip_p); } -#endif /* INET */ /* * ipip_input gets called when we receive an IP{46} encapsulated packet, @@ -166,11 +164,9 @@ ipip_input(struct mbuf *m, int iphlen, struct ifnet *gifp, int proto) m_copydata(m, 0, 1, &v); switch (v >> 4) { -#ifdef INET case 4: hlen = sizeof(struct ip); break; -#endif /* INET */ #ifdef INET6 case 6: hlen = sizeof(struct ip6_hdr); @@ -194,12 +190,10 @@ ipip_input(struct mbuf *m, int iphlen, struct ifnet *gifp, int proto) /* Keep outer ecn field. */ switch (v >> 4) { -#ifdef INET case 4: ipo = mtod(m, struct ip *); otos = ipo->ip_tos; break; -#endif /* INET */ #ifdef INET6 case 6: ip6 = mtod(m, struct ip6_hdr *); @@ -221,11 +215,9 @@ ipip_input(struct mbuf *m, int iphlen, struct ifnet *gifp, int proto) } switch (proto) { -#ifdef INET case IPPROTO_IPV4: hlen = sizeof(struct ip); break; -#endif /* INET */ #ifdef INET6 case IPPROTO_IPV6: @@ -257,7 +249,6 @@ ipip_input(struct mbuf *m, int iphlen, struct ifnet *gifp, int proto) /* Some sanity checks in the inner IP header */ switch (proto) { -#ifdef INET case IPPROTO_IPV4: ipo = mtod(m, struct ip *); #ifdef INET6 @@ -281,12 +272,9 @@ ipip_input(struct mbuf *m, int iphlen, struct ifnet *gifp, int proto) } } break; -#endif /* INET */ #ifdef INET6 case IPPROTO_IPV6: -#ifdef INET ipo = NULL; -#endif ip6 = mtod(m, struct ip6_hdr *); itos = (ntohl(ip6->ip6_flow) >> 20) & 0xff; if (!ip_ecn_egress(ECN_ALLOWED, &otos, &itos)) { @@ -300,9 +288,7 @@ ipip_input(struct mbuf *m, int iphlen, struct ifnet *gifp, int proto) break; #endif default: -#ifdef INET ipo = NULL; -#endif #ifdef INET6 ip6 = NULL; #endif @@ -317,7 +303,6 @@ ipip_input(struct mbuf *m, int iphlen, struct ifnet *gifp, int proto) if (ifp->if_rdomain != rdomain) continue; TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { -#ifdef INET if (ipo) { if (ifa->ifa_addr->sa_family != AF_INET) @@ -332,7 +317,6 @@ ipip_input(struct mbuf *m, int iphlen, struct ifnet *gifp, int proto) return; } } -#endif /* INET */ #ifdef INET6 if (ip6) { if (ifa->ifa_addr->sa_family != @@ -366,13 +350,11 @@ ipip_input(struct mbuf *m, int iphlen, struct ifnet *gifp, int proto) */ switch (proto) { -#ifdef INET case IPPROTO_IPV4: ifq = &ipintrq; isr = NETISR_IP; af = AF_INET; break; -#endif #ifdef INET6 case IPPROTO_IPV6: ifq = &ip6intrq; @@ -417,10 +399,8 @@ ipip_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int dummy, { u_int8_t tp, otos; -#ifdef INET u_int8_t itos; struct ip *ipo; -#endif /* INET */ #ifdef INET6 struct ip6_hdr *ip6, *ip6o; @@ -432,7 +412,6 @@ ipip_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int dummy, tp = (tp >> 4) & 0xff; /* Get the IP version number. */ switch (tdb->tdb_dst.sa.sa_family) { -#ifdef INET case AF_INET: if (tdb->tdb_src.sa.sa_family != AF_INET || tdb->tdb_src.sin.sin_addr.s_addr == INADDR_ANY || @@ -516,7 +495,6 @@ ipip_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int dummy, ip_ecn_ingress(ECN_ALLOWED, &otos, &itos); ipo->ip_tos = otos; break; -#endif /* INET */ #ifdef INET6 case AF_INET6: @@ -562,7 +540,6 @@ ipip_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int dummy, in6_embedscope(&ip6o->ip6_src, &tdb->tdb_src.sin6, NULL, NULL); in6_embedscope(&ip6o->ip6_dst, &tdb->tdb_dst.sin6, NULL, NULL); -#ifdef INET if (tp == IPVERSION) { /* Save ECN notification */ m_copydata(m, sizeof(struct ip6_hdr) + @@ -573,7 +550,6 @@ ipip_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int dummy, ip6o->ip6_nxt = IPPROTO_IPIP; } else -#endif /* INET */ if (tp == (IPV6_VERSION >> 4)) { u_int32_t itos32; @@ -609,7 +585,6 @@ ipip_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int dummy, ipipstat.ipips_opackets++; *mp = m; -#ifdef INET if (tdb->tdb_dst.sa.sa_family == AF_INET) { if (tdb->tdb_xform->xf_type == XF_IP4) tdb->tdb_cur_bytes += @@ -617,7 +592,6 @@ ipip_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int dummy, ipipstat.ipips_obytes += m->m_pkthdr.len - sizeof(struct ip); } -#endif /* INET */ #ifdef INET6 if (tdb->tdb_dst.sa.sa_family == AF_INET6) { diff --git a/sys/netinet/ip_ipsp.c b/sys/netinet/ip_ipsp.c index d785d1cf7e8..dccfcdcb14d 100644 --- a/sys/netinet/ip_ipsp.c +++ b/sys/netinet/ip_ipsp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ipsp.c,v 1.201 2014/12/09 07:05:06 doug Exp $ */ +/* $OpenBSD: ip_ipsp.c,v 1.202 2014/12/19 17:14:40 tedu Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr), @@ -57,17 +57,12 @@ #include #endif -#ifdef INET #include #include #include #include -#endif /* INET */ #ifdef INET6 -#ifndef INET -#include -#endif #endif /* INET6 */ #include @@ -989,11 +984,9 @@ ipsp_address(union sockaddr_union sa) buf = ipspbuf[ipspround]; switch (sa.sa.sa_family) { -#ifdef INET case AF_INET: return inet_ntop(AF_INET, &sa.sin.sin_addr, buf, INET_ADDRSTRLEN); -#endif /* INET */ #ifdef INET6 case AF_INET6: @@ -1012,13 +1005,11 @@ int ipsp_is_unspecified(union sockaddr_union addr) { switch (addr.sa.sa_family) { -#ifdef INET case AF_INET: if (addr.sin.sin_addr.s_addr == INADDR_ANY) return 1; else return 0; -#endif /* INET */ #ifdef INET6 case AF_INET6: @@ -1106,9 +1097,7 @@ ipsp_parse_headers(struct mbuf *m, int off, u_int8_t proto) struct m_tag *mtag; struct tdb *tdb; -#ifdef INET struct ip iph; -#endif /* INET */ #ifdef INET6 struct in6_addr ip6_dst; @@ -1122,7 +1111,6 @@ ipsp_parse_headers(struct mbuf *m, int off, u_int8_t proto) while (1) { switch (proto) { -#ifdef INET case IPPROTO_IPV4: /* Also IPPROTO_IPIP */ { /* @@ -1135,7 +1123,6 @@ ipsp_parse_headers(struct mbuf *m, int off, u_int8_t proto) off += iph.ip_hl << 2; break; } -#endif /* INET */ #ifdef INET6 case IPPROTO_IPV6: @@ -1205,13 +1192,11 @@ ipsp_parse_headers(struct mbuf *m, int off, u_int8_t proto) s = splsoftnet(); -#ifdef INET if (ipv4sa) { su.sin.sin_family = AF_INET; su.sin.sin_len = sizeof(struct sockaddr_in); su.sin.sin_addr = iph.ip_dst; } -#endif /* INET */ #ifdef INET6 if (!ipv4sa) { @@ -1273,7 +1258,6 @@ ipsp_parse_headers(struct mbuf *m, int off, u_int8_t proto) tdbi->proto = proto; /* AH or ESP */ tdbi->rdomain = rtable_l2(m->m_pkthdr.ph_rtableid); -#ifdef INET /* Last network header was IPv4. */ if (ipv4sa) { tdbi->dst.sin.sin_family = AF_INET; @@ -1281,7 +1265,6 @@ ipsp_parse_headers(struct mbuf *m, int off, u_int8_t proto) sizeof(struct sockaddr_in); tdbi->dst.sin.sin_addr = iph.ip_dst; } -#endif /* INET */ #ifdef INET6 /* Last network header was IPv6. */ diff --git a/sys/netinet/ip_spd.c b/sys/netinet/ip_spd.c index 1c92d50c9a2..e0891fc46bb 100644 --- a/sys/netinet/ip_spd.c +++ b/sys/netinet/ip_spd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_spd.c,v 1.76 2014/11/25 13:10:03 mpi Exp $ */ +/* $OpenBSD: ip_spd.c,v 1.77 2014/12/19 17:14:40 tedu Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu) * @@ -34,17 +34,12 @@ #include #include -#ifdef INET #include #include #include #include -#endif /* INET */ #ifdef INET6 -#ifndef INET -#include -#endif #endif /* INET6 */ #include @@ -124,7 +119,6 @@ ipsp_spd_lookup(struct mbuf *m, int af, int hlen, int *error, int direction, ddst->sen_len = SENT_LEN; switch (af) { -#ifdef INET case AF_INET: if (hlen < sizeof (struct ip) || m->m_pkthdr.len < hlen) { *error = EINVAL; @@ -176,7 +170,6 @@ ipsp_spd_lookup(struct mbuf *m, int af, int hlen, int *error, int direction, } break; -#endif /* INET */ #ifdef INET6 case AF_INET6: @@ -294,13 +287,11 @@ ipsp_spd_lookup(struct mbuf *m, int af, int hlen, int *error, int direction, /* Check for non-specific destination in the policy. */ switch (ipo->ipo_dst.sa.sa_family) { -#ifdef INET case AF_INET: if ((ipo->ipo_dst.sin.sin_addr.s_addr == INADDR_ANY) || (ipo->ipo_dst.sin.sin_addr.s_addr == INADDR_BROADCAST)) dignore = 1; break; -#endif /* INET */ #ifdef INET6 case AF_INET6: @@ -314,12 +305,10 @@ ipsp_spd_lookup(struct mbuf *m, int af, int hlen, int *error, int direction, /* Likewise for source. */ switch (ipo->ipo_src.sa.sa_family) { -#ifdef INET case AF_INET: if (ipo->ipo_src.sin.sin_addr.s_addr == INADDR_ANY) signore = 1; break; -#endif /* INET */ #ifdef INET6 case AF_INET6: @@ -684,7 +673,6 @@ ipsec_update_policy(struct inpcb *inp, struct ipsec_policy *ipon, int af, switch (af) { case AF_INET: -#ifdef INET ipon->ipo_addr.sen_type = ipon->ipo_mask.sen_type = SENT_IP4; ipon->ipo_addr.sen_ip_src = inp->inp_laddr; ipon->ipo_addr.sen_ip_dst = inp->inp_faddr; @@ -704,7 +692,6 @@ ipsec_update_policy(struct inpcb *inp, struct ipsec_policy *ipon, int af, ipon->ipo_dst.sa.sa_len = sizeof(struct sockaddr_in); ipon->ipo_src.sin.sin_addr = inp->inp_laddr; ipon->ipo_dst.sin.sin_addr = inp->inp_faddr; -#endif /* INET */ break; case AF_INET6: @@ -813,7 +800,6 @@ ipsp_acquire_sa(struct ipsec_policy *ipo, union sockaddr_union *gw, /* Just copy the right information. */ switch (ipo->ipo_addr.sen_type) { -#ifdef INET case SENT_IP4: ipa->ipa_info.sen_type = ipa->ipa_mask.sen_type = SENT_IP4; ipa->ipa_info.sen_direction = ipo->ipo_addr.sen_direction; @@ -846,7 +832,6 @@ ipsp_acquire_sa(struct ipsec_policy *ipo, union sockaddr_union *gw, ipa->ipa_mask.sen_dport = ipo->ipo_mask.sen_dport; } break; -#endif /* INET */ #ifdef INET6 case SENT_IP6: diff --git a/sys/netinet/ipsec_input.c b/sys/netinet/ipsec_input.c index c24493c01cf..8607696d0d5 100644 --- a/sys/netinet/ipsec_input.c +++ b/sys/netinet/ipsec_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipsec_input.c,v 1.124 2014/12/05 15:50:04 mpi Exp $ */ +/* $OpenBSD: ipsec_input.c,v 1.125 2014/12/19 17:14:40 tedu Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -80,11 +80,9 @@ #include "bpfilter.h" void *ipsec_common_ctlinput(u_int, int, struct sockaddr *, void *, int); -#ifdef INET int ah4_input_cb(struct mbuf *, ...); int esp4_input_cb(struct mbuf *, ...); int ipcomp4_input_cb(struct mbuf *, ...); -#endif #ifdef INET6 int ah6_input_cb(struct mbuf *, int, int); @@ -145,11 +143,9 @@ ipsec_common_input(struct mbuf *m, int skip, int protoff, int af, int sproto, #endif (sproto == IPPROTO_IPCOMP && !ipcomp_enable)) { switch (af) { -#ifdef INET case AF_INET: rip_input(m, skip, sproto); break; -#endif /* INET */ #ifdef INET6 case AF_INET6: rip6_input(&m, &skip, sproto); @@ -202,14 +198,12 @@ ipsec_common_input(struct mbuf *m, int skip, int protoff, int af, int sproto, dst_address.sa.sa_family = af; switch (af) { -#ifdef INET case AF_INET: dst_address.sin.sin_len = sizeof(struct sockaddr_in); m_copydata(m, offsetof(struct ip, ip_dst), sizeof(struct in_addr), (caddr_t) &(dst_address.sin.sin_addr)); break; -#endif /* INET */ #ifdef INET6 case AF_INET6: @@ -330,9 +324,7 @@ ipsec_common_input_cb(struct mbuf *m, struct tdb *tdbp, int skip, int protoff, struct ifnet *encif; #endif -#ifdef INET struct ip *ip, ipn; -#endif /* INET */ #ifdef INET6 struct ip6_hdr *ip6, ip6n; @@ -353,7 +345,6 @@ ipsec_common_input_cb(struct mbuf *m, struct tdb *tdbp, int skip, int protoff, return EINVAL; } -#ifdef INET /* Fix IPv4 header */ if (af == AF_INET) { if ((m->m_len < skip) && ((m = m_pullup(m, skip)) == NULL)) { @@ -462,7 +453,6 @@ ipsec_common_input_cb(struct mbuf *m, struct tdb *tdbp, int skip, int protoff, } #endif /* INET6 */ } -#endif /* INET */ #ifdef INET6 /* Fix IPv6 header */ @@ -486,7 +476,6 @@ ipsec_common_input_cb(struct mbuf *m, struct tdb *tdbp, int skip, int protoff, /* Save protocol */ m_copydata(m, protoff, 1, (caddr_t) &prot); -#ifdef INET /* IP-in-IP encapsulation */ if (prot == IPPROTO_IPIP) { if (m->m_pkthdr.len - skip < sizeof(struct ip)) { @@ -530,7 +519,6 @@ ipsec_common_input_cb(struct mbuf *m, struct tdb *tdbp, int skip, int protoff, return EACCES; } } -#endif /* INET */ /* IPv6-in-IP encapsulation */ if (prot == IPPROTO_IPV6) { @@ -706,7 +694,6 @@ ipsec_common_input_cb(struct mbuf *m, struct tdb *tdbp, int skip, int protoff, /* Call the appropriate IPsec transform callback. */ switch (af) { -#ifdef INET case AF_INET: switch (sproto) { @@ -726,7 +713,6 @@ ipsec_common_input_cb(struct mbuf *m, struct tdb *tdbp, int skip, int protoff, return EPFNOSUPPORT; } break; -#endif /* INET */ #ifdef INET6 case AF_INET6: @@ -824,7 +810,6 @@ ipcomp_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, } } -#ifdef INET /* IPv4 AH wrapper. */ void ah4_input(struct mbuf *m, ...) @@ -1103,7 +1088,6 @@ esp4_ctlinput(int cmd, struct sockaddr *sa, u_int rdomain, void *v) return (ipsec_common_ctlinput(rdomain, cmd, sa, v, IPPROTO_ESP)); } -#endif /* INET */ #ifdef INET6 /* IPv6 AH wrapper. */ diff --git a/sys/netinet/ipsec_output.c b/sys/netinet/ipsec_output.c index 88a9c5952ba..6dbb74cdfdf 100644 --- a/sys/netinet/ipsec_output.c +++ b/sys/netinet/ipsec_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipsec_output.c,v 1.54 2014/09/08 06:24:13 jsg Exp $ */ +/* $OpenBSD: ipsec_output.c,v 1.55 2014/12/19 17:14:40 tedu Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu) * @@ -35,17 +35,12 @@ #include #endif -#ifdef INET #include #include #include #include -#endif /* INET */ #ifdef INET6 -#ifndef INET -#include -#endif #endif /* INET6 */ #include @@ -81,10 +76,8 @@ ipsp_process_packet(struct mbuf *m, struct tdb *tdb, int af, int tunalready) int dstopt = 0; #endif -#ifdef INET int setdf = 0; struct ip *ip; -#endif /* INET */ #ifdef INET6 struct ip6_hdr *ip6; #endif /* INET6 */ @@ -117,10 +110,8 @@ ipsp_process_packet(struct mbuf *m, struct tdb *tdb, int af, int tunalready) /* Check that the network protocol is supported */ switch (tdb->tdb_dst.sa.sa_family) { -#ifdef INET case AF_INET: break; -#endif /* INET */ #ifdef INET6 case AF_INET6: @@ -166,10 +157,8 @@ ipsp_process_packet(struct mbuf *m, struct tdb *tdb, int af, int tunalready) * doing tunneling. */ if (af == tdb->tdb_dst.sa.sa_family) { -#ifdef INET if (af == AF_INET) i = sizeof(struct ip); -#endif /* INET */ #ifdef INET6 if (af == AF_INET6) @@ -182,7 +171,6 @@ ipsp_process_packet(struct mbuf *m, struct tdb *tdb, int af, int tunalready) return ENOBUFS; } -#ifdef INET if (af == AF_INET) { ip = mtod(m, struct ip *); @@ -192,7 +180,6 @@ ipsp_process_packet(struct mbuf *m, struct tdb *tdb, int af, int tunalready) */ setdf = ip->ip_off & htons(IP_DF); } -#endif /* INET */ #ifdef INET6 if (af == AF_INET6) @@ -204,11 +191,9 @@ ipsp_process_packet(struct mbuf *m, struct tdb *tdb, int af, int tunalready) if ((tdb->tdb_dst.sa.sa_family != af) || /* PF mismatch */ (tdb->tdb_flags & TDBF_TUNNELING) || /* Tunneling needed */ (tdb->tdb_xform->xf_type == XF_IP4) || /* ditto */ -#ifdef INET ((tdb->tdb_dst.sa.sa_family == AF_INET) && (tdb->tdb_dst.sin.sin_addr.s_addr != INADDR_ANY) && (tdb->tdb_dst.sin.sin_addr.s_addr != ip->ip_dst.s_addr)) || -#endif /* INET */ #ifdef INET6 ((tdb->tdb_dst.sa.sa_family == AF_INET6) && (!IN6_IS_ADDR_UNSPECIFIED(&tdb->tdb_dst.sin6.sin6_addr)) && @@ -216,7 +201,6 @@ ipsp_process_packet(struct mbuf *m, struct tdb *tdb, int af, int tunalready) &ip6->ip6_dst))) || #endif /* INET6 */ 0) { -#ifdef INET /* Fix IPv4 header checksum and length. */ if (af == AF_INET) { if (m->m_len < sizeof(struct ip)) @@ -229,7 +213,6 @@ ipsp_process_packet(struct mbuf *m, struct tdb *tdb, int af, int tunalready) ip->ip_sum = 0; ip->ip_sum = in_cksum(m, ip->ip_hl << 2); } -#endif /* INET */ #ifdef INET6 /* Fix IPv6 header payload length. */ @@ -266,7 +249,6 @@ ipsp_process_packet(struct mbuf *m, struct tdb *tdb, int af, int tunalready) m = mp; mp = NULL; -#ifdef INET if (tdb->tdb_dst.sa.sa_family == AF_INET && setdf) { if (m->m_len < sizeof(struct ip)) if ((m = m_pullup(m, @@ -276,7 +258,6 @@ ipsp_process_packet(struct mbuf *m, struct tdb *tdb, int af, int tunalready) ip = mtod(m, struct ip *); ip->ip_off |= htons(IP_DF); } -#endif /* Remember that we appended a tunnel header. */ tdb->tdb_flags |= TDBF_USEDTUNNEL; @@ -296,13 +277,11 @@ ipsp_process_packet(struct mbuf *m, struct tdb *tdb, int af, int tunalready) /* Extract some information off the headers. */ switch (tdb->tdb_dst.sa.sa_family) { -#ifdef INET case AF_INET: ip = mtod(m, struct ip *); i = ip->ip_hl << 2; off = offsetof(struct ip, ip_p); break; -#endif /* INET */ #ifdef INET6 case AF_INET6: @@ -389,9 +368,7 @@ ipsp_process_packet(struct mbuf *m, struct tdb *tdb, int af, int tunalready) int ipsp_process_done(struct mbuf *m, struct tdb *tdb) { -#ifdef INET struct ip *ip; -#endif /* INET */ #ifdef INET6 struct ip6_hdr *ip6; @@ -427,7 +404,6 @@ ipsp_process_done(struct mbuf *m, struct tdb *tdb) } switch (tdb->tdb_dst.sa.sa_family) { -#ifdef INET case AF_INET: /* Fix the header length, for AH processing. */ ip = mtod(m, struct ip *); @@ -435,7 +411,6 @@ ipsp_process_done(struct mbuf *m, struct tdb *tdb) if ((tdb->tdb_flags & TDBF_UDPENCAP) != 0) ip->ip_p = IPPROTO_UDP; break; -#endif /* INET */ #ifdef INET6 case AF_INET6: @@ -507,10 +482,8 @@ ipsp_process_done(struct mbuf *m, struct tdb *tdb) * performed again there. */ switch (tdb->tdb_dst.sa.sa_family) { -#ifdef INET case AF_INET: return (ip_output(m, NULL, NULL, IP_RAWOUTPUT, NULL, NULL, 0)); -#endif /* INET */ #ifdef INET6 case AF_INET6: @@ -566,11 +539,9 @@ ipsec_hdrsz(struct tdb *tdbp) return (adjust); switch (tdbp->tdb_dst.sa.sa_family) { -#ifdef INET case AF_INET: adjust += sizeof(struct ip); break; -#endif /* INET */ #ifdef INET6 case AF_INET6: adjust += sizeof(struct ip6_hdr); diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 61c6e4dee3d..96712240d07 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_input.c,v 1.285 2014/12/05 15:50:04 mpi Exp $ */ +/* $OpenBSD: tcp_input.c,v 1.286 2014/12/19 17:14:40 tedu Exp $ */ /* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */ /* @@ -664,7 +664,6 @@ findpcb: bzero(&src, sizeof(src)); bzero(&dst, sizeof(dst)); switch (af) { -#ifdef INET case AF_INET: src.sin.sin_len = sizeof(struct sockaddr_in); src.sin.sin_family = AF_INET; @@ -676,7 +675,6 @@ findpcb: dst.sin.sin_addr = ip->ip_dst; dst.sin.sin_port = th->th_dport; break; -#endif #ifdef INET6 case AF_INET6: src.sin6.sin6_len = sizeof(struct sockaddr_in6); @@ -2394,7 +2392,6 @@ tcp_dooptions(struct tcpcb *tp, u_char *cp, int cnt, struct tcphdr *th, switch (tp->pf) { case 0: -#ifdef INET case AF_INET: src.sa.sa_len = sizeof(struct sockaddr_in); src.sa.sa_family = AF_INET; @@ -2403,7 +2400,6 @@ tcp_dooptions(struct tcpcb *tp, u_char *cp, int cnt, struct tcphdr *th, dst.sa.sa_family = AF_INET; dst.sin.sin_addr = mtod(m, struct ip *)->ip_dst; break; -#endif #ifdef INET6 case AF_INET6: src.sa.sa_len = sizeof(struct sockaddr_in6); @@ -4032,14 +4028,12 @@ syn_cache_add(struct sockaddr *src, struct sockaddr *dst, struct tcphdr *th, } switch (src->sa_family) { -#ifdef INET case AF_INET: /* * Remember the IP options, if any. */ ipopts = ip_srcroute(m); break; -#endif default: ipopts = NULL; } @@ -4317,12 +4311,10 @@ syn_cache_respond(struct syn_cache *sc, struct mbuf *m) switch (sc->sc_src.sa.sa_family) { case 0: /*default to PF_INET*/ -#ifdef INET case AF_INET: src.sin.sin_addr = mtod(m, struct ip *)->ip_src; dst.sin.sin_addr = mtod(m, struct ip *)->ip_dst; break; -#endif /* INET */ #ifdef INET6 case AF_INET6: src.sin6.sin6_addr = mtod(m, struct ip6_hdr *)->ip6_src; @@ -4383,14 +4375,12 @@ syn_cache_respond(struct syn_cache *sc, struct mbuf *m) * ip_len to be in host order, for convenience. */ switch (sc->sc_src.sa.sa_family) { -#ifdef INET case AF_INET: ip->ip_len = htons(tlen); ip->ip_ttl = inp ? inp->inp_ip.ip_ttl : ip_defttl; if (inp != NULL) ip->ip_tos = inp->inp_ip.ip_tos; break; -#endif #ifdef INET6 case AF_INET6: ip6->ip6_vfc &= ~IPV6_VERSION_MASK; @@ -4403,12 +4393,10 @@ syn_cache_respond(struct syn_cache *sc, struct mbuf *m) } switch (sc->sc_src.sa.sa_family) { -#ifdef INET case AF_INET: error = ip_output(m, sc->sc_ipopts, ro, (ip_mtudisc ? IP_MTUDISC : 0), NULL, inp, 0); break; -#endif #ifdef INET6 case AF_INET6: ip6->ip6_hlim = in6_selecthlim(NULL, diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index 1d38d064c60..15ce4901a6b 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_output.c,v 1.107 2014/07/22 11:06:10 mpi Exp $ */ +/* $OpenBSD: tcp_output.c,v 1.108 2014/12/19 17:14:40 tedu Exp $ */ /* $NetBSD: tcp_output.c,v 1.16 1997/06/03 16:17:09 kml Exp $ */ /* @@ -525,11 +525,9 @@ send: switch (tp->pf) { case 0: /*default to PF_INET*/ -#ifdef INET case PF_INET: hdrlen = sizeof(struct ip) + sizeof(struct tcphdr); break; -#endif /* INET */ #ifdef INET6 case PF_INET6: hdrlen = sizeof(struct ip6_hdr) + sizeof(struct tcphdr); @@ -906,7 +904,6 @@ send: switch (tp->pf) { case 0: /*default to PF_INET*/ -#ifdef INET case AF_INET: iphlen = sizeof(struct ip); src.sa.sa_len = sizeof(struct sockaddr_in); @@ -916,7 +913,6 @@ send: dst.sa.sa_family = AF_INET; dst.sin.sin_addr = mtod(m, struct ip *)->ip_dst; break; -#endif /* INET */ #ifdef INET6 case AF_INET6: iphlen = sizeof(struct ip6_hdr); @@ -1058,7 +1054,6 @@ send: switch (tp->pf) { case 0: /*default to PF_INET*/ -#ifdef INET case AF_INET: { struct ip *ip; @@ -1077,7 +1072,6 @@ send: &tp->t_inpcb->inp_route, (ip_mtudisc ? IP_MTUDISC : 0), NULL, tp->t_inpcb, 0); break; -#endif /* INET */ #ifdef INET6 case AF_INET6: { diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 22136f20965..d543472b119 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_subr.c,v 1.138 2014/11/18 02:37:31 tedu Exp $ */ +/* $OpenBSD: tcp_subr.c,v 1.139 2014/12/19 17:14:40 tedu Exp $ */ /* $NetBSD: tcp_subr.c,v 1.22 1996/02/13 23:44:00 christos Exp $ */ /* @@ -207,11 +207,9 @@ tcp_template(tp) switch (tp->pf) { case 0: /*default to PF_INET*/ -#ifdef INET case AF_INET: m->m_len = sizeof(struct ip); break; -#endif /* INET */ #ifdef INET6 case AF_INET6: m->m_len = sizeof(struct ip6_hdr); @@ -235,7 +233,6 @@ tcp_template(tp) } switch(tp->pf) { -#ifdef INET case AF_INET: { struct ipovly *ipovly; @@ -252,7 +249,6 @@ tcp_template(tp) sizeof(struct ip)); } break; -#endif /* INET */ #ifdef INET6 case AF_INET6: { @@ -1061,7 +1057,6 @@ tcp_signature(struct tdb *tdb, int af, struct mbuf *m, struct tcphdr *th, switch(af) { case 0: -#ifdef INET case AF_INET: { struct ippseudo ippseudo; struct ip *ip; @@ -1078,7 +1073,6 @@ tcp_signature(struct tdb *tdb, int af, struct mbuf *m, struct tcphdr *th, sizeof(struct ippseudo)); break; } -#endif #ifdef INET6 case AF_INET6: { struct ip6_hdr_pseudo ip6pseudo; diff --git a/sys/netinet6/in6_gif.c b/sys/netinet6/in6_gif.c index 78ac3beb064..5ae87d9f9e1 100644 --- a/sys/netinet6/in6_gif.c +++ b/sys/netinet6/in6_gif.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_gif.c,v 1.34 2014/12/05 15:50:04 mpi Exp $ */ +/* $OpenBSD: in6_gif.c,v 1.35 2014/12/19 17:14:40 tedu Exp $ */ /* $KAME: in6_gif.c,v 1.43 2001/01/22 07:27:17 itojun Exp $ */ /* @@ -51,9 +51,7 @@ #include #include -#ifdef INET #include -#endif #include #include @@ -102,10 +100,8 @@ in6_gif_output(struct ifnet *ifp, int family, struct mbuf **m0) xfs.xf_type = -1; /* not XF_IP4 */ switch (family) { -#ifdef INET case AF_INET: break; -#endif #ifdef INET6 case AF_INET6: break; diff --git a/sys/netinet6/in6_proto.c b/sys/netinet6/in6_proto.c index 81406efe5b1..c16da207152 100644 --- a/sys/netinet6/in6_proto.c +++ b/sys/netinet6/in6_proto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_proto.c,v 1.76 2014/12/05 15:50:04 mpi Exp $ */ +/* $OpenBSD: in6_proto.c,v 1.77 2014/12/19 17:14:40 tedu Exp $ */ /* $KAME: in6_proto.c,v 1.66 2000/10/10 15:35:47 itojun Exp $ */ /* @@ -139,11 +139,7 @@ struct ip6protosw inet6sw[] = { { SOCK_STREAM, &inet6domain, IPPROTO_TCP, PR_CONNREQUIRED|PR_WANTRCVD|PR_ABRTACPTDIS|PR_SPLICE, tcp6_input, 0, tcp6_ctlinput, tcp_ctloutput, tcp_usrreq, -#ifdef INET /* don't call initialization and timeout routines twice */ 0, 0, 0, 0, -#else - tcp_init, tcp_fasttimo, tcp_slowtimo, 0, -#endif tcp_sysctl, }, { SOCK_RAW, &inet6domain, IPPROTO_RAW, PR_ATOMIC|PR_ADDR, @@ -203,26 +199,22 @@ struct ip6protosw inet6sw[] = { rip6_usrreq, /* XXX */ 0, 0, 0, 0, }, -#ifdef INET { SOCK_RAW, &inet6domain, IPPROTO_IPV4, PR_ATOMIC|PR_ADDR, in6_gif_input, rip6_output, 0, rip6_ctloutput, rip6_usrreq, /* XXX */ 0, 0, 0, 0, }, -#endif /* INET */ #else /* NGIF */ { SOCK_RAW, &inet6domain, IPPROTO_IPV6, PR_ATOMIC|PR_ADDR, ip4_input6, rip6_output, 0, rip6_ctloutput, rip6_usrreq, /* XXX */ 0, 0, 0, 0, ipip_sysctl }, -#ifdef INET { SOCK_RAW, &inet6domain, IPPROTO_IPV4, PR_ATOMIC|PR_ADDR, ip4_input6, rip6_output, 0, rip6_ctloutput, rip6_usrreq, /* XXX */ 0, 0, 0, 0, }, -#endif /* INET */ #endif /* GIF */ #ifdef PIM { SOCK_RAW, &inet6domain, IPPROTO_PIM, PR_ATOMIC|PR_ADDR, diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index 60d5ec7b867..42d1dab2a7b 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_input.c,v 1.133 2014/12/05 15:50:04 mpi Exp $ */ +/* $OpenBSD: ip6_input.c,v 1.134 2014/12/19 17:14:40 tedu Exp $ */ /* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */ /* @@ -87,9 +87,7 @@ #include -#ifdef INET #include -#endif #include #include diff --git a/sys/netinet6/ip6_mroute.c b/sys/netinet6/ip6_mroute.c index 5bcc939ded3..7f91895d36f 100644 --- a/sys/netinet6/ip6_mroute.c +++ b/sys/netinet6/ip6_mroute.c @@ -147,11 +147,9 @@ void expire_upcalls(void *); #define EXPIRE_TIMEOUT (hz / 4) /* 4x / second */ #define UPCALL_EXPIRE 6 /* number of timeouts */ -#ifdef INET #ifdef MROUTING extern struct socket *ip_mrouter; #endif -#endif /* * 'Interfaces' associated with decapsulator (so we can tell @@ -450,7 +448,6 @@ ip6_mrouter_done(void) * For each phyint in use, disable promiscuous reception of all IPv6 * multicasts. */ -#ifdef INET #ifdef MROUTING /* * If there is still IPv4 multicast routing daemon, @@ -459,7 +456,6 @@ ip6_mrouter_done(void) * daemon is not interested... */ if (!ip_mrouter) -#endif #endif { for (mifi = 0; mifi < nummifs; mifi++) {