diff options
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/bridgestp.c | 4 | ||||
-rw-r--r-- | sys/net/if.c | 17 | ||||
-rw-r--r-- | sys/net/if_bridge.c | 20 | ||||
-rw-r--r-- | sys/net/if_ethersubr.c | 12 | ||||
-rw-r--r-- | sys/net/if_gif.c | 25 | ||||
-rw-r--r-- | sys/net/if_gre.c | 6 | ||||
-rw-r--r-- | sys/net/if_loop.c | 9 | ||||
-rw-r--r-- | sys/net/if_mpe.c | 9 | ||||
-rw-r--r-- | sys/net/if_pflog.c | 7 | ||||
-rw-r--r-- | sys/net/if_pflow.c | 4 | ||||
-rw-r--r-- | sys/net/if_pfsync.c | 8 | ||||
-rw-r--r-- | sys/net/if_ppp.c | 14 | ||||
-rw-r--r-- | sys/net/if_pppx.c | 6 | ||||
-rw-r--r-- | sys/net/if_spppsubr.c | 16 | ||||
-rw-r--r-- | sys/net/if_trunk.c | 10 | ||||
-rw-r--r-- | sys/net/if_tun.c | 10 | ||||
-rw-r--r-- | sys/net/if_vether.c | 8 | ||||
-rw-r--r-- | sys/net/if_vlan.c | 6 | ||||
-rw-r--r-- | sys/net/if_vxlan.c | 20 | ||||
-rw-r--r-- | sys/net/if_vxlan.h | 4 | ||||
-rw-r--r-- | sys/net/netisr.c | 2 | ||||
-rw-r--r-- | sys/net/pf.c | 82 | ||||
-rw-r--r-- | sys/net/pf_if.c | 4 | ||||
-rw-r--r-- | sys/net/pf_ioctl.c | 6 | ||||
-rw-r--r-- | sys/net/pf_lb.c | 8 | ||||
-rw-r--r-- | sys/net/pf_norm.c | 6 | ||||
-rw-r--r-- | sys/net/pf_table.c | 12 | ||||
-rw-r--r-- | sys/net/pfkeyv2.c | 22 | ||||
-rw-r--r-- | sys/net/pfkeyv2_convert.c | 10 | ||||
-rw-r--r-- | sys/net/pipex.c | 4 | ||||
-rw-r--r-- | sys/net/radix_mpath.c | 10 |
31 files changed, 30 insertions, 351 deletions
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 <net/if_media.h> #include <net/netisr.h> -#ifdef INET #include <netinet/in.h> #include <netinet/ip.h> #include <netinet/if_ether.h> -#endif #include <net/if_bridge.h> 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 <net/route.h> #include <net/netisr.h> -#ifdef INET #include <netinet/in.h> #include <netinet/if_ether.h> #include <netinet/igmp.h> #ifdef MROUTING #include <netinet/ip_mroute.h> #endif -#endif #ifdef INET6 -#ifndef INET -#include <netinet/in.h> -#endif #include <netinet6/in6_var.h> #include <netinet6/in6_ifattach.h> #include <netinet6/nd6.h> @@ -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 <net/if_llc.h> #include <net/netisr.h> -#ifdef INET #include <netinet/in.h> #include <netinet/ip.h> #include <netinet/ip_var.h> #include <netinet/if_ether.h> #include <netinet/ip_icmp.h> -#endif #ifdef IPSEC #include <netinet/ip_ipsp.h> @@ -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 <net/route.h> #include <net/bpf.h> -#ifdef INET #include <netinet/in.h> #include <netinet/in_var.h> #include <netinet/in_gif.h> #include <netinet/ip.h> #include <netinet/ip_ether.h> #include <netinet/ip_var.h> -#endif /* INET */ #ifdef INET6 -#ifndef INET -#include <netinet/in.h> -#endif #include <netinet6/in6_var.h> #include <netinet/ip6.h> #include <netinet6/ip6_var.h> @@ -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 <net/netisr.h> #include <net/route.h> -#ifdef INET #include <netinet/in.h> #include <netinet/ip.h> #include <netinet/ip_var.h> #include <netinet/if_ether.h> -#else -#error "if_gre used without inet" -#endif #if NBPFILTER > 0 #include <net/bpf.h> 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 <net/netisr.h> #include <net/route.h> -#ifdef INET #include <netinet/in.h> #include <netinet/ip.h> -#endif #ifdef INET6 -#ifndef INET -#include <netinet/in.h> -#endif #include <netinet/ip6.h> #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 <pyr@spootnik.org> @@ -30,16 +30,11 @@ #include <net/netisr.h> #include <net/route.h> -#ifdef INET #include <netinet/in.h> #include <netinet/ip.h> -#endif #ifdef INET6 #include <netinet/ip6.h> -#ifndef INET -#include <netinet/in.h> -#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 <net/if_types.h> #include <net/bpf.h> -#ifdef INET #include <netinet/in.h> #include <netinet/ip.h> #include <netinet/tcp.h> #include <netinet/udp.h> #include <netinet/ip_icmp.h> -#endif #ifdef INET6 -#ifndef INET -#include <netinet/in.h> -#endif #include <netinet/ip6.h> #include <netinet/icmp6.h> #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 <florian@narrans.de> @@ -38,13 +38,11 @@ #include <netinet/if_ether.h> #include <netinet/tcp.h> -#ifdef INET #include <netinet/ip.h> #include <netinet/ip_var.h> #include <netinet/udp.h> #include <netinet/udp_var.h> #include <netinet/in_pcb.h> -#endif /* INET */ #include <net/pfvar.h> #include <net/if_pflow.h> 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 <netinet/tcp.h> #include <netinet/tcp_seq.h> -#ifdef INET #include <netinet/in_var.h> #include <netinet/ip.h> #include <netinet/ip_var.h> -#endif #ifdef INET6 #include <netinet6/in6_var.h> @@ -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 <net/route.h> #include <net/bpf.h> -#ifdef INET #include <netinet/in.h> #include <netinet/ip.h> -#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 <claudio@openbsd.org> @@ -69,11 +69,9 @@ #include <netinet/if_ether.h> #include <net/if_dl.h> -#ifdef INET #include <netinet/in_var.h> #include <netinet/ip.h> #include <netinet/ip_var.h> -#endif #ifdef INET6 #include <netinet6/in6_var.h> @@ -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 <sys/stdarg.h> -#ifdef INET #include <netinet/in.h> #include <netinet/in_var.h> #include <netinet/ip.h> #include <netinet/tcp.h> #include <netinet/if_ether.h> -#endif #ifdef INET6 #include <netinet6/in6_ifattach.h> @@ -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 <reyk@openbsd.org> @@ -40,11 +40,9 @@ #include <net/bpf.h> #endif -#ifdef INET #include <netinet/in.h> #include <netinet/if_ether.h> #include <netinet/ip.h> -#endif #ifdef INET6 #include <netinet/ip6.h> @@ -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 <net/if_types.h> #include <net/netisr.h> -#ifdef INET #include <netinet/in.h> #include <netinet/ip.h> #include <netinet/if_ether.h> -#endif #ifdef PIPEX #include <net/pipex.h> @@ -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 <net/if_dl.h> #include <net/if_media.h> -#ifdef INET #include <netinet/in.h> #include <netinet/if_ether.h> -#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 <net/if_dl.h> #include <net/if_types.h> -#ifdef INET #include <netinet/in.h> #include <netinet/if_ether.h> -#endif #include <net/if_vlan_var.h> @@ -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 <reyk@openbsd.org> @@ -141,10 +141,8 @@ 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); vxlan_enable++; @@ -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,7 +548,6 @@ 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; @@ -568,10 +555,8 @@ vxlan_output(struct ifnet *ifp, struct mbuf *m) #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 <reyk@openbsd.org> @@ -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 <henning@openbsd.org> @@ -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 <provos@citi.umich.edu> @@ -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 <net/bpf.h> #endif -#ifdef INET #include <netinet/ip.h> #include <netinet/ip_var.h> #ifdef INET6 @@ -72,7 +71,6 @@ #include <netinet/tcp.h> #include <netinet/udp.h> #include <netinet/udp_var.h> -#endif #include <crypto/arc4.h> /* 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: { |