summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbluhm <bluhm@openbsd.org>2017-05-12 13:40:29 +0000
committerbluhm <bluhm@openbsd.org>2017-05-12 13:40:29 +0000
commitc0afee44c6837366a92f4a5477223d6b8002ba5d (patch)
treef6ad4574268cc20359af15b7a9089cf19fa95161
parentNeed to clear tty context before using it. (diff)
downloadwireguard-openbsd-c0afee44c6837366a92f4a5477223d6b8002ba5d.tar.xz
wireguard-openbsd-c0afee44c6837366a92f4a5477223d6b8002ba5d.zip
Make a kernel with switch(4) but without INET6 compile again.
Sprinkle some #ifdef INET6 and do not use in6addr_any from the netinet6 code. test and OK rzalamena@
-rw-r--r--sys/net/if_switch.c8
-rw-r--r--sys/net/switchofp.c20
2 files changed, 24 insertions, 4 deletions
diff --git a/sys/net/if_switch.c b/sys/net/if_switch.c
index c23aef70851..b5f9256e02b 100644
--- a/sys/net/if_switch.c
+++ b/sys/net/if_switch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_switch.c,v 1.18 2017/01/17 12:30:35 rzalamena Exp $ */
+/* $OpenBSD: if_switch.c,v 1.19 2017/05/12 13:40:29 bluhm Exp $ */
/*
* Copyright (c) 2016 Kazuya GODA <goda@openbsd.org>
@@ -1022,6 +1022,7 @@ switch_flow_classifier_icmpv4(struct mbuf *m, int *offset,
return (m);
}
+#ifdef INET6
struct mbuf *
switch_flow_classifier_nd6(struct mbuf *m, int *offset,
struct switch_flow_classify *swfcl)
@@ -1137,6 +1138,7 @@ switch_flow_classifier_icmpv6(struct mbuf *m, int *offset,
return (m);
}
+#endif /* INET6 */
struct mbuf *
switch_flow_classifier_ipv4(struct mbuf *m, int *offset,
@@ -1179,6 +1181,7 @@ switch_flow_classifier_ipv4(struct mbuf *m, int *offset,
return (m);
}
+#ifdef INET6
struct mbuf *
switch_flow_classifier_ipv6(struct mbuf *m, int *offset,
struct switch_flow_classify *swfcl)
@@ -1218,6 +1221,7 @@ switch_flow_classifier_ipv6(struct mbuf *m, int *offset,
return (m);
}
+#endif /* INET6 */
struct mbuf *
switch_flow_classifier_arp(struct mbuf *m, int *offset,
@@ -1320,8 +1324,10 @@ switch_flow_classifier_ether(struct mbuf *m, int *offset,
return switch_flow_classifier_arp(m, offset, swfcl);
case ETHERTYPE_IP:
return switch_flow_classifier_ipv4(m, offset, swfcl);
+#ifdef INET6
case ETHERTYPE_IPV6:
return switch_flow_classifier_ipv6(m, offset, swfcl);
+#endif /* INET6 */
case ETHERTYPE_MPLS:
/* unsupported yet */
break;
diff --git a/sys/net/switchofp.c b/sys/net/switchofp.c
index 56f0a7d3783..10f8b3b50ed 100644
--- a/sys/net/switchofp.c
+++ b/sys/net/switchofp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: switchofp.c,v 1.60 2017/03/01 09:32:07 mpi Exp $ */
+/* $OpenBSD: switchofp.c,v 1.61 2017/05/12 13:40:29 bluhm Exp $ */
/*
* Copyright (c) 2016 Kazuya GODA <goda@openbsd.org>
@@ -781,6 +781,7 @@ struct ofp_oxm_class ofp_oxm_handlers[] = {
swofp_ox_match_ether_addr, swofp_ox_set_ether_addr,
swofp_ox_cmp_ether_addr
},
+#ifdef INET6
{
OFP_XM_T_IPV6_SRC,
sizeof(struct in6_addr),
@@ -837,6 +838,7 @@ struct ofp_oxm_class ofp_oxm_handlers[] = {
swofp_ox_match_ether_addr, swofp_ox_set_ether_addr,
swofp_ox_cmp_ether_addr
},
+#endif /* INET6 */
{
OFP_XM_T_MPLS_LABEL,
sizeof(uint32_t),
@@ -906,6 +908,7 @@ struct ofp_oxm_class ofp_oxm_nxm_handlers[] = {
swofp_ox_match_ipv4_addr, swofp_ox_set_ipv4_addr,
swofp_ox_cmp_ipv4_addr
},
+#ifdef INET6
{
OFP_XM_NXMT_TUNNEL_IPV6_SRC,
sizeof(struct in6_addr),
@@ -920,6 +923,7 @@ struct ofp_oxm_class ofp_oxm_nxm_handlers[] = {
swofp_ox_match_ipv6_addr, swofp_ox_set_ipv6_addr,
swofp_ox_cmp_ipv6_addr
},
+#endif /* INET6 */
};
/*
@@ -1698,6 +1702,7 @@ swofp_ox_cmp_data(struct ofp_ox_match *target,
return !((tmth & tmask) == (kmth & kmask));
}
+#ifdef INET6
int
swofp_ox_cmp_ipv6_addr(struct ofp_ox_match *target,
struct ofp_ox_match *key, int strict)
@@ -1770,6 +1775,7 @@ swofp_ox_cmp_ipv6_addr(struct ofp_ox_match *target,
return memcmp(&tmth, &kmth, sizeof(tmth));
}
}
+#endif /* INET6 */
int
swofp_ox_cmp_ipv4_addr(struct ofp_ox_match *target,
@@ -2716,6 +2722,7 @@ swofp_ox_set_ether_addr(struct switch_flow_classify *swfcl,
return (0);
}
+#ifdef INET6
int
swofp_ox_match_ipv6_addr(struct switch_flow_classify *swfcl,
struct ofp_ox_match *oxm)
@@ -2778,6 +2785,7 @@ swofp_ox_match_ipv6_addr(struct switch_flow_classify *swfcl,
return memcmp(&in, &mth, sizeof(in));
}
+#endif /* INET6 */
int
swofp_ox_match_ipv4_addr(struct switch_flow_classify *swfcl,
@@ -3689,6 +3697,7 @@ swofp_apply_set_field_tcp(struct mbuf *m, int off,
return (m);
}
+#ifdef INET6
struct mbuf *
swofp_apply_set_field_nd6(struct mbuf *m, int off,
struct switch_flow_classify *pre_swfcl, struct switch_flow_classify *swfcl)
@@ -3810,6 +3819,7 @@ swofp_apply_set_field_icmpv6(struct mbuf *m, int off,
return (m);
}
+#endif /* INET6 */
struct mbuf *
swofp_apply_set_field_icmpv4(struct mbuf *m, int off,
@@ -3836,6 +3846,7 @@ swofp_apply_set_field_icmpv4(struct mbuf *m, int off,
return (m);
}
+#ifdef INET6
struct mbuf *
swofp_apply_set_field_ipv6(struct mbuf *m, int off,
struct switch_flow_classify *pre_swfcl, struct switch_flow_classify *swfcl)
@@ -3913,6 +3924,7 @@ swofp_apply_set_field_ipv6(struct mbuf *m, int off,
return (m);
}
+#endif /* INET6 */
struct mbuf *
swofp_apply_set_field_ipv4(struct mbuf *m, int off,
@@ -4093,8 +4105,10 @@ swofp_apply_set_field_ether(struct mbuf *m, int off,
return swofp_apply_set_field_arp(m, off, pre_swfcl, swfcl);
case ETHERTYPE_IP:
return swofp_apply_set_field_ipv4(m, off, pre_swfcl, swfcl);
+#ifdef INET6
case ETHERTYPE_IPV6:
return swofp_apply_set_field_ipv6(m, off, pre_swfcl, swfcl);
+#endif /* INET6 */
case ETHERTYPE_MPLS:
/* unsupported yet */
break;
@@ -4125,8 +4139,8 @@ swofp_apply_set_field_tunnel(struct mbuf *m, int off,
pre_swfcl->swfcl_tunnel->tun_ipv4_src;
brtag->brtag_peer.sin.sin_addr =
pre_swfcl->swfcl_tunnel->tun_ipv4_dst;
- } else if (!IN6_ARE_ADDR_EQUAL(
- &pre_swfcl->swfcl_tunnel->tun_ipv6_dst, &in6addr_any)) {
+ } else if (!IN6_IS_ADDR_UNSPECIFIED(
+ &pre_swfcl->swfcl_tunnel->tun_ipv6_dst)) {
brtag->brtag_peer.sin6.sin6_family =
brtag->brtag_local.sin.sin_family = AF_INET6;
brtag->brtag_local.sin6.sin6_addr =