diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2019-07-31 18:35:31 +0200 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2020-05-08 18:52:55 +0200 |
commit | 03fdff750f2b9f3e56a796e0c3d232304ea38f81 (patch) | |
tree | e5e8c5eb2969cc74882657ff0274ed6973b73b8a /proto/wireguard | |
parent | a684ba4f64762269b22b52b05534c00d7b16e4d6 (diff) |
Wireguard: Rename remote endpoint to tunnel endpoint
Adopt to draft-ietf-idr-tunnel-encaps-13.txt
by renaming emote endpoint to tunnel endpoint.
Diffstat (limited to 'proto/wireguard')
-rw-r--r-- | proto/wireguard/wireguard.c | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/proto/wireguard/wireguard.c b/proto/wireguard/wireguard.c index 4e1f964d..406c45e1 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<<BGP_TUNNEL_ENCAP_A_SUB_TLV_ENCAP) #define FLAG_BGP_TUNNEL_ENCAP_A_SUB_TLV_COLOR (1<<BGP_TUNNEL_ENCAP_A_SUB_TLV_COLOR) -#define FLAG_BGP_TUNNEL_ENCAP_A_SUB_TLV_REMOTE_EP (1<<BGP_TUNNEL_ENCAP_A_SUB_TLV_REMOTE_EP) +#define FLAG_BGP_TUNNEL_ENCAP_A_SUB_TLV_TUNNEL_EP (1<<BGP_TUNNEL_ENCAP_A_SUB_TLV_TUNNEL_EP) #define FLAG_BGP_TUNNEL_ENCAP_A_SUB_TLV_UDP_DEST_PORT (1<<BGP_TUNNEL_ENCAP_A_SUB_TLV_UDP_DEST_PORT) static @@ -447,10 +447,10 @@ int decode_udp_dest_port(const void *p, size_t sub_tlv_len, u16 *udp_dest_port, } static -int decode_remote_ep(void *p, size_t sub_tlv_len, u32 *as4, ip_addr *remote_ep, u16 *flags) +int decode_tunnel_ep(void *p, size_t sub_tlv_len, u32 *as4, ip_addr *tunnel_ep, u16 *flags) { if (sub_tlv_len < 6) { - log(L_TRACE "WG: remote ep len error"); + log(L_TRACE "WG: tunnel ep len error"); return -1; } @@ -462,16 +462,16 @@ int decode_remote_ep(void *p, size_t sub_tlv_len, u32 *as4, ip_addr *remote_ep, log(L_TRACE "WG: IPv4 len error %d", sub_tlv_len); return -1; } - *remote_ep = ipa_from_ip4(get_ip4(p + 6)); - *flags |= FLAG_BGP_TUNNEL_ENCAP_A_SUB_TLV_REMOTE_EP; + *tunnel_ep = ipa_from_ip4(get_ip4(p + 6)); + *flags |= FLAG_BGP_TUNNEL_ENCAP_A_SUB_TLV_TUNNEL_EP; return 0; case NET_IP6: if (sub_tlv_len != 22) { log(L_TRACE "WG: IPv6 len error %d", sub_tlv_len); return -1; } - *remote_ep = ipa_from_ip6(get_ip6(p + 6)); - *flags |= FLAG_BGP_TUNNEL_ENCAP_A_SUB_TLV_REMOTE_EP; + *tunnel_ep = ipa_from_ip6(get_ip6(p + 6)); + *flags |= FLAG_BGP_TUNNEL_ENCAP_A_SUB_TLV_TUNNEL_EP; return 0; default: log(L_TRACE "WG: Address family error %d", af); @@ -481,7 +481,7 @@ int decode_remote_ep(void *p, size_t sub_tlv_len, u32 *as4, ip_addr *remote_ep, static int decode_sub_tlv(u8 *p, size_t len, wg_key *pubkey, - u32 *remote_ep_as, ip_addr *remote_ep_addr, + u32 *tunnel_ep_as, ip_addr *tunnel_ep_addr, u32 *color, u16 *udp_dest_port, u16 *flags) { if (len < 3) { @@ -518,8 +518,8 @@ int decode_sub_tlv(u8 *p, size_t len, wg_key *pubkey, case BGP_TUNNEL_ENCAP_A_SUB_TLV_ENCAP: res = decode_wireguard(p, sub_tlv_len, pubkey, flags); break; - case BGP_TUNNEL_ENCAP_A_SUB_TLV_REMOTE_EP: - res = decode_remote_ep(p, sub_tlv_len, remote_ep_as, remote_ep_addr, flags); + case BGP_TUNNEL_ENCAP_A_SUB_TLV_TUNNEL_EP: + res = decode_tunnel_ep(p, sub_tlv_len, tunnel_ep_as, tunnel_ep_addr, flags); break; case BGP_TUNNEL_ENCAP_A_SUB_TLV_COLOR: res = decode_color(p, sub_tlv_len, color, flags); @@ -540,7 +540,7 @@ int decode_sub_tlv(u8 *p, size_t len, wg_key *pubkey, } static -int decode_tunnel_encap(const eattr *e, u16 wg_tunnel_type, wg_key *pubkey, u32 *as4, ip_addr *remote_ep, u32 *color, u16 *udp_port, u16 *flags) +int decode_tunnel_encap(const eattr *e, u16 wg_tunnel_type, wg_key *pubkey, u32 *as4, ip_addr *tunnel_ep, u32 *color, u16 *udp_port, u16 *flags) { u8 *p = e->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; } |