diff options
| author | Michael Biebl <biebl@debian.org> | 2019-04-21 21:09:51 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2019-04-21 21:09:51 +0200 |
| commit | 85563b7fc7ec2cd21e38debb9b28db342e2e8e7c (patch) | |
| tree | cce7b0b02d28fae2df9fdf2c1804cacd1500f2d7 /src/NetworkManagerUtils.c | |
| parent | 9a6dcbf895f9da01768e64b73cec88c16157d91e (diff) | |
New upstream version 1.18.0 upstream/1.18.0
Diffstat (limited to 'src/NetworkManagerUtils.c')
| -rw-r--r-- | src/NetworkManagerUtils.c | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/src/NetworkManagerUtils.c b/src/NetworkManagerUtils.c index 71bfbf7c..13cb1dae 100644 --- a/src/NetworkManagerUtils.c +++ b/src/NetworkManagerUtils.c @@ -23,9 +23,11 @@ #include "NetworkManagerUtils.h" -#include "nm-utils/nm-c-list.h" +#include <linux/fib_rules.h> -#include "nm-common-macros.h" +#include "nm-glib-aux/nm-c-list.h" + +#include "nm-libnm-core-intern/nm-common-macros.h" #include "nm-utils.h" #include "nm-setting-connection.h" #include "nm-setting-ip4-config.h" @@ -908,6 +910,48 @@ nm_match_spec_device_by_pllink (const NMPlatformLink *pllink, /*****************************************************************************/ +NMPlatformRoutingRule * +nm_ip_routing_rule_to_platform (const NMIPRoutingRule *rule, + NMPlatformRoutingRule *out_pl) +{ + nm_assert (rule); + nm_assert (nm_ip_routing_rule_validate (rule, NULL)); + nm_assert (out_pl); + + *out_pl = (NMPlatformRoutingRule) { + .addr_family = nm_ip_routing_rule_get_addr_family (rule), + .flags = ( nm_ip_routing_rule_get_invert (rule) + ? FIB_RULE_INVERT + : 0), + .priority = nm_ip_routing_rule_get_priority (rule), + .tos = nm_ip_routing_rule_get_tos (rule), + .ip_proto = nm_ip_routing_rule_get_ipproto (rule), + .fwmark = nm_ip_routing_rule_get_fwmark (rule), + .fwmask = nm_ip_routing_rule_get_fwmask (rule), + .sport_range = { + .start = nm_ip_routing_rule_get_source_port_start (rule), + .end = nm_ip_routing_rule_get_source_port_end (rule), + }, + .dport_range = { + .start = nm_ip_routing_rule_get_destination_port_start (rule), + .end = nm_ip_routing_rule_get_destination_port_end (rule), + }, + .src = *(nm_ip_routing_rule_get_from_bin (rule) ?: &nm_ip_addr_zero), + .dst = *(nm_ip_routing_rule_get_to_bin (rule) ?: &nm_ip_addr_zero), + .src_len = nm_ip_routing_rule_get_from_len (rule), + .dst_len = nm_ip_routing_rule_get_to_len (rule), + .action = nm_ip_routing_rule_get_action (rule), + .table = nm_ip_routing_rule_get_table (rule), + }; + + nm_ip_routing_rule_get_xifname_bin (rule, TRUE, out_pl->iifname); + nm_ip_routing_rule_get_xifname_bin (rule, FALSE, out_pl->oifname); + + return out_pl; +} + +/*****************************************************************************/ + struct _NMShutdownWaitObjHandle { CList lst; GObject *watched_obj; |