Add a config option to set the advertised BGP next hop.
Signed-off-by: Benjamin Cama <benoar@dolka.fr>
This commit is contained in:
parent
4f1a9aa378
commit
8c4f3bfe79
3 changed files with 10 additions and 1 deletions
9
bgp.c
9
bgp.c
|
|
@ -195,7 +195,14 @@ int bgp_start(struct bgp_peer *peer, char *name, int as, int keepalive,
|
||||||
/* NEXT_HOP */
|
/* NEXT_HOP */
|
||||||
a.flags = BGP_PATH_ATTR_FLAG_TRANS;
|
a.flags = BGP_PATH_ATTR_FLAG_TRANS;
|
||||||
a.code = BGP_PATH_ATTR_CODE_NEXT_HOP;
|
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);
|
a.data.s.len = sizeof(ip);
|
||||||
memcpy(a.data.s.value, &ip, sizeof(ip));
|
memcpy(a.data.s.value, &ip, sizeof(ip));
|
||||||
|
|
||||||
|
|
|
||||||
1
l2tpns.c
1
l2tpns.c
|
|
@ -159,6 +159,7 @@ config_descriptt config_values[] = {
|
||||||
CONFIG("ipv6_prefix", ipv6_prefix, IPv6),
|
CONFIG("ipv6_prefix", ipv6_prefix, IPv6),
|
||||||
CONFIG("cli_bind_address", cli_bind_address, IPv4),
|
CONFIG("cli_bind_address", cli_bind_address, IPv4),
|
||||||
CONFIG("hostname", hostname, STRING),
|
CONFIG("hostname", hostname, STRING),
|
||||||
|
CONFIG("nexthop_address", nexthop_address, IPv4),
|
||||||
{ NULL, 0, 0, 0 },
|
{ NULL, 0, 0, 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
1
l2tpns.h
1
l2tpns.h
|
|
@ -728,6 +728,7 @@ typedef struct
|
||||||
int hold;
|
int hold;
|
||||||
struct in_addr update_source;
|
struct in_addr update_source;
|
||||||
} neighbour[BGP_NUM_PEERS];
|
} neighbour[BGP_NUM_PEERS];
|
||||||
|
in_addr_t nexthop_address;
|
||||||
#endif
|
#endif
|
||||||
} configt;
|
} configt;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue