mirror of
https://github.com/systemd/systemd.git
synced 2025-01-21 22:04:01 +03:00
network: static route - Allow to configure per route hop liimt
This commit is contained in:
parent
c068650fcf
commit
88c0642358
@ -1617,6 +1617,13 @@ allow my_server_t localnet_peer_t:peer recv;</programlisting>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>HopLimit=</varname></term>
|
||||
<listitem>
|
||||
<para> Configures per route hop limit. See also <varname>IPv6HopLimit=</varname>.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>Protocol=</varname></term>
|
||||
<listitem>
|
||||
|
@ -197,6 +197,7 @@ Route.IPv6Preference, config_parse_ipv6_route_preference,
|
||||
Route.Protocol, config_parse_route_protocol, 0, 0
|
||||
Route.Type, config_parse_route_type, 0, 0
|
||||
Route.TCPRetransmissionTimeOutSec, config_parse_route_tcp_rto, 0, 0
|
||||
Route.HopLimit, config_parse_route_hop_limit, 0, 0
|
||||
Route.InitialCongestionWindow, config_parse_route_tcp_window, 0, 0
|
||||
Route.InitialAdvertisedReceiveWindow, config_parse_route_tcp_window, 0, 0
|
||||
Route.TCPAdvertisedMaximumSegmentSize, config_parse_tcp_advmss, 0, 0
|
||||
|
@ -2532,6 +2532,67 @@ int config_parse_route_type(
|
||||
return 0;
|
||||
}
|
||||
|
||||
int config_parse_route_hop_limit(
|
||||
const char *unit,
|
||||
const char *filename,
|
||||
unsigned line,
|
||||
const char *section,
|
||||
unsigned section_line,
|
||||
const char *lvalue,
|
||||
int ltype,
|
||||
const char *rvalue,
|
||||
void *data,
|
||||
void *userdata) {
|
||||
|
||||
_cleanup_(route_free_or_set_invalidp) Route *n = NULL;
|
||||
Network *network = userdata;
|
||||
uint32_t k;
|
||||
int r;
|
||||
|
||||
assert(filename);
|
||||
assert(section);
|
||||
assert(lvalue);
|
||||
assert(rvalue);
|
||||
assert(data);
|
||||
|
||||
r = route_new_static(network, filename, section_line, &n);
|
||||
if (r == -ENOMEM)
|
||||
return log_oom();
|
||||
if (r < 0) {
|
||||
log_syntax(unit, LOG_WARNING, filename, line, r,
|
||||
"Failed to allocate route, ignoring assignment: %m");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (isempty(rvalue)) {
|
||||
n->hop_limit = 0;
|
||||
TAKE_PTR(n);
|
||||
return 0;
|
||||
}
|
||||
|
||||
r = safe_atou32(rvalue, &k);
|
||||
if (r < 0) {
|
||||
log_syntax(unit, LOG_WARNING, filename, line, r,
|
||||
"Could not parse route hop limit %s \"%s\", ignoring assignment: %m", lvalue, rvalue);
|
||||
return 0;
|
||||
}
|
||||
if (k > 255) {
|
||||
log_syntax(unit, LOG_WARNING, filename, line, 0,
|
||||
"Specified route hop limit %s \"%s\" is too large, ignoring assignment: %m", lvalue, rvalue);
|
||||
return 0;
|
||||
}
|
||||
if (k == 0) {
|
||||
log_syntax(unit, LOG_WARNING, filename, line, 0,
|
||||
"Invalid route hop limit %s \"%s\", ignoring assignment: %m", lvalue, rvalue);
|
||||
return 0;
|
||||
}
|
||||
|
||||
n->hop_limit = k;
|
||||
|
||||
TAKE_PTR(n);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int config_parse_tcp_congestion(
|
||||
const char *unit,
|
||||
const char *filename,
|
||||
|
@ -125,6 +125,7 @@ CONFIG_PARSER_PROTOTYPE(config_parse_ipv6_route_preference);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_route_protocol);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_route_type);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_route_tcp_window);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_route_hop_limit);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_tcp_window);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_route_tcp_rto);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_route_mtu);
|
||||
|
Loading…
x
Reference in New Issue
Block a user