Add route_metric option
To be able to keep different routes from several running l2tpns instances.
This commit is contained in:
parent
b793850d2f
commit
0845ec8a19
5 changed files with 21 additions and 2 deletions
7
l2tpns.c
7
l2tpns.c
|
|
@ -178,6 +178,7 @@ config_descriptt config_values[] = {
|
|||
CONFIG("peer_address", peer_address, IPv4),
|
||||
CONFIG("ipv6_prefix", ipv6_prefix, IPv6),
|
||||
CONFIG("route_protocol", route_protocol, SHORT),
|
||||
CONFIG("route_metric", route_metric, INT),
|
||||
CONFIG("send_garp", send_garp, BOOL),
|
||||
CONFIG("throttle_speed", rl_rate, UNSIGNED_LONG),
|
||||
CONFIG("throttle_buckets", num_tbfs, INT),
|
||||
|
|
@ -1585,7 +1586,7 @@ static void routeset(sessionidt s, in_addr_t ip, int prefixlen, in_addr_t gw, in
|
|||
n_ip = htonl(gw);
|
||||
rtnetlink_addattr(&req.nh, RTA_GATEWAY, &n_ip, sizeof(n_ip));
|
||||
}
|
||||
metric = 1;
|
||||
metric = config->route_metric;
|
||||
rtnetlink_addattr(&req.nh, RTA_PRIORITY, &metric, sizeof(metric));
|
||||
|
||||
LOG(1, s, session[s].tunnel, "Route %s %s/%d%s%s\n", add ? "add" : "del",
|
||||
|
|
@ -1706,7 +1707,7 @@ void route6set(sessionidt s, struct in6_addr ip, int prefixlen, int add)
|
|||
int idx = session_if_idx(s);
|
||||
rtnetlink_addattr(&req.nh, RTA_OIF, &idx, sizeof(idx));
|
||||
rtnetlink_addattr(&req.nh, RTA_DST, &ip, sizeof(ip));
|
||||
metric = 1;
|
||||
metric = config->route_metric;
|
||||
rtnetlink_addattr(&req.nh, RTA_PRIORITY, &metric, sizeof(metric));
|
||||
|
||||
LOG(1, s, session[s].tunnel, "Route %s %s/%d\n",
|
||||
|
|
@ -7516,6 +7517,8 @@ static void update_config()
|
|||
|
||||
if (!config->route_protocol)
|
||||
config->route_protocol = 42;
|
||||
if (!config->route_metric)
|
||||
config->route_metric = 1;
|
||||
|
||||
if (!*config->pppoe_ac_name)
|
||||
strncpy(config->pppoe_ac_name, DEFAULT_PPPOE_AC_NAME, sizeof(config->pppoe_ac_name) - 1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue