diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2016-09-29 11:37:45 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2016-09-29 11:37:45 +0000 |
commit | 9951244c5f33a92e93612e06d7846b3937537add (patch) | |
tree | 4a663d9d11e4edb9da9328c556f2e7cbf4e2a8b3 | |
parent | f886cd16f49fdb47d2c015137df2434bf89190e1 (diff) |
Rename brtag_src/brtag_dst to brtag_peer/brtag_local to avoid
confusion about the tunnel endpoints when responding to the peer.
OK yasuoka@
-rw-r--r-- | sys/net/bridgectl.c | 4 | ||||
-rw-r--r-- | sys/net/if_bridge.c | 17 | ||||
-rw-r--r-- | sys/net/if_bridge.h | 6 | ||||
-rw-r--r-- | sys/net/if_switch.c | 16 | ||||
-rw-r--r-- | sys/net/if_vxlan.c | 10 |
5 files changed, 24 insertions, 29 deletions
diff --git a/sys/net/bridgectl.c b/sys/net/bridgectl.c index 4e306927bb4..40072451e35 100644 --- a/sys/net/bridgectl.c +++ b/sys/net/bridgectl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bridgectl.c,v 1.3 2016/09/03 13:46:57 reyk Exp $ */ +/* $OpenBSD: bridgectl.c,v 1.4 2016/09/29 11:37:43 reyk Exp $ */ /* * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net) @@ -487,7 +487,7 @@ bridge_rtfind(struct bridge_softc *sc, struct ifbaconf *baconf) sizeof(bareq.ifba_ifsname)); bcopy(&n->brt_addr, &bareq.ifba_dst, sizeof(bareq.ifba_dst)); - bridge_copyaddr(&n->brt_tunnel.brtag_src.sa, + bridge_copyaddr(&n->brt_tunnel.brtag_peer.sa, (struct sockaddr *)&bareq.ifba_dstsa); bareq.ifba_age = n->brt_age; bareq.ifba_flags = n->brt_flags; diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index 1b01b47c295..2e9135b1325 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bridge.c,v 1.284 2016/09/03 13:46:57 reyk Exp $ */ +/* $OpenBSD: if_bridge.c,v 1.285 2016/09/29 11:37:44 reyk Exp $ */ /* * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net) @@ -813,14 +813,9 @@ bridge_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *sa, sendunicast: if ((dst_p != NULL) && - (dst_p->brt_tunnel.brtag_dst.sa.sa_family != AF_UNSPEC) && - ((brtag = bridge_tunneltag(m)) != NULL)) { - memcpy(&brtag->brtag_src, &dst_p->brt_tunnel.brtag_src.sa, - dst_p->brt_tunnel.brtag_src.sa.sa_len); - memcpy(&brtag->brtag_dst, &dst_p->brt_tunnel.brtag_dst.sa, - dst_p->brt_tunnel.brtag_dst.sa.sa_len); - brtag->brtag_id = dst_p->brt_tunnel.brtag_id; - } + (dst_p->brt_tunnel.brtag_peer.sa.sa_family != AF_UNSPEC) && + ((brtag = bridge_tunneltag(m)) != NULL)) + bridge_copytag(&dst_p->brt_tunnel, brtag); bridge_span(sc, m); if ((dst_if->if_flags & IFF_RUNNING) == 0) { @@ -2002,8 +1997,8 @@ bridge_copytag(struct bridge_tunneltag *src, struct bridge_tunneltag *dst) if (src == NULL) { memset(dst, 0, sizeof(*dst)); } else { - bridge_copyaddr(&src->brtag_src.sa, &dst->brtag_src.sa); - bridge_copyaddr(&src->brtag_dst.sa, &dst->brtag_dst.sa); + bridge_copyaddr(&src->brtag_peer.sa, &dst->brtag_peer.sa); + bridge_copyaddr(&src->brtag_local.sa, &dst->brtag_local.sa); dst->brtag_id = src->brtag_id; } } diff --git a/sys/net/if_bridge.h b/sys/net/if_bridge.h index 95a5144c0ca..09143db50cd 100644 --- a/sys/net/if_bridge.h +++ b/sys/net/if_bridge.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bridge.h,v 1.51 2016/09/03 13:46:57 reyk Exp $ */ +/* $OpenBSD: if_bridge.h,v 1.52 2016/09/29 11:37:44 reyk Exp $ */ /* * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net) @@ -409,8 +409,8 @@ struct bridge_iflist { * Bridge tunnel tagging */ struct bridge_tunneltag { - union pfsockaddr_union brtag_src; - union pfsockaddr_union brtag_dst; + union pfsockaddr_union brtag_peer; + union pfsockaddr_union brtag_local; u_int32_t brtag_id; }; diff --git a/sys/net/if_switch.c b/sys/net/if_switch.c index c8079cf32c3..3b6d6907e99 100644 --- a/sys/net/if_switch.c +++ b/sys/net/if_switch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_switch.c,v 1.6 2016/09/28 08:31:42 rzalamena Exp $ */ +/* $OpenBSD: if_switch.c,v 1.7 2016/09/29 11:37:44 reyk Exp $ */ /* * Copyright (c) 2016 Kazuya GODA <goda@openbsd.org> @@ -1396,8 +1396,8 @@ switch_flow_classifier_tunnel(struct mbuf *m, int *offset, if ((brtag = bridge_tunnel(m)) == NULL) goto out; - if ((brtag->brtag_dst.sa.sa_family != AF_INET) && - (brtag->brtag_dst.sa.sa_family != AF_INET6)) + if ((brtag->brtag_peer.sa.sa_family != AF_INET) && + (brtag->brtag_peer.sa.sa_family != AF_INET6)) goto out; swfcl->swfcl_tunnel = pool_get(&swfcl_pool, PR_NOWAIT|PR_ZERO); @@ -1406,18 +1406,18 @@ switch_flow_classifier_tunnel(struct mbuf *m, int *offset, return (NULL); } - swfcl->swfcl_tunnel->tun_af = brtag->brtag_dst.sa.sa_family; + swfcl->swfcl_tunnel->tun_af = brtag->brtag_peer.sa.sa_family; swfcl->swfcl_tunnel->tun_key = htobe64(brtag->brtag_id); if (swfcl->swfcl_tunnel->tun_af == AF_INET) { swfcl->swfcl_tunnel->tun_ipv4_src = - brtag->brtag_src.sin.sin_addr; + brtag->brtag_local.sin.sin_addr; swfcl->swfcl_tunnel->tun_ipv4_dst = - brtag->brtag_dst.sin.sin_addr; + brtag->brtag_peer.sin.sin_addr; } else { swfcl->swfcl_tunnel->tun_ipv6_src = - brtag->brtag_src.sin6.sin6_addr; + brtag->brtag_local.sin6.sin6_addr; swfcl->swfcl_tunnel->tun_ipv6_dst = - brtag->brtag_dst.sin6.sin6_addr; + brtag->brtag_peer.sin6.sin6_addr; } bridge_tunneluntag(m); out: diff --git a/sys/net/if_vxlan.c b/sys/net/if_vxlan.c index 30b5a17ae2d..e700d7507fa 100644 --- a/sys/net/if_vxlan.c +++ b/sys/net/if_vxlan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vxlan.c,v 1.46 2016/09/28 14:26:43 yasuoka Exp $ */ +/* $OpenBSD: if_vxlan.c,v 1.47 2016/09/29 11:37:44 reyk Exp $ */ /* * Copyright (c) 2013 Reyk Floeter <reyk@openbsd.org> @@ -646,8 +646,8 @@ vxlan_lookup(struct mbuf *m, struct udphdr *uh, int iphlen, if ((ifp->if_bridgeport != NULL || ifp->if_switchport != NULL) && srcsa->sa_family != AF_UNSPEC && ((brtag = bridge_tunneltag(m)) != NULL)) { - memcpy(&brtag->brtag_src.sa, srcsa, srcsa->sa_len); - memcpy(&brtag->brtag_dst.sa, dstsa, dstsa->sa_len); + memcpy(&brtag->brtag_peer.sa, srcsa, srcsa->sa_len); + memcpy(&brtag->brtag_local.sa, dstsa, dstsa->sa_len); brtag->brtag_id = vni; } #endif @@ -776,11 +776,11 @@ vxlan_output(struct ifnet *ifp, struct mbuf *m) #if NBRIDGE > 0 if ((brtag = bridge_tunnel(m)) != NULL) { - dst = &brtag->brtag_src.sa; + dst = &brtag->brtag_peer.sa; /* If accepting any VNI, source ip address is from brtag */ if (sc->sc_vnetid == VXLAN_VNI_ANY) { - src = &brtag->brtag_dst.sa; + src = &brtag->brtag_local.sa; tag = (uint32_t)brtag->brtag_id; af = src->sa_family; } |