Compare commits

...

2 Commits

Author SHA1 Message Date
Yu Watanabe bf2334c054 udev: add {Receive,Transmit}ChecksumOffload= settings
Closes #14661.
2020-02-03 12:31:31 +09:00
Naïm Favier 53e1ba280f
network: add SuppressPrefixLength option to RoutingPolicyRule (#14736)
Closes #14724.
2020-02-03 08:25:48 +09:00
14 changed files with 387 additions and 255 deletions

View File

@ -612,6 +612,20 @@
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><varname>ReceiveChecksumOffload=</varname></term>
<listitem>
<para>Takes a boolean. If set to true, the hardware offload for checksumming of ingress
network packets is enabled. When unset, the kernel's default will be used.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>TransmitChecksumOffload=</varname></term>
<listitem>
<para>Takes a boolean. If set to true, the hardware offload for checksumming of egress
network packets is enabled. When unset, the kernel's default will be used.</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><varname>TCPSegmentationOffload=</varname></term> <term><varname>TCPSegmentationOffload=</varname></term>
<listitem> <listitem>
@ -633,7 +647,7 @@
When unset, the kernel's default will be used.</para> When unset, the kernel's default will be used.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><varname>GenericReceiveOffload=</varname></term> <term><varname>GenericReceiveOffload=</varname></term>
<listitem> <listitem>
<para>Takes a boolean. If set to true, the Generic Receive Offload (GRO) is enabled. <para>Takes a boolean. If set to true, the Generic Receive Offload (GRO) is enabled.

View File

@ -1071,7 +1071,7 @@
<varlistentry> <varlistentry>
<term><varname>InvertRule=</varname></term> <term><varname>InvertRule=</varname></term>
<listitem> <listitem>
<para>A boolean. Specifies whether the rule to be inverted. Defaults to false.</para> <para>A boolean. Specifies whether the rule is to be inverted. Defaults to false.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
@ -1091,6 +1091,14 @@
unset.</para> unset.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><varname>SuppressPrefixLength=</varname></term>
<listitem>
<para>Takes a number <replaceable>N</replaceable> in the range 0-128 and rejects routing
decisions that have a prefix length of <replaceable>N</replaceable> or less. Defaults to
unset.</para>
</listitem>
</varlistentry>
</variablelist> </variablelist>
</refsect1> </refsect1>

View File

@ -698,6 +698,22 @@ int parse_ip_port_range(const char *s, uint16_t *low, uint16_t *high) {
return 0; return 0;
} }
int parse_ip_prefix_length(const char *s, int *ret) {
unsigned l;
int r;
r = safe_atou(s, &l);
if (r < 0)
return r;
if (l > 128)
return -ERANGE;
*ret = (int) l;
return 0;
}
int parse_dev(const char *s, dev_t *ret) { int parse_dev(const char *s, dev_t *ret) {
const char *major; const char *major;
unsigned x, y; unsigned x, y;

View File

@ -112,4 +112,6 @@ int parse_nice(const char *p, int *ret);
int parse_ip_port(const char *s, uint16_t *ret); int parse_ip_port(const char *s, uint16_t *ret);
int parse_ip_port_range(const char *s, uint16_t *low, uint16_t *high); int parse_ip_port_range(const char *s, uint16_t *low, uint16_t *high);
int parse_ip_prefix_length(const char *s, int *ret);
int parse_oom_score_adjust(const char *s, int *ret); int parse_oom_score_adjust(const char *s, int *ret);

View File

@ -962,6 +962,7 @@ int manager_rtnl_process_rule(sd_netlink *rtnl, sd_netlink_message *message, voi
_cleanup_free_ char *from = NULL, *to = NULL; _cleanup_free_ char *from = NULL, *to = NULL;
RoutingPolicyRule *rule = NULL; RoutingPolicyRule *rule = NULL;
const char *iif = NULL, *oif = NULL; const char *iif = NULL, *oif = NULL;
uint32_t suppress_prefixlen;
Manager *m = userdata; Manager *m = userdata;
unsigned flags; unsigned flags;
uint16_t type; uint16_t type;
@ -1144,6 +1145,14 @@ int manager_rtnl_process_rule(sd_netlink *rtnl, sd_netlink_message *message, voi
return 0; return 0;
} }
r = sd_netlink_message_read_u32(message, FRA_SUPPRESS_PREFIXLEN, &suppress_prefixlen);
if (r < 0 && r != -ENODATA) {
log_warning_errno(r, "rtnl: could not get FRA_SUPPRESS_PREFIXLEN attribute, ignoring: %m");
return 0;
}
if (r >= 0)
tmp->suppress_prefixlen = (int) suppress_prefixlen;
(void) routing_policy_rule_get(m, tmp, &rule); (void) routing_policy_rule_get(m, tmp, &rule);
if (DEBUG_LOGGING) { if (DEBUG_LOGGING) {

View File

@ -27,229 +27,230 @@ struct ConfigPerfItem;
%struct-type %struct-type
%includes %includes
%% %%
Match.MACAddress, config_parse_hwaddrs, 0, offsetof(Network, match_mac) Match.MACAddress, config_parse_hwaddrs, 0, offsetof(Network, match_mac)
Match.PermanentMACAddress, config_parse_hwaddrs, 0, offsetof(Network, match_permanent_mac) Match.PermanentMACAddress, config_parse_hwaddrs, 0, offsetof(Network, match_permanent_mac)
Match.Path, config_parse_match_strv, 0, offsetof(Network, match_path) Match.Path, config_parse_match_strv, 0, offsetof(Network, match_path)
Match.Driver, config_parse_match_strv, 0, offsetof(Network, match_driver) Match.Driver, config_parse_match_strv, 0, offsetof(Network, match_driver)
Match.Type, config_parse_match_strv, 0, offsetof(Network, match_type) Match.Type, config_parse_match_strv, 0, offsetof(Network, match_type)
Match.WLANInterfaceType, config_parse_match_strv, 0, offsetof(Network, match_wlan_iftype) Match.WLANInterfaceType, config_parse_match_strv, 0, offsetof(Network, match_wlan_iftype)
Match.SSID, config_parse_match_strv, 0, offsetof(Network, match_ssid) Match.SSID, config_parse_match_strv, 0, offsetof(Network, match_ssid)
Match.BSSID, config_parse_hwaddrs, 0, offsetof(Network, match_bssid) Match.BSSID, config_parse_hwaddrs, 0, offsetof(Network, match_bssid)
Match.Name, config_parse_match_ifnames, 1, offsetof(Network, match_name) Match.Name, config_parse_match_ifnames, 1, offsetof(Network, match_name)
Match.Property, config_parse_match_property, 0, offsetof(Network, match_property) Match.Property, config_parse_match_property, 0, offsetof(Network, match_property)
Match.Host, config_parse_net_condition, CONDITION_HOST, offsetof(Network, conditions) Match.Host, config_parse_net_condition, CONDITION_HOST, offsetof(Network, conditions)
Match.Virtualization, config_parse_net_condition, CONDITION_VIRTUALIZATION, offsetof(Network, conditions) Match.Virtualization, config_parse_net_condition, CONDITION_VIRTUALIZATION, offsetof(Network, conditions)
Match.KernelCommandLine, config_parse_net_condition, CONDITION_KERNEL_COMMAND_LINE, offsetof(Network, conditions) Match.KernelCommandLine, config_parse_net_condition, CONDITION_KERNEL_COMMAND_LINE, offsetof(Network, conditions)
Match.KernelVersion, config_parse_net_condition, CONDITION_KERNEL_VERSION, offsetof(Network, conditions) Match.KernelVersion, config_parse_net_condition, CONDITION_KERNEL_VERSION, offsetof(Network, conditions)
Match.Architecture, config_parse_net_condition, CONDITION_ARCHITECTURE, offsetof(Network, conditions) Match.Architecture, config_parse_net_condition, CONDITION_ARCHITECTURE, offsetof(Network, conditions)
Link.MACAddress, config_parse_hwaddr, 0, offsetof(Network, mac) Link.MACAddress, config_parse_hwaddr, 0, offsetof(Network, mac)
Link.MTUBytes, config_parse_mtu, AF_UNSPEC, offsetof(Network, mtu) Link.MTUBytes, config_parse_mtu, AF_UNSPEC, offsetof(Network, mtu)
Link.ARP, config_parse_tristate, 0, offsetof(Network, arp) Link.ARP, config_parse_tristate, 0, offsetof(Network, arp)
Link.Multicast, config_parse_tristate, 0, offsetof(Network, multicast) Link.Multicast, config_parse_tristate, 0, offsetof(Network, multicast)
Link.AllMulticast, config_parse_tristate, 0, offsetof(Network, allmulticast) Link.AllMulticast, config_parse_tristate, 0, offsetof(Network, allmulticast)
Link.Unmanaged, config_parse_bool, 0, offsetof(Network, unmanaged) Link.Unmanaged, config_parse_bool, 0, offsetof(Network, unmanaged)
Link.RequiredForOnline, config_parse_required_for_online, 0, 0 Link.RequiredForOnline, config_parse_required_for_online, 0, 0
Network.Description, config_parse_string, 0, offsetof(Network, description) Network.Description, config_parse_string, 0, offsetof(Network, description)
Network.Bridge, config_parse_ifname, 0, offsetof(Network, bridge_name) Network.Bridge, config_parse_ifname, 0, offsetof(Network, bridge_name)
Network.Bond, config_parse_ifname, 0, offsetof(Network, bond_name) Network.Bond, config_parse_ifname, 0, offsetof(Network, bond_name)
Network.VLAN, config_parse_stacked_netdev, NETDEV_KIND_VLAN, offsetof(Network, stacked_netdev_names) Network.VLAN, config_parse_stacked_netdev, NETDEV_KIND_VLAN, offsetof(Network, stacked_netdev_names)
Network.MACVLAN, config_parse_stacked_netdev, NETDEV_KIND_MACVLAN, offsetof(Network, stacked_netdev_names) Network.MACVLAN, config_parse_stacked_netdev, NETDEV_KIND_MACVLAN, offsetof(Network, stacked_netdev_names)
Network.MACVTAP, config_parse_stacked_netdev, NETDEV_KIND_MACVTAP, offsetof(Network, stacked_netdev_names) Network.MACVTAP, config_parse_stacked_netdev, NETDEV_KIND_MACVTAP, offsetof(Network, stacked_netdev_names)
Network.IPVLAN, config_parse_stacked_netdev, NETDEV_KIND_IPVLAN, offsetof(Network, stacked_netdev_names) Network.IPVLAN, config_parse_stacked_netdev, NETDEV_KIND_IPVLAN, offsetof(Network, stacked_netdev_names)
Network.IPVTAP, config_parse_stacked_netdev, NETDEV_KIND_IPVTAP, offsetof(Network, stacked_netdev_names) Network.IPVTAP, config_parse_stacked_netdev, NETDEV_KIND_IPVTAP, offsetof(Network, stacked_netdev_names)
Network.VXLAN, config_parse_stacked_netdev, NETDEV_KIND_VXLAN, offsetof(Network, stacked_netdev_names) Network.VXLAN, config_parse_stacked_netdev, NETDEV_KIND_VXLAN, offsetof(Network, stacked_netdev_names)
Network.L2TP, config_parse_stacked_netdev, NETDEV_KIND_L2TP, offsetof(Network, stacked_netdev_names) Network.L2TP, config_parse_stacked_netdev, NETDEV_KIND_L2TP, offsetof(Network, stacked_netdev_names)
Network.MACsec, config_parse_stacked_netdev, NETDEV_KIND_MACSEC, offsetof(Network, stacked_netdev_names) Network.MACsec, config_parse_stacked_netdev, NETDEV_KIND_MACSEC, offsetof(Network, stacked_netdev_names)
Network.Tunnel, config_parse_stacked_netdev, _NETDEV_KIND_TUNNEL, offsetof(Network, stacked_netdev_names) Network.Tunnel, config_parse_stacked_netdev, _NETDEV_KIND_TUNNEL, offsetof(Network, stacked_netdev_names)
Network.Xfrm, config_parse_stacked_netdev, NETDEV_KIND_XFRM, offsetof(Network, stacked_netdev_names) Network.Xfrm, config_parse_stacked_netdev, NETDEV_KIND_XFRM, offsetof(Network, stacked_netdev_names)
Network.VRF, config_parse_ifname, 0, offsetof(Network, vrf_name) Network.VRF, config_parse_ifname, 0, offsetof(Network, vrf_name)
Network.DHCP, config_parse_dhcp, 0, offsetof(Network, dhcp) Network.DHCP, config_parse_dhcp, 0, offsetof(Network, dhcp)
Network.DHCPServer, config_parse_bool, 0, offsetof(Network, dhcp_server) Network.DHCPServer, config_parse_bool, 0, offsetof(Network, dhcp_server)
Network.LinkLocalAddressing, config_parse_link_local_address_family, 0, offsetof(Network, link_local) Network.LinkLocalAddressing, config_parse_link_local_address_family, 0, offsetof(Network, link_local)
Network.IPv4LLRoute, config_parse_bool, 0, offsetof(Network, ipv4ll_route) Network.IPv4LLRoute, config_parse_bool, 0, offsetof(Network, ipv4ll_route)
Network.DefaultRouteOnDevice, config_parse_bool, 0, offsetof(Network, default_route_on_device) Network.DefaultRouteOnDevice, config_parse_bool, 0, offsetof(Network, default_route_on_device)
Network.IPv6Token, config_parse_ipv6token, 0, offsetof(Network, ipv6_token) Network.IPv6Token, config_parse_ipv6token, 0, offsetof(Network, ipv6_token)
Network.LLDP, config_parse_lldp_mode, 0, offsetof(Network, lldp_mode) Network.LLDP, config_parse_lldp_mode, 0, offsetof(Network, lldp_mode)
Network.EmitLLDP, config_parse_lldp_emit, 0, offsetof(Network, lldp_emit) Network.EmitLLDP, config_parse_lldp_emit, 0, offsetof(Network, lldp_emit)
Network.Address, config_parse_address, 0, 0 Network.Address, config_parse_address, 0, 0
Network.Gateway, config_parse_gateway, 0, 0 Network.Gateway, config_parse_gateway, 0, 0
Network.Domains, config_parse_domains, 0, 0 Network.Domains, config_parse_domains, 0, 0
Network.DNS, config_parse_dns, 0, 0 Network.DNS, config_parse_dns, 0, 0
Network.DNSDefaultRoute, config_parse_tristate, 0, offsetof(Network, dns_default_route) Network.DNSDefaultRoute, config_parse_tristate, 0, offsetof(Network, dns_default_route)
Network.LLMNR, config_parse_resolve_support, 0, offsetof(Network, llmnr) Network.LLMNR, config_parse_resolve_support, 0, offsetof(Network, llmnr)
Network.MulticastDNS, config_parse_resolve_support, 0, offsetof(Network, mdns) Network.MulticastDNS, config_parse_resolve_support, 0, offsetof(Network, mdns)
Network.DNSOverTLS, config_parse_dns_over_tls_mode, 0, offsetof(Network, dns_over_tls_mode) Network.DNSOverTLS, config_parse_dns_over_tls_mode, 0, offsetof(Network, dns_over_tls_mode)
Network.DNSSEC, config_parse_dnssec_mode, 0, offsetof(Network, dnssec_mode) Network.DNSSEC, config_parse_dnssec_mode, 0, offsetof(Network, dnssec_mode)
Network.DNSSECNegativeTrustAnchors, config_parse_dnssec_negative_trust_anchors, 0, 0 Network.DNSSECNegativeTrustAnchors, config_parse_dnssec_negative_trust_anchors, 0, 0
Network.NTP, config_parse_ntp, 0, offsetof(Network, ntp) Network.NTP, config_parse_ntp, 0, offsetof(Network, ntp)
Network.IPForward, config_parse_address_family_with_kernel, 0, offsetof(Network, ip_forward) Network.IPForward, config_parse_address_family_with_kernel, 0, offsetof(Network, ip_forward)
Network.IPMasquerade, config_parse_bool, 0, offsetof(Network, ip_masquerade) Network.IPMasquerade, config_parse_bool, 0, offsetof(Network, ip_masquerade)
Network.IPv6PrivacyExtensions, config_parse_ipv6_privacy_extensions, 0, offsetof(Network, ipv6_privacy_extensions) Network.IPv6PrivacyExtensions, config_parse_ipv6_privacy_extensions, 0, offsetof(Network, ipv6_privacy_extensions)
Network.IPv6AcceptRA, config_parse_tristate, 0, offsetof(Network, ipv6_accept_ra) Network.IPv6AcceptRA, config_parse_tristate, 0, offsetof(Network, ipv6_accept_ra)
Network.IPv6AcceptRouterAdvertisements, config_parse_tristate, 0, offsetof(Network, ipv6_accept_ra) Network.IPv6AcceptRouterAdvertisements, config_parse_tristate, 0, offsetof(Network, ipv6_accept_ra)
Network.IPv6DuplicateAddressDetection, config_parse_int, 0, offsetof(Network, ipv6_dad_transmits) Network.IPv6DuplicateAddressDetection, config_parse_int, 0, offsetof(Network, ipv6_dad_transmits)
Network.IPv6HopLimit, config_parse_int, 0, offsetof(Network, ipv6_hop_limit) Network.IPv6HopLimit, config_parse_int, 0, offsetof(Network, ipv6_hop_limit)
Network.IPv6ProxyNDP, config_parse_tristate, 0, offsetof(Network, ipv6_proxy_ndp) Network.IPv6ProxyNDP, config_parse_tristate, 0, offsetof(Network, ipv6_proxy_ndp)
Network.IPv6MTUBytes, config_parse_mtu, AF_INET6, offsetof(Network, ipv6_mtu) Network.IPv6MTUBytes, config_parse_mtu, AF_INET6, offsetof(Network, ipv6_mtu)
Network.ActiveSlave, config_parse_bool, 0, offsetof(Network, active_slave) Network.ActiveSlave, config_parse_bool, 0, offsetof(Network, active_slave)
Network.PrimarySlave, config_parse_bool, 0, offsetof(Network, primary_slave) Network.PrimarySlave, config_parse_bool, 0, offsetof(Network, primary_slave)
Network.IPv4ProxyARP, config_parse_tristate, 0, offsetof(Network, proxy_arp) Network.IPv4ProxyARP, config_parse_tristate, 0, offsetof(Network, proxy_arp)
Network.ProxyARP, config_parse_tristate, 0, offsetof(Network, proxy_arp) Network.ProxyARP, config_parse_tristate, 0, offsetof(Network, proxy_arp)
Network.IPv6ProxyNDPAddress, config_parse_ipv6_proxy_ndp_address, 0, 0 Network.IPv6ProxyNDPAddress, config_parse_ipv6_proxy_ndp_address, 0, 0
Network.BindCarrier, config_parse_strv, 0, offsetof(Network, bind_carrier) Network.BindCarrier, config_parse_strv, 0, offsetof(Network, bind_carrier)
Network.ConfigureWithoutCarrier, config_parse_bool, 0, offsetof(Network, configure_without_carrier) Network.ConfigureWithoutCarrier, config_parse_bool, 0, offsetof(Network, configure_without_carrier)
Network.IgnoreCarrierLoss, config_parse_bool, 0, offsetof(Network, ignore_carrier_loss) Network.IgnoreCarrierLoss, config_parse_bool, 0, offsetof(Network, ignore_carrier_loss)
Network.KeepConfiguration, config_parse_keep_configuration, 0, offsetof(Network, keep_configuration) Network.KeepConfiguration, config_parse_keep_configuration, 0, offsetof(Network, keep_configuration)
Address.Address, config_parse_address, 0, 0 Address.Address, config_parse_address, 0, 0
Address.Peer, config_parse_address, 0, 0 Address.Peer, config_parse_address, 0, 0
Address.Broadcast, config_parse_broadcast, 0, 0 Address.Broadcast, config_parse_broadcast, 0, 0
Address.Label, config_parse_label, 0, 0 Address.Label, config_parse_label, 0, 0
Address.PreferredLifetime, config_parse_lifetime, 0, 0 Address.PreferredLifetime, config_parse_lifetime, 0, 0
Address.HomeAddress, config_parse_address_flags, 0, 0 Address.HomeAddress, config_parse_address_flags, 0, 0
Address.ManageTemporaryAddress, config_parse_address_flags, 0, 0 Address.ManageTemporaryAddress, config_parse_address_flags, 0, 0
Address.PrefixRoute, config_parse_address_flags, 0, 0 /* deprecated */ Address.PrefixRoute, config_parse_address_flags, 0, 0 /* deprecated */
Address.AddPrefixRoute, config_parse_address_flags, 0, 0 Address.AddPrefixRoute, config_parse_address_flags, 0, 0
Address.AutoJoin, config_parse_address_flags, 0, 0 Address.AutoJoin, config_parse_address_flags, 0, 0
Address.DuplicateAddressDetection, config_parse_duplicate_address_detection, 0, 0 Address.DuplicateAddressDetection, config_parse_duplicate_address_detection, 0, 0
Address.Scope, config_parse_address_scope, 0, 0 Address.Scope, config_parse_address_scope, 0, 0
IPv6AddressLabel.Prefix, config_parse_address_label_prefix, 0, 0 IPv6AddressLabel.Prefix, config_parse_address_label_prefix, 0, 0
IPv6AddressLabel.Label, config_parse_address_label, 0, 0 IPv6AddressLabel.Label, config_parse_address_label, 0, 0
Neighbor.Address, config_parse_neighbor_address, 0, 0 Neighbor.Address, config_parse_neighbor_address, 0, 0
Neighbor.LinkLayerAddress, config_parse_neighbor_lladdr, 0, 0 Neighbor.LinkLayerAddress, config_parse_neighbor_lladdr, 0, 0
Neighbor.MACAddress, config_parse_neighbor_hwaddr, 0, 0 /* deprecated */ Neighbor.MACAddress, config_parse_neighbor_hwaddr, 0, 0 /* deprecated */
RoutingPolicyRule.TypeOfService, config_parse_routing_policy_rule_tos, 0, 0 RoutingPolicyRule.TypeOfService, config_parse_routing_policy_rule_tos, 0, 0
RoutingPolicyRule.Priority, config_parse_routing_policy_rule_priority, 0, 0 RoutingPolicyRule.Priority, config_parse_routing_policy_rule_priority, 0, 0
RoutingPolicyRule.Table, config_parse_routing_policy_rule_table, 0, 0 RoutingPolicyRule.Table, config_parse_routing_policy_rule_table, 0, 0
RoutingPolicyRule.FirewallMark, config_parse_routing_policy_rule_fwmark_mask, 0, 0 RoutingPolicyRule.FirewallMark, config_parse_routing_policy_rule_fwmark_mask, 0, 0
RoutingPolicyRule.From, config_parse_routing_policy_rule_prefix, 0, 0 RoutingPolicyRule.From, config_parse_routing_policy_rule_prefix, 0, 0
RoutingPolicyRule.To, config_parse_routing_policy_rule_prefix, 0, 0 RoutingPolicyRule.To, config_parse_routing_policy_rule_prefix, 0, 0
RoutingPolicyRule.IncomingInterface, config_parse_routing_policy_rule_device, 0, 0 RoutingPolicyRule.IncomingInterface, config_parse_routing_policy_rule_device, 0, 0
RoutingPolicyRule.OutgoingInterface, config_parse_routing_policy_rule_device, 0, 0 RoutingPolicyRule.OutgoingInterface, config_parse_routing_policy_rule_device, 0, 0
RoutingPolicyRule.IPProtocol, config_parse_routing_policy_rule_ip_protocol, 0, 0 RoutingPolicyRule.IPProtocol, config_parse_routing_policy_rule_ip_protocol, 0, 0
RoutingPolicyRule.SourcePort, config_parse_routing_policy_rule_port_range, 0, 0 RoutingPolicyRule.SourcePort, config_parse_routing_policy_rule_port_range, 0, 0
RoutingPolicyRule.DestinationPort, config_parse_routing_policy_rule_port_range, 0, 0 RoutingPolicyRule.DestinationPort, config_parse_routing_policy_rule_port_range, 0, 0
RoutingPolicyRule.InvertRule, config_parse_routing_policy_rule_invert, 0, 0 RoutingPolicyRule.InvertRule, config_parse_routing_policy_rule_invert, 0, 0
RoutingPolicyRule.Family, config_parse_routing_policy_rule_family, 0, 0 RoutingPolicyRule.Family, config_parse_routing_policy_rule_family, 0, 0
RoutingPolicyRule.User, config_parse_routing_policy_rule_uid_range, 0, 0 RoutingPolicyRule.User, config_parse_routing_policy_rule_uid_range, 0, 0
Route.Gateway, config_parse_gateway, 0, 0 RoutingPolicyRule.SuppressPrefixLength, config_parse_routing_policy_rule_suppress_prefixlen, 0, 0
Route.Destination, config_parse_destination, 0, 0 Route.Gateway, config_parse_gateway, 0, 0
Route.Source, config_parse_destination, 0, 0 Route.Destination, config_parse_destination, 0, 0
Route.Metric, config_parse_route_priority, 0, 0 Route.Source, config_parse_destination, 0, 0
Route.Scope, config_parse_route_scope, 0, 0 Route.Metric, config_parse_route_priority, 0, 0
Route.PreferredSource, config_parse_preferred_src, 0, 0 Route.Scope, config_parse_route_scope, 0, 0
Route.Table, config_parse_route_table, 0, 0 Route.PreferredSource, config_parse_preferred_src, 0, 0
Route.MTUBytes, config_parse_route_mtu, AF_UNSPEC, 0 Route.Table, config_parse_route_table, 0, 0
Route.GatewayOnLink, config_parse_gateway_onlink, 0, 0 Route.MTUBytes, config_parse_route_mtu, AF_UNSPEC, 0
Route.GatewayOnlink, config_parse_gateway_onlink, 0, 0 Route.GatewayOnLink, config_parse_gateway_onlink, 0, 0
Route.IPv6Preference, config_parse_ipv6_route_preference, 0, 0 Route.GatewayOnlink, config_parse_gateway_onlink, 0, 0
Route.Protocol, config_parse_route_protocol, 0, 0 Route.IPv6Preference, config_parse_ipv6_route_preference, 0, 0
Route.Type, config_parse_route_type, 0, 0 Route.Protocol, config_parse_route_protocol, 0, 0
Route.InitialCongestionWindow, config_parse_tcp_window, 0, 0 Route.Type, config_parse_route_type, 0, 0
Route.InitialAdvertisedReceiveWindow, config_parse_tcp_window, 0, 0 Route.InitialCongestionWindow, config_parse_tcp_window, 0, 0
Route.QuickAck, config_parse_quickack, 0, 0 Route.InitialAdvertisedReceiveWindow, config_parse_tcp_window, 0, 0
Route.FastOpenNoCookie, config_parse_fast_open_no_cookie, 0, 0 Route.QuickAck, config_parse_quickack, 0, 0
Route.TTLPropagate, config_parse_route_ttl_propagate, 0, 0 Route.FastOpenNoCookie, config_parse_fast_open_no_cookie, 0, 0
Route.MultiPathRoute, config_parse_multipath_route, 0, 0 Route.TTLPropagate, config_parse_route_ttl_propagate, 0, 0
NextHop.Id, config_parse_nexthop_id, 0, 0 Route.MultiPathRoute, config_parse_multipath_route, 0, 0
NextHop.Gateway, config_parse_nexthop_gateway, 0, 0 NextHop.Id, config_parse_nexthop_id, 0, 0
DHCPv4.ClientIdentifier, config_parse_dhcp_client_identifier, 0, offsetof(Network, dhcp_client_identifier) NextHop.Gateway, config_parse_nexthop_gateway, 0, 0
DHCPv4.UseDNS, config_parse_bool, 0, offsetof(Network, dhcp_use_dns) DHCPv4.ClientIdentifier, config_parse_dhcp_client_identifier, 0, offsetof(Network, dhcp_client_identifier)
DHCPv4.RoutesToDNS, config_parse_bool, 0, offsetof(Network, dhcp_routes_to_dns) DHCPv4.UseDNS, config_parse_bool, 0, offsetof(Network, dhcp_use_dns)
DHCPv4.UseNTP, config_parse_bool, 0, offsetof(Network, dhcp_use_ntp) DHCPv4.RoutesToDNS, config_parse_bool, 0, offsetof(Network, dhcp_routes_to_dns)
DHCPv4.UseSIP, config_parse_bool, 0, offsetof(Network, dhcp_use_sip) DHCPv4.UseNTP, config_parse_bool, 0, offsetof(Network, dhcp_use_ntp)
DHCPv4.UseMTU, config_parse_bool, 0, offsetof(Network, dhcp_use_mtu) DHCPv4.UseSIP, config_parse_bool, 0, offsetof(Network, dhcp_use_sip)
DHCPv4.UseHostname, config_parse_bool, 0, offsetof(Network, dhcp_use_hostname) DHCPv4.UseMTU, config_parse_bool, 0, offsetof(Network, dhcp_use_mtu)
DHCPv4.UseDomains, config_parse_dhcp_use_domains, 0, offsetof(Network, dhcp_use_domains) DHCPv4.UseHostname, config_parse_bool, 0, offsetof(Network, dhcp_use_hostname)
DHCPv4.UseRoutes, config_parse_bool, 0, offsetof(Network, dhcp_use_routes) DHCPv4.UseDomains, config_parse_dhcp_use_domains, 0, offsetof(Network, dhcp_use_domains)
DHCPv4.RequestOptions, config_parse_dhcp_request_options, 0, 0 DHCPv4.UseRoutes, config_parse_bool, 0, offsetof(Network, dhcp_use_routes)
DHCPv4.Anonymize, config_parse_bool, 0, offsetof(Network, dhcp_anonymize) DHCPv4.RequestOptions, config_parse_dhcp_request_options, 0, 0
DHCPv4.SendHostname, config_parse_bool, 0, offsetof(Network, dhcp_send_hostname) DHCPv4.Anonymize, config_parse_bool, 0, offsetof(Network, dhcp_anonymize)
DHCPv4.Hostname, config_parse_hostname, 0, offsetof(Network, dhcp_hostname) DHCPv4.SendHostname, config_parse_bool, 0, offsetof(Network, dhcp_send_hostname)
DHCPv4.RequestBroadcast, config_parse_bool, 0, offsetof(Network, dhcp_broadcast) DHCPv4.Hostname, config_parse_hostname, 0, offsetof(Network, dhcp_hostname)
DHCPv4.VendorClassIdentifier, config_parse_string, 0, offsetof(Network, dhcp_vendor_class_identifier) DHCPv4.RequestBroadcast, config_parse_bool, 0, offsetof(Network, dhcp_broadcast)
DHCPv4.MaxAttempts, config_parse_dhcp_max_attempts, 0, 0 DHCPv4.VendorClassIdentifier, config_parse_string, 0, offsetof(Network, dhcp_vendor_class_identifier)
DHCPv4.UserClass, config_parse_dhcp_user_class, 0, offsetof(Network, dhcp_user_class) DHCPv4.MaxAttempts, config_parse_dhcp_max_attempts, 0, 0
DHCPv4.DUIDType, config_parse_duid_type, 0, offsetof(Network, duid) DHCPv4.UserClass, config_parse_dhcp_user_class, 0, offsetof(Network, dhcp_user_class)
DHCPv4.DUIDRawData, config_parse_duid_rawdata, 0, offsetof(Network, duid) DHCPv4.DUIDType, config_parse_duid_type, 0, offsetof(Network, duid)
DHCPv4.RouteMetric, config_parse_unsigned, 0, offsetof(Network, dhcp_route_metric) DHCPv4.DUIDRawData, config_parse_duid_rawdata, 0, offsetof(Network, duid)
DHCPv4.RouteTable, config_parse_section_route_table, 0, 0 DHCPv4.RouteMetric, config_parse_unsigned, 0, offsetof(Network, dhcp_route_metric)
DHCPv4.UseTimezone, config_parse_bool, 0, offsetof(Network, dhcp_use_timezone) DHCPv4.RouteTable, config_parse_section_route_table, 0, 0
DHCPv4.IAID, config_parse_iaid, 0, 0 DHCPv4.UseTimezone, config_parse_bool, 0, offsetof(Network, dhcp_use_timezone)
DHCPv4.ListenPort, config_parse_uint16, 0, offsetof(Network, dhcp_client_port) DHCPv4.IAID, config_parse_iaid, 0, 0
DHCPv4.SendRelease, config_parse_bool, 0, offsetof(Network, dhcp_send_release) DHCPv4.ListenPort, config_parse_uint16, 0, offsetof(Network, dhcp_client_port)
DHCPv4.SendDecline, config_parse_bool, 0, offsetof(Network, dhcp_send_decline) DHCPv4.SendRelease, config_parse_bool, 0, offsetof(Network, dhcp_send_release)
DHCPv4.BlackList, config_parse_dhcp_black_listed_ip_address, 0, 0 DHCPv4.SendDecline, config_parse_bool, 0, offsetof(Network, dhcp_send_decline)
DHCPv4.IPServiceType, config_parse_ip_service_type, 0, offsetof(Network, ip_service_type) DHCPv4.BlackList, config_parse_dhcp_black_listed_ip_address, 0, 0
DHCPv4.SendOption, config_parse_dhcp_send_option, 0, offsetof(Network, dhcp_client_send_options) DHCPv4.IPServiceType, config_parse_ip_service_type, 0, offsetof(Network, ip_service_type)
DHCPv4.RouteMTUBytes, config_parse_mtu, AF_INET, offsetof(Network, dhcp_route_mtu) DHCPv4.SendOption, config_parse_dhcp_send_option, 0, offsetof(Network, dhcp_client_send_options)
DHCPv6.UseDNS, config_parse_bool, 0, offsetof(Network, dhcp6_use_dns) DHCPv4.RouteMTUBytes, config_parse_mtu, AF_INET, offsetof(Network, dhcp_route_mtu)
DHCPv6.UseNTP, config_parse_bool, 0, offsetof(Network, dhcp6_use_ntp) DHCPv6.UseDNS, config_parse_bool, 0, offsetof(Network, dhcp6_use_dns)
DHCPv6.RapidCommit, config_parse_bool, 0, offsetof(Network, rapid_commit) DHCPv6.UseNTP, config_parse_bool, 0, offsetof(Network, dhcp6_use_ntp)
DHCPv6.ForceDHCPv6PDOtherInformation, config_parse_bool, 0, offsetof(Network, dhcp6_force_pd_other_information) DHCPv6.RapidCommit, config_parse_bool, 0, offsetof(Network, rapid_commit)
DHCPv6.PrefixDelegationHint, config_parse_dhcp6_pd_hint, 0, 0 DHCPv6.ForceDHCPv6PDOtherInformation, config_parse_bool, 0, offsetof(Network, dhcp6_force_pd_other_information)
IPv6AcceptRA.UseAutonomousPrefix, config_parse_bool, 0, offsetof(Network, ipv6_accept_ra_use_autonomous_prefix) DHCPv6.PrefixDelegationHint, config_parse_dhcp6_pd_hint, 0, 0
IPv6AcceptRA.UseOnLinkPrefix, config_parse_bool, 0, offsetof(Network, ipv6_accept_ra_use_onlink_prefix) IPv6AcceptRA.UseAutonomousPrefix, config_parse_bool, 0, offsetof(Network, ipv6_accept_ra_use_autonomous_prefix)
IPv6AcceptRA.UseDNS, config_parse_bool, 0, offsetof(Network, ipv6_accept_ra_use_dns) IPv6AcceptRA.UseOnLinkPrefix, config_parse_bool, 0, offsetof(Network, ipv6_accept_ra_use_onlink_prefix)
IPv6AcceptRA.UseDomains, config_parse_dhcp_use_domains, 0, offsetof(Network, ipv6_accept_ra_use_domains) IPv6AcceptRA.UseDNS, config_parse_bool, 0, offsetof(Network, ipv6_accept_ra_use_dns)
IPv6AcceptRA.RouteTable, config_parse_section_route_table, 0, 0 IPv6AcceptRA.UseDomains, config_parse_dhcp_use_domains, 0, offsetof(Network, ipv6_accept_ra_use_domains)
IPv6AcceptRA.BlackList, config_parse_ndisc_black_listed_prefix, 0, 0 IPv6AcceptRA.RouteTable, config_parse_section_route_table, 0, 0
DHCPServer.MaxLeaseTimeSec, config_parse_sec, 0, offsetof(Network, dhcp_server_max_lease_time_usec) IPv6AcceptRA.BlackList, config_parse_ndisc_black_listed_prefix, 0, 0
DHCPServer.DefaultLeaseTimeSec, config_parse_sec, 0, offsetof(Network, dhcp_server_default_lease_time_usec) DHCPServer.MaxLeaseTimeSec, config_parse_sec, 0, offsetof(Network, dhcp_server_max_lease_time_usec)
DHCPServer.EmitDNS, config_parse_bool, 0, offsetof(Network, dhcp_server_emit_dns) DHCPServer.DefaultLeaseTimeSec, config_parse_sec, 0, offsetof(Network, dhcp_server_default_lease_time_usec)
DHCPServer.DNS, config_parse_dhcp_server_dns, 0, 0 DHCPServer.EmitDNS, config_parse_bool, 0, offsetof(Network, dhcp_server_emit_dns)
DHCPServer.EmitNTP, config_parse_bool, 0, offsetof(Network, dhcp_server_emit_ntp) DHCPServer.DNS, config_parse_dhcp_server_dns, 0, 0
DHCPServer.NTP, config_parse_dhcp_server_ntp, 0, 0 DHCPServer.EmitNTP, config_parse_bool, 0, offsetof(Network, dhcp_server_emit_ntp)
DHCPServer.EmitSIP, config_parse_bool, 0, offsetof(Network, dhcp_server_emit_sip) DHCPServer.NTP, config_parse_dhcp_server_ntp, 0, 0
DHCPServer.SIP, config_parse_dhcp_server_sip, 0, 0 DHCPServer.EmitSIP, config_parse_bool, 0, offsetof(Network, dhcp_server_emit_sip)
DHCPServer.EmitRouter, config_parse_bool, 0, offsetof(Network, dhcp_server_emit_router) DHCPServer.SIP, config_parse_dhcp_server_sip, 0, 0
DHCPServer.EmitTimezone, config_parse_bool, 0, offsetof(Network, dhcp_server_emit_timezone) DHCPServer.EmitRouter, config_parse_bool, 0, offsetof(Network, dhcp_server_emit_router)
DHCPServer.Timezone, config_parse_timezone, 0, offsetof(Network, dhcp_server_timezone) DHCPServer.EmitTimezone, config_parse_bool, 0, offsetof(Network, dhcp_server_emit_timezone)
DHCPServer.PoolOffset, config_parse_uint32, 0, offsetof(Network, dhcp_server_pool_offset) DHCPServer.Timezone, config_parse_timezone, 0, offsetof(Network, dhcp_server_timezone)
DHCPServer.PoolSize, config_parse_uint32, 0, offsetof(Network, dhcp_server_pool_size) DHCPServer.PoolOffset, config_parse_uint32, 0, offsetof(Network, dhcp_server_pool_offset)
DHCPServer.SendOption, config_parse_dhcp_send_option, 0, offsetof(Network, dhcp_server_send_options) DHCPServer.PoolSize, config_parse_uint32, 0, offsetof(Network, dhcp_server_pool_size)
Bridge.Cost, config_parse_uint32, 0, offsetof(Network, cost) DHCPServer.SendOption, config_parse_dhcp_send_option, 0, offsetof(Network, dhcp_server_send_options)
Bridge.UseBPDU, config_parse_tristate, 0, offsetof(Network, use_bpdu) Bridge.Cost, config_parse_uint32, 0, offsetof(Network, cost)
Bridge.HairPin, config_parse_tristate, 0, offsetof(Network, hairpin) Bridge.UseBPDU, config_parse_tristate, 0, offsetof(Network, use_bpdu)
Bridge.FastLeave, config_parse_tristate, 0, offsetof(Network, fast_leave) Bridge.HairPin, config_parse_tristate, 0, offsetof(Network, hairpin)
Bridge.AllowPortToBeRoot, config_parse_tristate, 0, offsetof(Network, allow_port_to_be_root) Bridge.FastLeave, config_parse_tristate, 0, offsetof(Network, fast_leave)
Bridge.UnicastFlood, config_parse_tristate, 0, offsetof(Network, unicast_flood) Bridge.AllowPortToBeRoot, config_parse_tristate, 0, offsetof(Network, allow_port_to_be_root)
Bridge.MulticastFlood, config_parse_tristate, 0, offsetof(Network, multicast_flood) Bridge.UnicastFlood, config_parse_tristate, 0, offsetof(Network, unicast_flood)
Bridge.MulticastToUnicast, config_parse_tristate, 0, offsetof(Network, multicast_to_unicast) Bridge.MulticastFlood, config_parse_tristate, 0, offsetof(Network, multicast_flood)
Bridge.NeighborSuppression, config_parse_tristate, 0, offsetof(Network, neighbor_suppression) Bridge.MulticastToUnicast, config_parse_tristate, 0, offsetof(Network, multicast_to_unicast)
Bridge.Learning, config_parse_tristate, 0, offsetof(Network, learning) Bridge.NeighborSuppression, config_parse_tristate, 0, offsetof(Network, neighbor_suppression)
Bridge.ProxyARP, config_parse_tristate, 0, offsetof(Network, bridge_proxy_arp) Bridge.Learning, config_parse_tristate, 0, offsetof(Network, learning)
Bridge.ProxyARPWiFi, config_parse_tristate, 0, offsetof(Network, bridge_proxy_arp_wifi) Bridge.ProxyARP, config_parse_tristate, 0, offsetof(Network, bridge_proxy_arp)
Bridge.Priority, config_parse_bridge_port_priority, 0, offsetof(Network, priority) Bridge.ProxyARPWiFi, config_parse_tristate, 0, offsetof(Network, bridge_proxy_arp_wifi)
Bridge.MulticastRouter, config_parse_multicast_router, 0, offsetof(Network, multicast_router) Bridge.Priority, config_parse_bridge_port_priority, 0, offsetof(Network, priority)
BridgeFDB.MACAddress, config_parse_fdb_hwaddr, 0, 0 Bridge.MulticastRouter, config_parse_multicast_router, 0, offsetof(Network, multicast_router)
BridgeFDB.VLANId, config_parse_fdb_vlan_id, 0, 0 BridgeFDB.MACAddress, config_parse_fdb_hwaddr, 0, 0
BridgeFDB.Destination, config_parse_fdb_destination, 0, 0 BridgeFDB.VLANId, config_parse_fdb_vlan_id, 0, 0
BridgeFDB.VNI, config_parse_fdb_vxlan_vni, 0, 0 BridgeFDB.Destination, config_parse_fdb_destination, 0, 0
BridgeFDB.AssociatedWith, config_parse_fdb_ntf_flags, 0, 0 BridgeFDB.VNI, config_parse_fdb_vxlan_vni, 0, 0
BridgeVLAN.PVID, config_parse_brvlan_pvid, 0, 0 BridgeFDB.AssociatedWith, config_parse_fdb_ntf_flags, 0, 0
BridgeVLAN.VLAN, config_parse_brvlan_vlan, 0, 0 BridgeVLAN.PVID, config_parse_brvlan_pvid, 0, 0
BridgeVLAN.EgressUntagged, config_parse_brvlan_untagged, 0, 0 BridgeVLAN.VLAN, config_parse_brvlan_vlan, 0, 0
Network.IPv6PrefixDelegation, config_parse_router_prefix_delegation, 0, 0 BridgeVLAN.EgressUntagged, config_parse_brvlan_untagged, 0, 0
IPv6PrefixDelegation.RouterLifetimeSec, config_parse_sec, 0, offsetof(Network, router_lifetime_usec) Network.IPv6PrefixDelegation, config_parse_router_prefix_delegation, 0, 0
IPv6PrefixDelegation.Managed, config_parse_bool, 0, offsetof(Network, router_managed) IPv6PrefixDelegation.RouterLifetimeSec, config_parse_sec, 0, offsetof(Network, router_lifetime_usec)
IPv6PrefixDelegation.OtherInformation, config_parse_bool, 0, offsetof(Network, router_other_information) IPv6PrefixDelegation.Managed, config_parse_bool, 0, offsetof(Network, router_managed)
IPv6PrefixDelegation.RouterPreference, config_parse_router_preference, 0, 0 IPv6PrefixDelegation.OtherInformation, config_parse_bool, 0, offsetof(Network, router_other_information)
IPv6PrefixDelegation.EmitDNS, config_parse_bool, 0, offsetof(Network, router_emit_dns) IPv6PrefixDelegation.RouterPreference, config_parse_router_preference, 0, 0
IPv6PrefixDelegation.DNS, config_parse_radv_dns, 0, 0 IPv6PrefixDelegation.EmitDNS, config_parse_bool, 0, offsetof(Network, router_emit_dns)
IPv6PrefixDelegation.EmitDomains, config_parse_bool, 0, offsetof(Network, router_emit_domains) IPv6PrefixDelegation.DNS, config_parse_radv_dns, 0, 0
IPv6PrefixDelegation.Domains, config_parse_radv_search_domains, 0, 0 IPv6PrefixDelegation.EmitDomains, config_parse_bool, 0, offsetof(Network, router_emit_domains)
IPv6PrefixDelegation.DNSLifetimeSec, config_parse_sec, 0, offsetof(Network, router_dns_lifetime_usec) IPv6PrefixDelegation.Domains, config_parse_radv_search_domains, 0, 0
IPv6Prefix.Prefix, config_parse_prefix, 0, 0 IPv6PrefixDelegation.DNSLifetimeSec, config_parse_sec, 0, offsetof(Network, router_dns_lifetime_usec)
IPv6Prefix.OnLink, config_parse_prefix_flags, 0, 0 IPv6Prefix.Prefix, config_parse_prefix, 0, 0
IPv6Prefix.AddressAutoconfiguration, config_parse_prefix_flags, 0, 0 IPv6Prefix.OnLink, config_parse_prefix_flags, 0, 0
IPv6Prefix.ValidLifetimeSec, config_parse_prefix_lifetime, 0, 0 IPv6Prefix.AddressAutoconfiguration, config_parse_prefix_flags, 0, 0
IPv6Prefix.PreferredLifetimeSec, config_parse_prefix_lifetime, 0, 0 IPv6Prefix.ValidLifetimeSec, config_parse_prefix_lifetime, 0, 0
IPv6RoutePrefix.Route, config_parse_route_prefix, 0, 0 IPv6Prefix.PreferredLifetimeSec, config_parse_prefix_lifetime, 0, 0
IPv6RoutePrefix.LifetimeSec, config_parse_route_prefix_lifetime, 0, 0 IPv6RoutePrefix.Route, config_parse_route_prefix, 0, 0
CAN.BitRate, config_parse_si_uint64, 0, offsetof(Network, can_bitrate) IPv6RoutePrefix.LifetimeSec, config_parse_route_prefix_lifetime, 0, 0
CAN.SamplePoint, config_parse_permille, 0, offsetof(Network, can_sample_point) CAN.BitRate, config_parse_si_uint64, 0, offsetof(Network, can_bitrate)
CAN.RestartSec, config_parse_sec, 0, offsetof(Network, can_restart_us) CAN.SamplePoint, config_parse_permille, 0, offsetof(Network, can_sample_point)
CAN.TripleSampling, config_parse_tristate, 0, offsetof(Network, can_triple_sampling) CAN.RestartSec, config_parse_sec, 0, offsetof(Network, can_restart_us)
CAN.TripleSampling, config_parse_tristate, 0, offsetof(Network, can_triple_sampling)
TrafficControlQueueingDiscipline.Parent, config_parse_tc_qdiscs_parent, 0, 0 TrafficControlQueueingDiscipline.Parent, config_parse_tc_qdiscs_parent, 0, 0
TrafficControlQueueingDiscipline.NetworkEmulatorDelaySec, config_parse_tc_network_emulator_delay, 0, 0 TrafficControlQueueingDiscipline.NetworkEmulatorDelaySec, config_parse_tc_network_emulator_delay, 0, 0
TrafficControlQueueingDiscipline.NetworkEmulatorDelayJitterSec, config_parse_tc_network_emulator_delay, 0, 0 TrafficControlQueueingDiscipline.NetworkEmulatorDelayJitterSec, config_parse_tc_network_emulator_delay, 0, 0

View File

@ -30,6 +30,7 @@ int routing_policy_rule_new(RoutingPolicyRule **ret) {
.table = RT_TABLE_MAIN, .table = RT_TABLE_MAIN,
.uid_range.start = UID_INVALID, .uid_range.start = UID_INVALID,
.uid_range.end = UID_INVALID, .uid_range.end = UID_INVALID,
.suppress_prefixlen = -1,
}; };
*ret = rule; *ret = rule;
@ -98,6 +99,7 @@ static int routing_policy_rule_copy(RoutingPolicyRule *dest, RoutingPolicyRule *
dest->sport = src->sport; dest->sport = src->sport;
dest->dport = src->dport; dest->dport = src->dport;
dest->uid_range = src->uid_range; dest->uid_range = src->uid_range;
dest->suppress_prefixlen = src->suppress_prefixlen;
return 0; return 0;
} }
@ -123,6 +125,7 @@ static void routing_policy_rule_hash_func(const RoutingPolicyRule *rule, struct
siphash24_compress(&rule->fwmask, sizeof(rule->fwmask), state); siphash24_compress(&rule->fwmask, sizeof(rule->fwmask), state);
siphash24_compress(&rule->priority, sizeof(rule->priority), state); siphash24_compress(&rule->priority, sizeof(rule->priority), state);
siphash24_compress(&rule->table, sizeof(rule->table), state); siphash24_compress(&rule->table, sizeof(rule->table), state);
siphash24_compress(&rule->suppress_prefixlen, sizeof(rule->suppress_prefixlen), state);
siphash24_compress(&rule->protocol, sizeof(rule->protocol), state); siphash24_compress(&rule->protocol, sizeof(rule->protocol), state);
siphash24_compress(&rule->sport, sizeof(rule->sport), state); siphash24_compress(&rule->sport, sizeof(rule->sport), state);
@ -192,6 +195,10 @@ static int routing_policy_rule_compare_func(const RoutingPolicyRule *a, const Ro
if (r != 0) if (r != 0)
return r; return r;
r = CMP(a->suppress_prefixlen, b->suppress_prefixlen);
if (r != 0)
return r;
r = CMP(a->protocol, b->protocol); r = CMP(a->protocol, b->protocol);
if (r != 0) if (r != 0)
return r; return r;
@ -576,6 +583,12 @@ int routing_policy_rule_configure(RoutingPolicyRule *rule, Link *link, link_netl
return log_link_error_errno(link, r, "Could not append FIB_RULE_INVERT attribute: %m"); return log_link_error_errno(link, r, "Could not append FIB_RULE_INVERT attribute: %m");
} }
if (rule->suppress_prefixlen >= 0) {
r = sd_netlink_message_append_u32(m, FRA_SUPPRESS_PREFIXLEN, (uint32_t) rule->suppress_prefixlen);
if (r < 0)
return log_link_error_errno(link, r, "Could not append FRA_SUPPRESS_PREFIXLEN attribute: %m");
}
rule->link = link; rule->link = link;
r = netlink_call_async(link->manager->rtnl, NULL, m, r = netlink_call_async(link->manager->rtnl, NULL, m,
@ -1114,6 +1127,48 @@ int config_parse_routing_policy_rule_uid_range(
n->uid_range.start = start; n->uid_range.start = start;
n->uid_range.end = end; n->uid_range.end = end;
n = NULL; n = NULL;
return 0;
}
int config_parse_routing_policy_rule_suppress_prefixlen(
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_(routing_policy_rule_free_or_set_invalidp) RoutingPolicyRule *n = NULL;
Network *network = userdata;
int r;
assert(filename);
assert(section);
assert(lvalue);
assert(rvalue);
assert(data);
r = routing_policy_rule_new_static(network, filename, section_line, &n);
if (r < 0)
return r;
r = parse_ip_prefix_length(rvalue, &n->suppress_prefixlen);
if (r == -ERANGE) {
log_syntax(unit, LOG_ERR, filename, line, r, "Prefix length outside of valid range 0-128, ignoring: %s", rvalue);
return 0;
}
if (r < 0) {
log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse RPDB rule suppress_prefixlen, ignoring: %s", rvalue);
return 0;
}
n = NULL;
return 0; return 0;
} }
@ -1239,6 +1294,13 @@ int routing_policy_serialize_rules(Set *rules, FILE *f) {
space = true; space = true;
} }
if (rule->suppress_prefixlen >= 0) {
fprintf(f, "%ssuppress_prefixlen=%d",
space ? " " : "",
rule->suppress_prefixlen);
space = true;
}
fprintf(f, "%stable=%"PRIu32 "\n", fprintf(f, "%stable=%"PRIu32 "\n",
space ? " " : "", space ? " " : "",
rule->table); rule->table);
@ -1338,14 +1400,12 @@ int routing_policy_load_rules(const char *state_file, Set **rules) {
continue; continue;
} }
} else if (streq(a, "fwmark")) { } else if (streq(a, "fwmark")) {
r = parse_fwmark_fwmask(b, &rule->fwmark, &rule->fwmask); r = parse_fwmark_fwmask(b, &rule->fwmark, &rule->fwmask);
if (r < 0) { if (r < 0) {
log_error_errno(r, "Failed to parse RPDB rule firewall mark or mask, ignoring: %s", a); log_error_errno(r, "Failed to parse RPDB rule firewall mark or mask, ignoring: %s", a);
continue; continue;
} }
} else if (streq(a, "iif")) { } else if (streq(a, "iif")) {
if (free_and_strdup(&rule->iif, b) < 0) if (free_and_strdup(&rule->iif, b) < 0)
return log_oom(); return log_oom();
@ -1360,7 +1420,6 @@ int routing_policy_load_rules(const char *state_file, Set **rules) {
continue; continue;
} }
} else if (streq(a, "sourceport")) { } else if (streq(a, "sourceport")) {
r = parse_ip_port_range(b, &low, &high); r = parse_ip_port_range(b, &low, &high);
if (r < 0) { if (r < 0) {
log_error_errno(r, "Invalid routing policy rule source port range, ignoring assignment: '%s'", b); log_error_errno(r, "Invalid routing policy rule source port range, ignoring assignment: '%s'", b);
@ -1369,9 +1428,7 @@ int routing_policy_load_rules(const char *state_file, Set **rules) {
rule->sport.start = low; rule->sport.start = low;
rule->sport.end = high; rule->sport.end = high;
} else if (streq(a, "destinationport")) { } else if (streq(a, "destinationport")) {
r = parse_ip_port_range(b, &low, &high); r = parse_ip_port_range(b, &low, &high);
if (r < 0) { if (r < 0) {
log_error_errno(r, "Invalid routing policy rule destination port range, ignoring assignment: '%s'", b); log_error_errno(r, "Invalid routing policy rule destination port range, ignoring assignment: '%s'", b);
@ -1380,7 +1437,6 @@ int routing_policy_load_rules(const char *state_file, Set **rules) {
rule->dport.start = low; rule->dport.start = low;
rule->dport.end = high; rule->dport.end = high;
} else if (streq(a, "uidrange")) { } else if (streq(a, "uidrange")) {
uid_t lower, upper; uid_t lower, upper;
@ -1392,6 +1448,16 @@ int routing_policy_load_rules(const char *state_file, Set **rules) {
rule->uid_range.start = lower; rule->uid_range.start = lower;
rule->uid_range.end = upper; rule->uid_range.end = upper;
} else if (streq(a, "suppress_prefixlen")) {
r = parse_ip_prefix_length(b, &rule->suppress_prefixlen);
if (r == -ERANGE) {
log_error_errno(r, "Prefix length outside of valid range 0-128, ignoring: %s", b);
continue;
}
if (r < 0) {
log_error_errno(r, "Failed to parse RPDB rule suppress_prefixlen, ignoring: %s", b);
continue;
}
} }
} }

View File

@ -51,6 +51,8 @@ struct RoutingPolicyRule {
struct fib_rule_port_range dport; struct fib_rule_port_range dport;
struct fib_rule_uid_range uid_range; struct fib_rule_uid_range uid_range;
int suppress_prefixlen;
LIST_FIELDS(RoutingPolicyRule, rules); LIST_FIELDS(RoutingPolicyRule, rules);
}; };
@ -81,3 +83,4 @@ CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_ip_protocol);
CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_invert); CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_invert);
CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_family); CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_family);
CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_uid_range); CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_uid_range);
CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_suppress_prefixlen);

View File

@ -50,6 +50,8 @@ DEFINE_STRING_TABLE_LOOKUP(port, NetDevPort);
DEFINE_CONFIG_PARSE_ENUM(config_parse_port, port, NetDevPort, "Failed to parse Port setting"); DEFINE_CONFIG_PARSE_ENUM(config_parse_port, port, NetDevPort, "Failed to parse Port setting");
static const char* const netdev_feature_table[_NET_DEV_FEAT_MAX] = { static const char* const netdev_feature_table[_NET_DEV_FEAT_MAX] = {
[NET_DEV_FEAT_RX] = "rx-checksum",
[NET_DEV_FEAT_TX] = "tx-checksum-", /* The suffix "-" means any feature beginning with "tx-checksum-" */
[NET_DEV_FEAT_GSO] = "tx-generic-segmentation", [NET_DEV_FEAT_GSO] = "tx-generic-segmentation",
[NET_DEV_FEAT_GRO] = "rx-gro", [NET_DEV_FEAT_GRO] = "rx-gro",
[NET_DEV_FEAT_LRO] = "rx-lro", [NET_DEV_FEAT_LRO] = "rx-lro",
@ -498,22 +500,38 @@ static int get_stringset(int ethtool_fd, struct ifreq *ifr, int stringset_id, st
return 0; return 0;
} }
static int find_feature_index(struct ethtool_gstrings *strings, const char *feature) { static int set_features_bit(
unsigned i; const struct ethtool_gstrings *strings,
const char *feature,
bool flag,
struct ethtool_sfeatures *sfeatures) {
bool found = false;
for (i = 0; i < strings->len; i++) { assert(strings);
if (streq((char *) &strings->data[i * ETH_GSTRING_LEN], feature)) assert(feature);
return i; assert(sfeatures);
}
return -ENODATA; for (size_t i = 0; i < strings->len; i++)
if (streq((char *) &strings->data[i * ETH_GSTRING_LEN], feature) ||
(endswith(feature, "-") && startswith((char *) &strings->data[i * ETH_GSTRING_LEN], feature))) {
size_t block, bit;
block = i / 32;
bit = i % 32;
sfeatures->features[block].valid |= 1 << bit;
SET_FLAG(sfeatures->features[block].requested, 1 << bit, flag);
found = true;
}
return found ? 0 : -ENODATA;
} }
int ethtool_set_features(int *ethtool_fd, const char *ifname, int *features) { int ethtool_set_features(int *ethtool_fd, const char *ifname, int *features) {
_cleanup_free_ struct ethtool_gstrings *strings = NULL; _cleanup_free_ struct ethtool_gstrings *strings = NULL;
struct ethtool_sfeatures *sfeatures; struct ethtool_sfeatures *sfeatures;
int block, bit, i, r;
struct ifreq ifr = {}; struct ifreq ifr = {};
int i, r;
if (*ethtool_fd < 0) { if (*ethtool_fd < 0) {
r = ethtool_connect_or_warn(ethtool_fd, true); r = ethtool_connect_or_warn(ethtool_fd, true);
@ -531,27 +549,14 @@ int ethtool_set_features(int *ethtool_fd, const char *ifname, int *features) {
sfeatures->cmd = ETHTOOL_SFEATURES; sfeatures->cmd = ETHTOOL_SFEATURES;
sfeatures->size = DIV_ROUND_UP(strings->len, 32U); sfeatures->size = DIV_ROUND_UP(strings->len, 32U);
for (i = 0; i < _NET_DEV_FEAT_MAX; i++) { for (i = 0; i < _NET_DEV_FEAT_MAX; i++)
if (features[i] != -1) { if (features[i] != -1) {
r = set_features_bit(strings, netdev_feature_table[i], features[i], sfeatures);
r = find_feature_index(strings, netdev_feature_table[i]);
if (r < 0) { if (r < 0) {
log_warning_errno(r, "ethtool: could not find feature: %s", netdev_feature_table[i]); log_warning_errno(r, "ethtool: could not find feature, ignoring: %s", netdev_feature_table[i]);
continue; continue;
} }
block = r / 32;
bit = r % 32;
sfeatures->features[block].valid |= 1 << bit;
if (features[i])
sfeatures->features[block].requested |= 1 << bit;
else
sfeatures->features[block].requested &= ~(1 << bit);
} }
}
ifr.ifr_data = (void *) sfeatures; ifr.ifr_data = (void *) sfeatures;

View File

@ -32,6 +32,8 @@ typedef enum WakeOnLan {
} WakeOnLan; } WakeOnLan;
typedef enum NetDevFeature { typedef enum NetDevFeature {
NET_DEV_FEAT_RX,
NET_DEV_FEAT_TX,
NET_DEV_FEAT_GSO, NET_DEV_FEAT_GSO,
NET_DEV_FEAT_GRO, NET_DEV_FEAT_GRO,
NET_DEV_FEAT_LRO, NET_DEV_FEAT_LRO,

View File

@ -45,6 +45,8 @@ Link.Duplex, config_parse_duplex, 0,
Link.AutoNegotiation, config_parse_tristate, 0, offsetof(link_config, autonegotiation) Link.AutoNegotiation, config_parse_tristate, 0, offsetof(link_config, autonegotiation)
Link.WakeOnLan, config_parse_wol, 0, offsetof(link_config, wol) Link.WakeOnLan, config_parse_wol, 0, offsetof(link_config, wol)
Link.Port, config_parse_port, 0, offsetof(link_config, port) Link.Port, config_parse_port, 0, offsetof(link_config, port)
Link.ReceiveChecksumOffload, config_parse_tristate, 0, offsetof(link_config, features[NET_DEV_FEAT_RX])
Link.TransmitChecksumOffload, config_parse_tristate, 0, offsetof(link_config, features[NET_DEV_FEAT_TX])
Link.GenericSegmentationOffload, config_parse_tristate, 0, offsetof(link_config, features[NET_DEV_FEAT_GSO]) Link.GenericSegmentationOffload, config_parse_tristate, 0, offsetof(link_config, features[NET_DEV_FEAT_GSO])
Link.TCPSegmentationOffload, config_parse_tristate, 0, offsetof(link_config, features[NET_DEV_FEAT_TSO]) Link.TCPSegmentationOffload, config_parse_tristate, 0, offsetof(link_config, features[NET_DEV_FEAT_TSO])
Link.TCP6SegmentationOffload, config_parse_tristate, 0, offsetof(link_config, features[NET_DEV_FEAT_TSO6]) Link.TCP6SegmentationOffload, config_parse_tristate, 0, offsetof(link_config, features[NET_DEV_FEAT_TSO6])

View File

@ -26,6 +26,8 @@ Duplex=
AutoNegotiation= AutoNegotiation=
WakeOnLan= WakeOnLan=
Port= Port=
ReceiveChecksumOffload=
TransmitChecksumOffload=
GenericSegmentationOffload= GenericSegmentationOffload=
TCPSegmentationOffload= TCPSegmentationOffload=
TCP6SegmentationOffload= TCP6SegmentationOffload=

View File

@ -225,6 +225,7 @@ DestinationPort=
IPProtocol= IPProtocol=
InvertRule= InvertRule=
Family= Family=
SuppressPrefixLength=
User= User=
[IPv6PrefixDelegation] [IPv6PrefixDelegation]
RouterPreference= RouterPreference=

View File

@ -538,6 +538,7 @@ STP=
Scope= Scope=
SendHostname= SendHostname=
Source= Source=
SuppressPrefixLength=
TCP6SegmentationOffload= TCP6SegmentationOffload=
TCPSegmentationOffload= TCPSegmentationOffload=
TOS= TOS=