summaryrefslogtreecommitdiffstats
path: root/bgpd
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2015-06-12 16:59:11 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2015-06-12 16:59:11 +0200
commited40466af80c9d0b88436c637a1d54b28a669b1c (patch)
treeb092d22e9591da81776a56006dc2883f445b0ddd /bgpd
parentThis patch changes BGP from only listening mode for BFD status updates to int... (diff)
downloadfrr-ed40466af80c9d0b88436c637a1d54b28a669b1c.tar.xz
frr-ed40466af80c9d0b88436c637a1d54b28a669b1c.zip
bgpd-set-somark.patch
BGP: Set SO_MARK on connecting sockets to ensure lookup in right routing table In the presence of a function such as management VRF/MRF, bgpd needs to be able to specify that it intends to run in the dataplane and not the front panel. To ensure this, we add a mark in the connecting socket so that the kernel does the routing lookup in the right table. This assumes that an appropriate ip rule has been configured (outside the scope of this package). While we've forced the mark to be 254 for now, it maybe required to make it configurable at a later time.
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_network.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c
index 68934655f..c65119489 100644
--- a/bgpd/bgp_network.c
+++ b/bgpd/bgp_network.c
@@ -440,6 +440,8 @@ bgp_update_source (struct peer *peer)
sockunion_bind (peer->fd, peer->update_source, 0, peer->update_source);
}
+#define DATAPLANE_MARK 254 /* main table ID */
+
/* BGP try to connect to the peer. */
int
bgp_connect (struct peer *peer)
@@ -466,6 +468,9 @@ bgp_connect (struct peer *peer)
sockopt_reuseaddr (peer->fd);
sockopt_reuseport (peer->fd);
+ if (sockopt_mark_default(peer->fd, DATAPLANE_MARK, &bgpd_privs) < 0)
+ zlog_warn("Unable to set mark on FD for peer %s, err=%s", peer->host,
+ safe_strerror(errno));
#ifdef IPTOS_PREC_INTERNETCONTROL
if (bgpd_privs.change (ZPRIVS_RAISE))