From: Benjamin Cama Date: Thu, 7 Jul 2011 11:12:30 +0000 (+0200) Subject: Add a config option to set the advertised BGP next hop. X-Git-Tag: debian/2.2.1-1fdn1~1^2~1 X-Git-Url: http://git.sameswireless.fr/l2tpns.git/commitdiff_plain/8c4f3bfe794e4ff92662d9be5903e5b203f5d41e?ds=sidebyside Add a config option to set the advertised BGP next hop. Signed-off-by: Benjamin Cama --- diff --git a/bgp.c b/bgp.c index f643921..8e722de 100644 --- a/bgp.c +++ b/bgp.c @@ -195,7 +195,14 @@ int bgp_start(struct bgp_peer *peer, char *name, int as, int keepalive, /* NEXT_HOP */ a.flags = BGP_PATH_ATTR_FLAG_TRANS; a.code = BGP_PATH_ATTR_CODE_NEXT_HOP; - ip = my_address; /* we're it */ + if (config->nexthop_address) + { + ip = config->nexthop_address; + } + else + { + ip = my_address; /* we're it */ + } a.data.s.len = sizeof(ip); memcpy(a.data.s.value, &ip, sizeof(ip)); diff --git a/l2tpns.c b/l2tpns.c index b745b3f..39b09b5 100644 --- a/l2tpns.c +++ b/l2tpns.c @@ -159,6 +159,7 @@ config_descriptt config_values[] = { CONFIG("ipv6_prefix", ipv6_prefix, IPv6), CONFIG("cli_bind_address", cli_bind_address, IPv4), CONFIG("hostname", hostname, STRING), + CONFIG("nexthop_address", nexthop_address, IPv4), { NULL, 0, 0, 0 }, }; diff --git a/l2tpns.h b/l2tpns.h index 4df0a5a..e6357b6 100644 --- a/l2tpns.h +++ b/l2tpns.h @@ -728,6 +728,7 @@ typedef struct int hold; struct in_addr update_source; } neighbour[BGP_NUM_PEERS]; + in_addr_t nexthop_address; #endif } configt;