diff options
Diffstat (limited to 'proto/wireguard/wireguard.c')
-rw-r--r-- | proto/wireguard/wireguard.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/proto/wireguard/wireguard.c b/proto/wireguard/wireguard.c index f0ac45e6..f73460d5 100644 --- a/proto/wireguard/wireguard.c +++ b/proto/wireguard/wireguard.c @@ -402,8 +402,6 @@ dump(void *ptr, size_t len) #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_UDP_DEST_PORT (1<<BGP_TUNNEL_ENCAP_A_SUB_TLV_UDP_DEST_PORT) -#define BGP_TUNNEL_ENCAP_A_TUNNEL_TYPE_WIREGUARD 65535 - static int decode_wireguard(const void *p, size_t sub_tlv_len, wg_key *pubkey, u16 *flags) { @@ -542,7 +540,7 @@ int decode_sub_tlv(u8 *p, size_t len, wg_key *pubkey, } static -int decode_tunnel_encap(const eattr *e, 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 *remote_ep, u32 *color, u16 *udp_port, u16 *flags) { u8 *p = e->u.ptr->data; int len = e->u.ptr->length; @@ -556,7 +554,7 @@ int decode_tunnel_encap(const eattr *e, wg_key *pubkey, u32 *as4, ip_addr *remot log(L_DEBUG "WG: tunnel type %d", tunnel_type); - if (tunnel_type != BGP_TUNNEL_ENCAP_A_TUNNEL_TYPE_WIREGUARD) { + if (tunnel_type != wg_tunnel_type) { log(L_TRACE "WG: tunnel type error %d", tunnel_type); return -1; } @@ -695,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, &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, &remote_ep_as4, &remote_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; |