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
|
|
@ -238,6 +238,12 @@ otherwise the primary address of the machine.</p>
|
|||
<code>/usr/share/iproute2/rt_protos</code>). This allows to separate
|
||||
routes added by several l2tpns instances. The default is 42.</p>
|
||||
</dd>
|
||||
<dt><code>route_metric</code> (int)</dt>
|
||||
<dd>
|
||||
<p>Metric of the route. Routes with lower values are preferred. This
|
||||
should not be changed during execution, since l2tpns would then not
|
||||
recognize the routes it added itself. The default is 1.</p>
|
||||
</dd>
|
||||
<dt><code>ipv6_prefix</code> (ipv6 address)</dt>
|
||||
<dd>
|
||||
<p>Enable negotiation of IPv6. This forms the the first 64 bits of the
|
||||
|
|
|
|||
|
|
@ -260,6 +260,13 @@ should be set by a line like: set configstring \"value\" set ipaddress
|
|||
by several l2tpns instances.
|
||||
The default is 42.
|
||||
|
||||
`route_metric` (int)
|
||||
|
||||
: Metric of the route. Routes with lower values are preferred.
|
||||
This should not be changed during execution, since l2tpns would then
|
||||
not recognize the routes it added itself.
|
||||
The default is 1.
|
||||
|
||||
`ipv6_prefix` (ipv6 address)
|
||||
|
||||
: Enable negotiation of IPv6. This forms the the first 64 bits of the
|
||||
|
|
|
|||
|
|
@ -122,6 +122,8 @@ set cli_bind_address 127.0.0.1
|
|||
#set nexthop 10.0.1.1
|
||||
#set nexthop6 2001:db8::1
|
||||
|
||||
# Route metric (lower is preferred)
|
||||
#set route_metric 1
|
||||
# Route protocol number to use
|
||||
#set route_protocol 42
|
||||
|
||||
|
|
|
|||
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);
|
||||
|
|
|
|||
1
l2tpns.h
1
l2tpns.h
|
|
@ -785,6 +785,7 @@ typedef struct
|
|||
in_addr_t peer_address;
|
||||
struct in6_addr ipv6_prefix; // Our IPv6 network pool.
|
||||
uint16_t route_protocol; // Route protocol number to use
|
||||
int route_metric; // Route metric
|
||||
int send_garp; // Set to true to garp for vip address on startup
|
||||
|
||||
int dump_speed;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue