summaryrefslogtreecommitdiff
path: root/proto/wireguard/wireguard.c
diff options
context:
space:
mode:
Diffstat (limited to 'proto/wireguard/wireguard.c')
-rw-r--r--proto/wireguard/wireguard.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/proto/wireguard/wireguard.c b/proto/wireguard/wireguard.c
index ade81f1a..970a383f 100644
--- a/proto/wireguard/wireguard.c
+++ b/proto/wireguard/wireguard.c
@@ -385,13 +385,23 @@ wg_rt_notify(struct proto *P, struct channel *CH, struct network *n,
// debug("WG: notify\n");
if (new) {
- iface = new->attrs->nh.iface;
+ struct nexthop *nh = &new->attrs->nh;
+ iface = nh->iface;
ifname = iface ? iface->name : NULL;
if (iface && iface == p->iface) {
struct eattr *t;
- debug("WG: found iface\n");
+ debug("WG: found %p iface %I %p\n", new->attrs, nh->gw, nh->next);
+
+ struct hostentry *he = new->attrs->hostentry;
+
+ debug("WG: he %p src %p\n", he, he?he->src:NULL);
+ if (he && he->src) {
+ struct eattr *t = ea_find(he->src->eattrs, EA_CODE(PROTOCOL_BGP, BA_TUNNEL_ENCAP));
+ debug("WG: he %p %I %I %p %p %I\n", t, he->addr, he->link, he->next, he->src->hostentry, he->src->nh.gw);
+ }
+
en = fib_get(&ch->rtable, n->n.addr);
debug("WG: notify new %d %N\n",
@@ -406,6 +416,9 @@ wg_rt_notify(struct proto *P, struct channel *CH, struct network *n,
u16 flags = 0;
t = ea_find(new->attrs->eattrs, EA_CODE(PROTOCOL_BGP, BA_TUNNEL_ENCAP));
+ 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) {
log(L_TRACE "WG: Attr %x %x %d %04x", t->flags, t->type, t->u.ptr->length, flags);