From 62a4d6ce22365af4f1d34f504a6aa773a24b3994 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Wed, 31 Jul 2019 18:35:31 +0200 Subject: Wireguard: Rename remote endpoint to tunnel endpoint Adopt to draft-ietf-idr-tunnel-encaps-13.txt by renaming emote endpoint to tunnel endpoint. --- proto/wireguard/wireguard.c | 46 ++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/proto/wireguard/wireguard.c b/proto/wireguard/wireguard.c index f73460d5..7e4e436d 100644 --- a/proto/wireguard/wireguard.c +++ b/proto/wireguard/wireguard.c @@ -394,12 +394,12 @@ dump(void *ptr, size_t len) #define BGP_TUNNEL_ENCAP_A_SUB_TLV_ENCAP 1 #define BGP_TUNNEL_ENCAP_A_SUB_TLV_COLOR 4 -#define BGP_TUNNEL_ENCAP_A_SUB_TLV_REMOTE_EP 6 +#define BGP_TUNNEL_ENCAP_A_SUB_TLV_TUNNEL_EP 6 #define BGP_TUNNEL_ENCAP_A_SUB_TLV_UDP_DEST_PORT 8 #define FLAG_BGP_TUNNEL_ENCAP_A_SUB_TLV_ENCAP (1<u.ptr->data; int len = e->u.ptr->length; @@ -569,7 +569,7 @@ int decode_tunnel_encap(const eattr *e, u16 wg_tunnel_type, wg_key *pubkey, u32 } for (u8 *cur = p + 4; cur < p + 4 + value_length;) { - int res = decode_sub_tlv(cur, value_length, pubkey, as4, remote_ep, color, udp_port, flags); + int res = decode_sub_tlv(cur, value_length, pubkey, as4, tunnel_ep, color, udp_port, flags); if (res < 0) { log(L_TRACE "WG: decode error %d", res); @@ -600,18 +600,18 @@ add_peer(wg_device *dev, wg_key pubkey) } static int -set_peer_remote_ep(wg_peer *peer, ip_addr remote_ep_addr, u16 udp_dest_port) +set_peer_tunnel_ep(wg_peer *peer, ip_addr tunnel_ep_addr, u16 udp_dest_port) { - if (udp_dest_port != 0 && ipa_nonzero(remote_ep_addr) ) { - if (ipa_is_ip4(remote_ep_addr)) { + if (udp_dest_port != 0 && ipa_nonzero(tunnel_ep_addr) ) { + if (ipa_is_ip4(tunnel_ep_addr)) { log(L_TRACE "WG: found ip4 ep"); peer->endpoint.addr4.sin_family = AF_INET; - put_ip4(&peer->endpoint.addr4.sin_addr.s_addr, ipa_to_ip4(remote_ep_addr)); + put_ip4(&peer->endpoint.addr4.sin_addr.s_addr, ipa_to_ip4(tunnel_ep_addr)); put_u16(&peer->endpoint.addr4.sin_port, udp_dest_port); } else { log(L_TRACE "WG: found ip6 ep"); peer->endpoint.addr6.sin6_family = AF_INET6; - put_ip6(&peer->endpoint.addr6.sin6_addr, ipa_to_ip6(remote_ep_addr)); + put_ip6(&peer->endpoint.addr6.sin6_addr, ipa_to_ip6(tunnel_ep_addr)); put_u16(&peer->endpoint.addr6.sin6_port, udp_dest_port); } } @@ -683,8 +683,8 @@ wg_rt_notify(struct proto *P, struct channel *CH, struct network *n, wg_key pubkey; memset(pubkey, 0, sizeof(wg_key)); - u32 remote_ep_as4 = 0; - ip_addr remote_ep_addr = IPA_NONE; + u32 tunnel_ep_as4 = 0; + ip_addr tunnel_ep_addr = IPA_NONE; u16 udp_dest_port = 0; u32 color = 0; u16 flags = 0; @@ -693,7 +693,7 @@ wg_rt_notify(struct proto *P, struct channel *CH, struct network *n, if (!t && he && he->src) { t = ea_find(he->src->eattrs, EA_CODE(PROTOCOL_BGP, BA_TUNNEL_ENCAP)); } - if (t && t->u.ptr && decode_tunnel_encap(t, c->tunnel_type, &pubkey, &remote_ep_as4, &remote_ep_addr, &color, &udp_dest_port, &flags) == 0) { + if (t && t->u.ptr && decode_tunnel_encap(t, c->tunnel_type, &pubkey, &tunnel_ep_as4, &tunnel_ep_addr, &color, &udp_dest_port, &flags) == 0) { log(L_TRACE "WG: Attr %x %x %d %04x", t->flags, t->type, t->u.ptr->length, flags); struct wg_device *dev = p->dev; @@ -714,7 +714,7 @@ wg_rt_notify(struct proto *P, struct channel *CH, struct network *n, log(L_TRACE "WG: Found"); found = true; - set_peer_remote_ep(peer, remote_ep_addr, udp_dest_port); + set_peer_tunnel_ep(peer, tunnel_ep_addr, udp_dest_port); add_allowed_ips(ch->c.net_type, n, peer); dirty = true; @@ -723,7 +723,7 @@ wg_rt_notify(struct proto *P, struct channel *CH, struct network *n, if (!found) { wg_peer *peer = add_peer(dev, pubkey); - set_peer_remote_ep(peer, remote_ep_addr, udp_dest_port); + set_peer_tunnel_ep(peer, tunnel_ep_addr, udp_dest_port); add_allowed_ips(ch->c.net_type, n, peer); dirty = true; } -- cgit v1.2.3