This commit handles the case where an incoming updateSource IP address is received for setting as bgp update-source IP address.
Signed-off-by: Philippe Guibert <philippe.guib...@6wind.com> --- bgpd/bgp.bcapnp.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 3 deletions(-) diff --git a/bgpd/bgp.bcapnp.c b/bgpd/bgp.bcapnp.c index 135a54f34dc6..1667033b823f 100644 --- a/bgpd/bgp.bcapnp.c +++ b/bgpd/bgp.bcapnp.c @@ -542,7 +542,26 @@ void qcapn_BGPPeer_read(struct peer *s, capn_ptr p) else s->flags &= ~PEER_FLAG_DISABLE_CONNECTED_CHECK; } s->ttl = capn_read32(p, 20); - /* MISSING: updateSource */ + { + const char * update_source = NULL; + int len; + capn_text tp = capn_get_text(p, 2, capn_val0); + update_source = tp.str; + len = tp.len; + if (update_source && len != 0) + { + union sockunion *su; + + su = sockunion_str2su (update_source); + if (su) + s->update_source = su; + } + else + { + s->update_source = NULL; + s->update_if = NULL; + } + } } @@ -565,7 +584,21 @@ void qcapn_BGPPeer_write(const struct peer *s, capn_ptr p) capn_write1(p, 53, !!(s->flags & PEER_FLAG_DYNAMIC_CAPABILITY)); capn_write1(p, 54, !!(s->flags & PEER_FLAG_DISABLE_CONNECTED_CHECK)); capn_write32(p, 20, s->ttl); - /* MISSING: updateSource */ + { + capn_text tp; + char *ptr = malloc(65); + if(s->update_source) + { + ptr = (char *)sockunion2str((const union sockunion *)s->update_source, ptr, 64); + tp.str = ptr; + tp.len = strlen(ptr); + } else + { + tp.str = NULL; + tp.len = 0; + } + capn_set_text(p, 2, tp); + } } @@ -674,7 +707,22 @@ void qcapn_BGPPeer_set(struct peer *s, capn_ptr p) } { - /* MISSING: update_source */ + const char * update_source = NULL; + int len; + capn_text tp = capn_get_text(p, 2, capn_val0); + update_source = tp.str; + len = tp.len; + if (update_source && len != 0) + { + union sockunion su; + int ret = str2sockunion (update_source, &su); + if (ret == 0) + peer_update_source_addr_set (s, &su); + } + else + { + peer_update_source_unset (s); + } } } -- 2.1.4 _______________________________________________ Quagga-dev mailing list Quagga-dev@lists.quagga.net https://lists.quagga.net/mailman/listinfo/quagga-dev