mirror of
https://github.com/systemd/systemd.git
synced 2025-03-31 14:50:15 +03:00
Merge pull request #4182 from jkoelker/routetable
This commit is contained in:
commit
d11e656ace
@ -917,6 +917,15 @@
|
||||
DHCP server.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>RouteTable=<replaceable>num</replaceable></varname></term>
|
||||
<listitem>
|
||||
<para>The table identifier for DHCP routes (a number between 1 and 4294967295, or 0 to unset).
|
||||
The table can be retrieved using <command>ip route show table <replaceable>num</replaceable></command>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
@ -957,6 +966,16 @@
|
||||
project='man-pages'><refentrytitle>resolv.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>RouteTable=<replaceable>num</replaceable></varname></term>
|
||||
<listitem>
|
||||
<para>The table identifier for the routes received in the Router Advertisement
|
||||
(a number between 1 and 4294967295, or 0 to unset).
|
||||
The table can be retrieved using <command>ip route show table <replaceable>num</replaceable></command>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
|
@ -95,6 +95,7 @@ static int link_set_dhcp_routes(Link *link) {
|
||||
route_gw->scope = RT_SCOPE_LINK;
|
||||
route_gw->protocol = RTPROT_DHCP;
|
||||
route_gw->priority = link->network->dhcp_route_metric;
|
||||
route_gw->table = link->network->dhcp_route_table;
|
||||
|
||||
r = route_configure(route_gw, link, dhcp4_route_handler);
|
||||
if (r < 0)
|
||||
@ -106,6 +107,7 @@ static int link_set_dhcp_routes(Link *link) {
|
||||
route->gw.in = gateway;
|
||||
route->prefsrc.in = address;
|
||||
route->priority = link->network->dhcp_route_metric;
|
||||
route->table = link->network->dhcp_route_table;
|
||||
|
||||
r = route_configure(route, link, dhcp4_route_handler);
|
||||
if (r < 0) {
|
||||
@ -136,6 +138,7 @@ static int link_set_dhcp_routes(Link *link) {
|
||||
assert_se(sd_dhcp_route_get_destination(static_routes[i], &route->dst.in) >= 0);
|
||||
assert_se(sd_dhcp_route_get_destination_prefix_length(static_routes[i], &route->dst_prefixlen) >= 0);
|
||||
route->priority = link->network->dhcp_route_metric;
|
||||
route->table = link->network->dhcp_route_table;
|
||||
|
||||
r = route_configure(route, link, dhcp4_route_handler);
|
||||
if (r < 0)
|
||||
|
@ -94,7 +94,7 @@ static void ndisc_router_process_default(Link *link, sd_ndisc_router *rt) {
|
||||
}
|
||||
|
||||
route->family = AF_INET6;
|
||||
route->table = RT_TABLE_MAIN;
|
||||
route->table = link->network->ipv6_accept_ra_route_table;
|
||||
route->protocol = RTPROT_RA;
|
||||
route->pref = preference;
|
||||
route->gw.in6 = gateway;
|
||||
@ -214,7 +214,7 @@ static void ndisc_router_process_onlink_prefix(Link *link, sd_ndisc_router *rt)
|
||||
}
|
||||
|
||||
route->family = AF_INET6;
|
||||
route->table = RT_TABLE_MAIN;
|
||||
route->table = link->network->ipv6_accept_ra_route_table;
|
||||
route->protocol = RTPROT_RA;
|
||||
route->flags = RTM_F_PREFIX;
|
||||
route->dst_prefixlen = prefixlen;
|
||||
@ -285,7 +285,7 @@ static void ndisc_router_process_route(Link *link, sd_ndisc_router *rt) {
|
||||
}
|
||||
|
||||
route->family = AF_INET6;
|
||||
route->table = RT_TABLE_MAIN;
|
||||
route->table = link->network->ipv6_accept_ra_route_table;
|
||||
route->protocol = RTPROT_RA;
|
||||
route->pref = preference;
|
||||
route->gw.in6 = gateway;
|
||||
|
@ -92,10 +92,12 @@ DHCP.VendorClassIdentifier, config_parse_string,
|
||||
DHCP.DUIDType, config_parse_duid_type, 0, offsetof(Network, duid.type)
|
||||
DHCP.DUIDRawData, config_parse_duid_rawdata, 0, offsetof(Network, duid)
|
||||
DHCP.RouteMetric, config_parse_unsigned, 0, offsetof(Network, dhcp_route_metric)
|
||||
DHCP.RouteTable, config_parse_dhcp_route_table, 0, offsetof(Network, dhcp_route_table)
|
||||
DHCP.UseTimezone, config_parse_bool, 0, offsetof(Network, dhcp_use_timezone)
|
||||
DHCP.IAID, config_parse_iaid, 0, offsetof(Network, iaid)
|
||||
IPv6AcceptRA.UseDNS, config_parse_bool, 0, offsetof(Network, ipv6_accept_ra_use_dns)
|
||||
IPv6AcceptRA.UseDomains, config_parse_dhcp_use_domains, 0, offsetof(Network, ipv6_accept_ra_use_domains)
|
||||
IPv6AcceptRA.RouteTable, config_parse_dhcp_route_table, 0, offsetof(Network, ipv6_accept_ra_route_table)
|
||||
DHCPServer.MaxLeaseTimeSec, config_parse_sec, 0, offsetof(Network, dhcp_server_max_lease_time_usec)
|
||||
DHCPServer.DefaultLeaseTimeSec, config_parse_sec, 0, offsetof(Network, dhcp_server_default_lease_time_usec)
|
||||
DHCPServer.EmitDNS, config_parse_bool, 0, offsetof(Network, dhcp_server_emit_dns)
|
||||
|
@ -111,6 +111,7 @@ static int network_load_one(Manager *manager, const char *filename) {
|
||||
network->dhcp_send_hostname = true;
|
||||
network->dhcp_route_metric = DHCP_ROUTE_METRIC;
|
||||
network->dhcp_client_identifier = DHCP_CLIENT_ID_DUID;
|
||||
network->dhcp_route_table = RT_TABLE_MAIN;
|
||||
|
||||
network->dhcp_server_emit_dns = true;
|
||||
network->dhcp_server_emit_ntp = true;
|
||||
@ -137,6 +138,7 @@ static int network_load_one(Manager *manager, const char *filename) {
|
||||
network->proxy_arp = -1;
|
||||
network->arp = -1;
|
||||
network->ipv6_accept_ra_use_dns = true;
|
||||
network->ipv6_accept_ra_route_table = RT_TABLE_MAIN;
|
||||
|
||||
dropin_dirname = strjoina(network->name, ".network.d");
|
||||
|
||||
@ -1033,6 +1035,36 @@ int config_parse_dnssec_negative_trust_anchors(
|
||||
return 0;
|
||||
}
|
||||
|
||||
int config_parse_dhcp_route_table(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) {
|
||||
uint32_t rt;
|
||||
int r;
|
||||
|
||||
assert(filename);
|
||||
assert(lvalue);
|
||||
assert(rvalue);
|
||||
assert(data);
|
||||
|
||||
r = safe_atou32(rvalue, &rt);
|
||||
if (r < 0) {
|
||||
log_syntax(unit, LOG_ERR, filename, line, r,
|
||||
"Unable to read RouteTable, ignoring assignment: %s", rvalue);
|
||||
return 0;
|
||||
}
|
||||
|
||||
*((uint32_t *)data) = rt;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_CONFIG_PARSE_ENUM(config_parse_dhcp_use_domains, dhcp_use_domains, DHCPUseDomains, "Failed to parse DHCP use domains setting");
|
||||
|
||||
static const char* const dhcp_use_domains_table[_DHCP_USE_DOMAINS_MAX] = {
|
||||
|
@ -123,6 +123,7 @@ struct Network {
|
||||
bool dhcp_use_routes;
|
||||
bool dhcp_use_timezone;
|
||||
unsigned dhcp_route_metric;
|
||||
uint32_t dhcp_route_table;
|
||||
|
||||
/* DHCP Server Support */
|
||||
bool dhcp_server;
|
||||
@ -166,6 +167,7 @@ struct Network {
|
||||
|
||||
bool ipv6_accept_ra_use_dns;
|
||||
DHCPUseDomains ipv6_accept_ra_use_domains;
|
||||
uint32_t ipv6_accept_ra_route_table;
|
||||
|
||||
union in_addr_union ipv6_token;
|
||||
IPv6PrivacyExtensions ipv6_privacy_extensions;
|
||||
@ -228,6 +230,7 @@ int config_parse_dhcp_server_ntp(const char *unit, const char *filename, unsigne
|
||||
int config_parse_dnssec_negative_trust_anchors(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);
|
||||
int config_parse_dhcp_use_domains(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);
|
||||
int config_parse_lldp_mode(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);
|
||||
int config_parse_dhcp_route_table(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);
|
||||
|
||||
/* Legacy IPv4LL support */
|
||||
int config_parse_ipv4ll(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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user