diff options
Diffstat (limited to 'src/libnm-platform/nm-platform.h')
| -rw-r--r-- | src/libnm-platform/nm-platform.h | 344 |
1 files changed, 173 insertions, 171 deletions
diff --git a/src/libnm-platform/nm-platform.h b/src/libnm-platform/nm-platform.h index 7101b48c..6f5cd524 100644 --- a/src/libnm-platform/nm-platform.h +++ b/src/libnm-platform/nm-platform.h @@ -155,7 +155,7 @@ G_STATIC_ASSERT(_nm_alignof(NMEtherAddr) == 1); G_STATIC_ASSERT(_nm_alignof(NMPLinkAddress) == 1); gconstpointer nmp_link_address_get(const NMPLinkAddress *addr, size_t *length); -GBytes * nmp_link_address_get_as_bytes(const NMPLinkAddress *addr); +GBytes *nmp_link_address_get_as_bytes(const NMPLinkAddress *addr); typedef enum { @@ -318,16 +318,14 @@ typedef enum { * IFA_FLAGS attribute. */ \ guint32 n_ifa_flags; \ \ - /* FIXME(l3cfg): the external marker won't be necessary anymore, because we only - * merge addresses we care about, and ignore (don't remove) external addresses. */ \ - bool external : 1; \ - \ bool use_ip4_broadcast_address : 1; \ \ - /* Whether the address is should be configured once during assume. This is a meta flag - * that is not honored by NMPlatform (netlink code). Instead, it can be used by the upper - * layers which use NMPlatformIPAddress to track addresses that should be configured. */ \ + /* Meta flags not honored by NMPlatform (netlink code). Instead, they can be + * used by the upper layers which use NMPlatformIPRoute to track addresses that + * should be configured. */ \ + /* Whether the address is should be configured once during assume. */ \ bool a_assume_config_once : 1; \ + bool a_force_commit : 1; \ \ guint8 plen; \ ; @@ -471,18 +469,13 @@ typedef union { * the "table_coerced" field is ignored (unlike for the metric). */ \ bool table_any : 1; \ \ - /* This route is tracked as external route, that is not a route that NetworkManager - * actively wants to add, but a route that was added externally. In some cases, such - * a route should be ignored. - * - * Note that unlike most other fields here, this flag only exists inside NetworkManager - * and is not reflected on netlink. */ \ - bool is_external : 1; \ - \ - /* Whether the route is should be configured once during assume. This is a meta flag - * that is not honored by NMPlatform (netlink code). Instead, it can be used by the upper - * layers which use NMPlatformIPRoute to track routes that should be configured. */ \ + /* Meta flags not honored by NMPlatform (netlink code). Instead, they can be + * used by the upper layers which use NMPlatformIPRoute to track routes that + * should be configured. */ \ + /* Whether the route is should be configured once during assume. */ \ bool r_assume_config_once : 1; \ + /* Whether the route should be committed even if it was removed externally. */ \ + bool r_force_commit : 1; \ \ /* rtnh_flags * @@ -1078,7 +1071,7 @@ struct _NMPlatformPrivate; struct _NMPlatform { GObject parent; - NMPNetns * _netns; + NMPNetns *_netns; struct _NMPlatformPrivate *_priv; }; @@ -1090,24 +1083,24 @@ typedef struct { int dirfd, const char *path, const char *value); - void (*sysctl_set_async)(NMPlatform * self, - const char * pathid, + void (*sysctl_set_async)(NMPlatform *self, + const char *pathid, int dirfd, - const char * path, - const char *const * values, + const char *path, + const char *const *values, NMPlatformAsyncCallback callback, gpointer data, - GCancellable * cancellable); + GCancellable *cancellable); char *(*sysctl_get)(NMPlatform *self, const char *pathid, int dirfd, const char *path); void (*refresh_all)(NMPlatform *self, NMPObjectType obj_type); void (*process_events)(NMPlatform *self); - int (*link_add)(NMPlatform * self, + int (*link_add)(NMPlatform *self, NMLinkType type, - const char * name, + const char *name, int parent, - const void * address, + const void *address, size_t address_len, guint32 mtu, gconstpointer extra_data, @@ -1123,21 +1116,21 @@ typedef struct { int (*link_set_inet6_addr_gen_mode)(NMPlatform *self, int ifindex, guint8 enabled); gboolean (*link_set_token)(NMPlatform *self, int ifindex, const NMUtilsIPv6IfaceId *iid); - gboolean (*link_get_permanent_address_ethtool)(NMPlatform * self, + gboolean (*link_get_permanent_address_ethtool)(NMPlatform *self, int ifindex, NMPLinkAddress *out_address); int (*link_set_address)(NMPlatform *self, int ifindex, gconstpointer address, size_t length); int (*link_set_mtu)(NMPlatform *self, int ifindex, guint32 mtu); gboolean (*link_set_name)(NMPlatform *self, int ifindex, const char *name); - void (*link_set_sriov_params_async)(NMPlatform * self, + void (*link_set_sriov_params_async)(NMPlatform *self, int ifindex, guint num_vfs, NMOptionBool autoprobe, NMPlatformAsyncCallback callback, gpointer callback_data, - GCancellable * cancellable); + GCancellable *cancellable); gboolean (*link_set_sriov_vfs)(NMPlatform *self, int ifindex, const NMPlatformVF *const *vfs); - gboolean (*link_set_bridge_vlans)(NMPlatform * self, + gboolean (*link_set_bridge_vlans)(NMPlatform *self, int ifindex, gboolean on_master, const NMPlatformBridgeVlan *const *vlans); @@ -1147,9 +1140,9 @@ typedef struct { gboolean (*link_get_wake_on_lan)(NMPlatform *self, int ifindex); gboolean (*link_get_driver_info)(NMPlatform *self, int ifindex, - char ** out_driver_name, - char ** out_driver_version, - char ** out_fw_version); + char **out_driver_name, + char **out_driver_version, + char **out_fw_version); gboolean (*link_supports_carrier_detect)(NMPlatform *self, int ifindex); gboolean (*link_supports_vlans)(NMPlatform *self, int ifindex); @@ -1160,15 +1153,15 @@ typedef struct { gboolean (*link_can_assume)(NMPlatform *self, int ifindex); - int (*link_wireguard_change)(NMPlatform * self, + int (*link_wireguard_change)(NMPlatform *self, int ifindex, - const NMPlatformLnkWireGuard * lnk_wireguard, - const struct _NMPWireGuardPeer * peers, + const NMPlatformLnkWireGuard *lnk_wireguard, + const struct _NMPWireGuardPeer *peers, const NMPlatformWireGuardChangePeerFlags *peer_flags, guint peers_len, NMPlatformWireGuardChangeFlags change_flags); - gboolean (*link_vlan_change)(NMPlatform * self, + gboolean (*link_vlan_change)(NMPlatform *self, int ifindex, _NMVlanFlags flags_mask, _NMVlanFlags flags_set, @@ -1178,26 +1171,26 @@ typedef struct { gboolean egress_reset_all, const NMVlanQosMapping *egress_map, gsize n_egress_map); - gboolean (*link_tun_add)(NMPlatform * self, - const char * name, + gboolean (*link_tun_add)(NMPlatform *self, + const char *name, const NMPlatformLnkTun *props, - const NMPlatformLink ** out_link, - int * out_fd); + const NMPlatformLink **out_link, + int *out_fd); - gboolean (*infiniband_partition_add)(NMPlatform * self, + gboolean (*infiniband_partition_add)(NMPlatform *self, int parent, int p_key, const NMPlatformLink **out_link); gboolean (*infiniband_partition_delete)(NMPlatform *self, int parent, int p_key); - gboolean (*wifi_get_capabilities)(NMPlatform * self, + gboolean (*wifi_get_capabilities)(NMPlatform *self, int ifindex, _NMDeviceWifiCapabilities *caps); - gboolean (*wifi_get_station)(NMPlatform * self, + gboolean (*wifi_get_station)(NMPlatform *self, int ifindex, NMEtherAddr *out_bssid, - int * out_quality, - guint32 * out_rate); + int *out_quality, + guint32 *out_rate); gboolean (*wifi_get_bssid)(NMPlatform *self, int ifindex, guint8 *bssid); guint32 (*wifi_get_frequency)(NMPlatform *self, int ifindex); int (*wifi_get_quality)(NMPlatform *self, int ifindex); @@ -1208,7 +1201,7 @@ typedef struct { guint32 (*wifi_find_frequency)(NMPlatform *self, int ifindex, const guint32 *freqs); void (*wifi_indicate_addressing_running)(NMPlatform *self, int ifindex, gboolean running); _NMSettingWirelessWakeOnWLan (*wifi_get_wake_on_wlan)(NMPlatform *self, int ifindex); - gboolean (*wifi_set_wake_on_wlan)(NMPlatform * self, + gboolean (*wifi_set_wake_on_wlan)(NMPlatform *self, int ifindex, _NMSettingWirelessWakeOnWLan wowl); @@ -1234,7 +1227,7 @@ typedef struct { guint32 preferred_lft, guint32 flags, const char *label); - gboolean (*ip6_address_add)(NMPlatform * self, + gboolean (*ip6_address_add)(NMPlatform *self, int ifindex, struct in6_addr address, guint8 plen, @@ -1247,22 +1240,22 @@ typedef struct { in_addr_t address, guint8 plen, in_addr_t peer_address); - gboolean (*ip6_address_delete)(NMPlatform * self, + gboolean (*ip6_address_delete)(NMPlatform *self, int ifindex, struct in6_addr address, guint8 plen); - int (*ip_route_add)(NMPlatform * self, + int (*ip_route_add)(NMPlatform *self, NMPNlmFlags flags, int addr_family, const NMPlatformIPRoute *route); - int (*ip_route_get)(NMPlatform * self, + int (*ip_route_get)(NMPlatform *self, int addr_family, gconstpointer address, int oif_ifindex, - NMPObject ** out_route); + NMPObject **out_route); - int (*routing_rule_add)(NMPlatform * self, + int (*routing_rule_add)(NMPlatform *self, NMPNlmFlags flags, const NMPlatformRoutingRule *routing_rule); @@ -1415,6 +1408,12 @@ _nm_platform_link_get_inet6_addr_gen_mode(const NMPlatformLink *pllink) return _nm_platform_uint8_inv(pllink->inet6_addr_gen_mode_inv); } +static inline gboolean +nm_platform_route_type_is_nodev(guint8 type) +{ + return NM_IN_SET(type, 6 /* RTN_BLACKHOLE */, 7 /* RTN_UNREACHABLE */, 8 /* RTN_PROHIBIT */); +} + /** * nm_platform_route_type_coerce: * @table: the route type, in its original value. @@ -1484,15 +1483,15 @@ gboolean nm_platform_sysctl_set(NMPlatform *self, int dirfd, const char *path, const char *value); -void nm_platform_sysctl_set_async(NMPlatform * self, - const char * pathid, +void nm_platform_sysctl_set_async(NMPlatform *self, + const char *pathid, int dirfd, - const char * path, - const char *const * values, + const char *path, + const char *const *values, NMPlatformAsyncCallback callback, gpointer data, - GCancellable * cancellable); -char * nm_platform_sysctl_get(NMPlatform *self, const char *pathid, int dirfd, const char *path); + GCancellable *cancellable); +char *nm_platform_sysctl_get(NMPlatform *self, const char *pathid, int dirfd, const char *path); gint32 nm_platform_sysctl_get_int32(NMPlatform *self, const char *pathid, int dirfd, @@ -1544,7 +1543,7 @@ gboolean nm_platform_sysctl_ip_neigh_set_ipv6_retrans_time(NMPlatform *self, int nm_platform_sysctl_ip_conf_get_rp_filter_ipv4(NMPlatform *platform, const char *iface, gboolean consider_all, - gboolean * out_due_to_all); + gboolean *out_due_to_all); const char *nm_platform_if_indextoname(NMPlatform *self, int ifindex, @@ -1554,27 +1553,27 @@ int nm_platform_if_nametoindex(NMPlatform *self, const char *ifname); const NMPObject *nm_platform_link_get_obj(NMPlatform *self, int ifindex, gboolean visible_only); const NMPlatformLink *nm_platform_link_get(NMPlatform *self, int ifindex); const NMPlatformLink *nm_platform_link_get_by_ifname(NMPlatform *self, const char *ifname); -const NMPlatformLink *nm_platform_link_get_by_address(NMPlatform * self, +const NMPlatformLink *nm_platform_link_get_by_address(NMPlatform *self, NMLinkType link_type, gconstpointer address, size_t length); GPtrArray *nm_platform_link_get_all(NMPlatform *self, gboolean sort_by_name); -int nm_platform_link_add(NMPlatform * self, +int nm_platform_link_add(NMPlatform *self, NMLinkType type, - const char * name, + const char *name, int parent, - const void * address, + const void *address, size_t address_len, guint32 mtu, gconstpointer extra_data, const NMPlatformLink **out_link); static inline int -nm_platform_link_veth_add(NMPlatform * self, - const char * name, - const char * peer, +nm_platform_link_veth_add(NMPlatform *self, + const char *name, + const char *peer, const NMPlatformLink **out_link) { return nm_platform_link_add(self, NM_LINK_TYPE_VETH, name, 0, NULL, 0, 0, peer, out_link); @@ -1587,13 +1586,13 @@ nm_platform_link_dummy_add(NMPlatform *self, const char *name, const NMPlatformL } static inline int -nm_platform_link_bridge_add(NMPlatform * self, - const char * name, - const void * address, +nm_platform_link_bridge_add(NMPlatform *self, + const char *name, + const void *address, size_t address_len, guint32 mtu, const NMPlatformLnkBridge *props, - const NMPlatformLink ** out_link) + const NMPlatformLink **out_link) { return nm_platform_link_add(self, NM_LINK_TYPE_BRIDGE, @@ -1625,12 +1624,12 @@ nm_platform_link_wireguard_add(NMPlatform *self, const char *name, const NMPlatf } static inline int -nm_platform_link_gre_add(NMPlatform * self, - const char * name, - const void * address, +nm_platform_link_gre_add(NMPlatform *self, + const char *name, + const void *address, size_t address_len, const NMPlatformLnkGre *props, - const NMPlatformLink ** out_link) + const NMPlatformLink **out_link) { g_return_val_if_fail(props, -NME_BUG); @@ -1646,17 +1645,17 @@ nm_platform_link_gre_add(NMPlatform * self, } static inline int -nm_platform_link_sit_add(NMPlatform * self, - const char * name, +nm_platform_link_sit_add(NMPlatform *self, + const char *name, const NMPlatformLnkSit *props, - const NMPlatformLink ** out_link) + const NMPlatformLink **out_link) { return nm_platform_link_add(self, NM_LINK_TYPE_SIT, name, 0, NULL, 0, 0, props, out_link); } static inline int -nm_platform_link_vlan_add(NMPlatform * self, - const char * name, +nm_platform_link_vlan_add(NMPlatform *self, + const char *name, int parent, int vlanid, guint32 vlanflags, @@ -1680,26 +1679,26 @@ nm_platform_link_vlan_add(NMPlatform * self, } static inline int -nm_platform_link_vrf_add(NMPlatform * self, - const char * name, +nm_platform_link_vrf_add(NMPlatform *self, + const char *name, const NMPlatformLnkVrf *props, - const NMPlatformLink ** out_link) + const NMPlatformLink **out_link) { return nm_platform_link_add(self, NM_LINK_TYPE_VRF, name, 0, NULL, 0, 0, props, out_link); } static inline int -nm_platform_link_vxlan_add(NMPlatform * self, - const char * name, +nm_platform_link_vxlan_add(NMPlatform *self, + const char *name, const NMPlatformLnkVxlan *props, - const NMPlatformLink ** out_link) + const NMPlatformLink **out_link) { return nm_platform_link_add(self, NM_LINK_TYPE_VXLAN, name, 0, NULL, 0, 0, props, out_link); } static inline int -nm_platform_link_6lowpan_add(NMPlatform * self, - const char * name, +nm_platform_link_6lowpan_add(NMPlatform *self, + const char *name, int parent, const NMPlatformLink **out_link) { @@ -1715,10 +1714,10 @@ nm_platform_link_6lowpan_add(NMPlatform * self, } static inline int -nm_platform_link_ip6tnl_add(NMPlatform * self, - const char * name, +nm_platform_link_ip6tnl_add(NMPlatform *self, + const char *name, const NMPlatformLnkIp6Tnl *props, - const NMPlatformLink ** out_link) + const NMPlatformLink **out_link) { g_return_val_if_fail(props, -NME_BUG); g_return_val_if_fail(!props->is_gre, -NME_BUG); @@ -1727,12 +1726,12 @@ nm_platform_link_ip6tnl_add(NMPlatform * self, } static inline int -nm_platform_link_ip6gre_add(NMPlatform * self, - const char * name, - const void * address, +nm_platform_link_ip6gre_add(NMPlatform *self, + const char *name, + const void *address, size_t address_len, const NMPlatformLnkIp6Tnl *props, - const NMPlatformLink ** out_link) + const NMPlatformLink **out_link) { g_return_val_if_fail(props, -NME_BUG); g_return_val_if_fail(props->is_gre, -NME_BUG); @@ -1749,10 +1748,10 @@ nm_platform_link_ip6gre_add(NMPlatform * self, } static inline int -nm_platform_link_ipip_add(NMPlatform * self, - const char * name, +nm_platform_link_ipip_add(NMPlatform *self, + const char *name, const NMPlatformLnkIpIp *props, - const NMPlatformLink ** out_link) + const NMPlatformLink **out_link) { g_return_val_if_fail(props, -NME_BUG); @@ -1760,11 +1759,11 @@ nm_platform_link_ipip_add(NMPlatform * self, } static inline int -nm_platform_link_macsec_add(NMPlatform * self, - const char * name, +nm_platform_link_macsec_add(NMPlatform *self, + const char *name, int parent, const NMPlatformLnkMacsec *props, - const NMPlatformLink ** out_link) + const NMPlatformLink **out_link) { g_return_val_if_fail(props, -NME_BUG); g_return_val_if_fail(parent > 0, -NME_BUG); @@ -1781,11 +1780,11 @@ nm_platform_link_macsec_add(NMPlatform * self, } static inline int -nm_platform_link_macvlan_add(NMPlatform * self, - const char * name, +nm_platform_link_macvlan_add(NMPlatform *self, + const char *name, int parent, const NMPlatformLnkMacvlan *props, - const NMPlatformLink ** out_link) + const NMPlatformLink **out_link) { g_return_val_if_fail(props, -NME_BUG); g_return_val_if_fail(parent > 0, -NME_BUG); @@ -1807,7 +1806,7 @@ gboolean nm_platform_link_set_netns(NMPlatform *self, int ifindex, int netns_fd) struct _NMDedupMultiHeadEntry; struct _NMPLookup; -const struct _NMDedupMultiHeadEntry *nm_platform_lookup(NMPlatform * self, +const struct _NMDedupMultiHeadEntry *nm_platform_lookup(NMPlatform *self, const struct _NMPLookup *lookup); #define nm_platform_iter_obj_for_each(iter, self, lookup, obj) \ @@ -1818,7 +1817,7 @@ gboolean nm_platform_lookup_predicate_routes_main(const NMPObject *obj, gpointer gboolean nm_platform_lookup_predicate_routes_main_skip_rtprot_kernel(const NMPObject *obj, gpointer user_data); -GPtrArray *nm_platform_lookup_clone(NMPlatform * self, +GPtrArray *nm_platform_lookup_clone(NMPlatform *self, const struct _NMPLookup *lookup, NMPObjectPredicateFunc predicate, gpointer user_data); @@ -1874,9 +1873,9 @@ nm_platform_link_change_flags(NMPlatform *self, int ifindex, unsigned value, gbo return nm_platform_link_change_flags_full(self, ifindex, value, set ? value : 0u); } -gboolean nm_platform_link_get_udev_property(NMPlatform * self, +gboolean nm_platform_link_get_udev_property(NMPlatform *self, int ifindex, - const char * name, + const char *name, const char **out_value); const char *nm_platform_link_get_udi(NMPlatform *self, int ifindex); const char *nm_platform_link_get_path(NMPlatform *self, int ifindex); @@ -1887,39 +1886,39 @@ int nm_platform_link_set_inet6_addr_gen_mode(NMPlatform *self, int ifindex, guin gboolean nm_platform_link_set_ipv6_token(NMPlatform *self, int ifindex, const NMUtilsIPv6IfaceId *iid); -gboolean nm_platform_link_get_permanent_address_ethtool(NMPlatform * self, +gboolean nm_platform_link_get_permanent_address_ethtool(NMPlatform *self, int ifindex, NMPLinkAddress *out_address); -gboolean nm_platform_link_get_permanent_address(NMPlatform * self, +gboolean nm_platform_link_get_permanent_address(NMPlatform *self, const NMPlatformLink *plink, - NMPLinkAddress * out_address); + NMPLinkAddress *out_address); int nm_platform_link_set_address(NMPlatform *self, int ifindex, const void *address, size_t length); int nm_platform_link_set_mtu(NMPlatform *self, int ifindex, guint32 mtu); gboolean nm_platform_link_set_name(NMPlatform *self, int ifindex, const char *name); -void nm_platform_link_set_sriov_params_async(NMPlatform * self, +void nm_platform_link_set_sriov_params_async(NMPlatform *self, int ifindex, guint num_vfs, NMOptionBool autoprobe, NMPlatformAsyncCallback callback, gpointer callback_data, - GCancellable * cancellable); + GCancellable *cancellable); gboolean nm_platform_link_set_sriov_vfs(NMPlatform *self, int ifindex, const NMPlatformVF *const *vfs); -gboolean nm_platform_link_set_bridge_vlans(NMPlatform * self, +gboolean nm_platform_link_set_bridge_vlans(NMPlatform *self, int ifindex, gboolean on_master, const NMPlatformBridgeVlan *const *vlans); -char * nm_platform_link_get_physical_port_id(NMPlatform *self, int ifindex); +char *nm_platform_link_get_physical_port_id(NMPlatform *self, int ifindex); guint nm_platform_link_get_dev_id(NMPlatform *self, int ifindex); gboolean nm_platform_link_get_wake_on_lan(NMPlatform *self, int ifindex); gboolean nm_platform_link_get_driver_info(NMPlatform *self, int ifindex, - char ** out_driver_name, - char ** out_driver_version, - char ** out_fw_version); + char **out_driver_name, + char **out_driver_version, + char **out_fw_version); gboolean nm_platform_link_supports_carrier_detect(NMPlatform *self, int ifindex); gboolean nm_platform_link_supports_vlans(NMPlatform *self, int ifindex); @@ -1932,14 +1931,14 @@ gboolean nm_platform_sysctl_master_set_option(NMPlatform *self, int ifindex, const char *option, const char *value); -char * nm_platform_sysctl_master_get_option(NMPlatform *self, int ifindex, const char *option); +char *nm_platform_sysctl_master_get_option(NMPlatform *self, int ifindex, const char *option); gboolean nm_platform_sysctl_slave_set_option(NMPlatform *self, int ifindex, const char *option, const char *value); -char * nm_platform_sysctl_slave_get_option(NMPlatform *self, int ifindex, const char *option); +char *nm_platform_sysctl_slave_get_option(NMPlatform *self, int ifindex, const char *option); -const NMPObject *nm_platform_link_get_lnk(NMPlatform * self, +const NMPObject *nm_platform_link_get_lnk(NMPlatform *self, int ifindex, NMLinkType link_type, const NMPlatformLink **out_link); @@ -1982,7 +1981,7 @@ nm_platform_link_get_lnk_wireguard(NMPlatform *self, int ifindex, const NMPlatfo gboolean nm_platform_link_vlan_set_ingress_map(NMPlatform *self, int ifindex, int from, int to); gboolean nm_platform_link_vlan_set_egress_map(NMPlatform *self, int ifindex, int from, int to); -gboolean nm_platform_link_vlan_change(NMPlatform * self, +gboolean nm_platform_link_vlan_change(NMPlatform *self, int ifindex, _NMVlanFlags flags_mask, _NMVlanFlags flags_set, @@ -1993,30 +1992,30 @@ gboolean nm_platform_link_vlan_change(NMPlatform * self, const NMVlanQosMapping *egress_map, gsize n_egress_map); -int nm_platform_link_infiniband_add(NMPlatform * self, +int nm_platform_link_infiniband_add(NMPlatform *self, int parent, int p_key, const NMPlatformLink **out_link); int nm_platform_link_infiniband_delete(NMPlatform *self, int parent, int p_key); -gboolean nm_platform_link_infiniband_get_properties(NMPlatform * self, +gboolean nm_platform_link_infiniband_get_properties(NMPlatform *self, int ifindex, - int * parent, - int * p_key, + int *parent, + int *p_key, const char **mode); gboolean nm_platform_link_veth_get_properties(NMPlatform *self, int ifindex, int *out_peer_ifindex); -gboolean nm_platform_link_tun_get_properties(NMPlatform * self, +gboolean nm_platform_link_tun_get_properties(NMPlatform *self, int ifindex, NMPlatformLnkTun *out_properties); gboolean nm_platform_wifi_get_capabilities(NMPlatform *self, int ifindex, _NMDeviceWifiCapabilities *caps); guint32 nm_platform_wifi_get_frequency(NMPlatform *self, int ifindex); -gboolean nm_platform_wifi_get_station(NMPlatform * self, +gboolean nm_platform_wifi_get_station(NMPlatform *self, int ifindex, NMEtherAddr *out_bssid, - int * out_quality, - guint32 * out_rate); + int *out_quality, + guint32 *out_rate); _NM80211Mode nm_platform_wifi_get_mode(NMPlatform *self, int ifindex); void nm_platform_wifi_set_mode(NMPlatform *self, int ifindex, _NM80211Mode mode); void nm_platform_wifi_set_powersave(NMPlatform *self, int ifindex, guint32 powersave); @@ -2045,24 +2044,24 @@ const NMPlatformIP4Address *nm_platform_ip4_address_get(NMPlatform *self, guint8 plen, in_addr_t peer_address); -int nm_platform_link_sit_add(NMPlatform * self, - const char * name, +int nm_platform_link_sit_add(NMPlatform *self, + const char *name, const NMPlatformLnkSit *props, - const NMPlatformLink ** out_link); -int nm_platform_link_tun_add(NMPlatform * self, - const char * name, + const NMPlatformLink **out_link); +int nm_platform_link_tun_add(NMPlatform *self, + const char *name, const NMPlatformLnkTun *props, - const NMPlatformLink ** out_link, - int * out_fd); + const NMPlatformLink **out_link, + int *out_fd); gboolean nm_platform_link_6lowpan_get_properties(NMPlatform *self, int ifindex, int *out_parent); int nm_platform_link_wireguard_add(NMPlatform *self, const char *name, const NMPlatformLink **out_link); -int nm_platform_link_wireguard_change(NMPlatform * self, +int nm_platform_link_wireguard_change(NMPlatform *self, int ifindex, - const NMPlatformLnkWireGuard * lnk_wireguard, - const struct _NMPWireGuardPeer * peers, + const NMPlatformLnkWireGuard *lnk_wireguard, + const struct _NMPWireGuardPeer *peers, const NMPlatformWireGuardChangePeerFlags *peer_flags, guint peers_len, NMPlatformWireGuardChangeFlags change_flags); @@ -2082,7 +2081,7 @@ gboolean nm_platform_ip4_address_add(NMPlatform *self, guint32 preferred_lft, guint32 flags, const char *label); -gboolean nm_platform_ip6_address_add(NMPlatform * self, +gboolean nm_platform_ip6_address_add(NMPlatform *self, int ifindex, struct in6_addr address, guint8 plen, @@ -2101,8 +2100,8 @@ nm_platform_ip6_address_delete(NMPlatform *self, int ifindex, struct in6_addr ad gboolean nm_platform_ip_address_sync(NMPlatform *self, int addr_family, int ifindex, - GPtrArray * known_addresses, - GPtrArray * addresses_prune); + GPtrArray *known_addresses, + GPtrArray *addresses_prune); GPtrArray *nm_platform_ip_address_get_prune_list(NMPlatform *self, int addr_family, @@ -2113,7 +2112,7 @@ static inline gboolean _nm_platform_ip_address_sync(NMPlatform *self, int addr_family, int ifindex, - GPtrArray * known_addresses, + GPtrArray *known_addresses, gboolean full_sync) { gs_unref_ptrarray GPtrArray *addresses_prune = NULL; @@ -2135,7 +2134,7 @@ nm_platform_ip4_address_sync(NMPlatform *self, int ifindex, GPtrArray *known_add static inline gboolean nm_platform_ip6_address_sync(NMPlatform *self, int ifindex, - GPtrArray * known_addresses, + GPtrArray *known_addresses, gboolean full_sync) { return _nm_platform_ip_address_sync(self, AF_INET6, ifindex, known_addresses, full_sync); @@ -2188,7 +2187,9 @@ static inline gconstpointer nm_platform_ip_route_get_gateway(int addr_family, const NMPlatformIPRoute *route) { nm_assert_addr_family(addr_family); - nm_assert(route); + + if (!route) + return NULL; if (NM_IS_IPv4(addr_family)) return &((NMPlatformIP4Route *) route)->gateway; @@ -2199,7 +2200,7 @@ int nm_platform_ip_route_add(NMPlatform *self, NMPNlmFlags flags, const NMPObjec int nm_platform_ip4_route_add(NMPlatform *self, NMPNlmFlags flags, const NMPlatformIP4Route *route); int nm_platform_ip6_route_add(NMPlatform *self, NMPNlmFlags flags, const NMPlatformIP6Route *route); -GPtrArray *nm_platform_ip_route_get_prune_list(NMPlatform * self, +GPtrArray *nm_platform_ip_route_get_prune_list(NMPlatform *self, int addr_family, int ifindex, NMIPRouteTableSyncMode route_table_sync); @@ -2207,19 +2208,19 @@ GPtrArray *nm_platform_ip_route_get_prune_list(NMPlatform * self, gboolean nm_platform_ip_route_sync(NMPlatform *self, int addr_family, int ifindex, - GPtrArray * routes, - GPtrArray * routes_prune, + GPtrArray *routes, + GPtrArray *routes_prune, GPtrArray **out_temporary_not_available); gboolean nm_platform_ip_route_flush(NMPlatform *self, int addr_family, int ifindex); -int nm_platform_ip_route_get(NMPlatform * self, +int nm_platform_ip_route_get(NMPlatform *self, int addr_family, gconstpointer address, int oif_ifindex, - NMPObject ** out_route); + NMPObject **out_route); -int nm_platform_routing_rule_add(NMPlatform * self, +int nm_platform_routing_rule_add(NMPlatform *self, NMPNlmFlags flags, const NMPlatformRoutingRule *routing_rule); @@ -2229,8 +2230,8 @@ int nm_platform_tfilter_add(NMPlatform *self, NMPNlmFlags flags, const NMPlatfor int nm_platform_tfilter_delete(NMPlatform *self, int ifindex, guint32 parent, gboolean log_error); gboolean nm_platform_tc_sync(NMPlatform *self, int ifindex, - GPtrArray * known_qdiscs, - GPtrArray * known_tfilters); + GPtrArray *known_qdiscs, + GPtrArray *known_tfilters); const char *nm_platform_link_to_string(const NMPlatformLink *link, char *buf, gsize len); const char *nm_platform_lnk_bridge_to_string(const NMPlatformLnkBridge *lnk, char *buf, gsize len); @@ -2263,10 +2264,10 @@ const char *nm_platform_vf_to_string(const NMPlatformVF *vf, char *buf, gsize le const char * nm_platform_bridge_vlan_to_string(const NMPlatformBridgeVlan *vlan, char *buf, gsize len); -const char *nm_platform_vlan_qos_mapping_to_string(const char * name, +const char *nm_platform_vlan_qos_mapping_to_string(const char *name, const NMVlanQosMapping *map, gsize n_map, - char * buf, + char *buf, gsize len); const char * @@ -2339,13 +2340,13 @@ void nm_platform_ip4_address_hash_update(const NMPlatformIP4Address *obj, NMHash void nm_platform_ip6_address_hash_update(const NMPlatformIP6Address *obj, NMHashState *h); void nm_platform_ip4_route_hash_update(const NMPlatformIP4Route *obj, NMPlatformIPRouteCmpType cmp_type, - NMHashState * h); + NMHashState *h); void nm_platform_ip6_route_hash_update(const NMPlatformIP6Route *obj, NMPlatformIPRouteCmpType cmp_type, - NMHashState * h); + NMHashState *h); void nm_platform_routing_rule_hash_update(const NMPlatformRoutingRule *obj, NMPlatformRoutingRuleCmpType cmp_type, - NMHashState * h); + NMHashState *h); void nm_platform_lnk_bridge_hash_update(const NMPlatformLnkBridge *obj, NMHashState *h); void nm_platform_lnk_gre_hash_update(const NMPlatformLnkGre *obj, NMHashState *h); void nm_platform_lnk_infiniband_hash_update(const NMPlatformLnkInfiniband *obj, NMHashState *h); @@ -2372,34 +2373,34 @@ const char *nm_platform_route_scope2str(int scope, char *buf, gsize len); int nm_platform_ip_address_cmp_expiry(const NMPlatformIPAddress *a, const NMPlatformIPAddress *b); -gboolean nm_platform_ethtool_set_wake_on_lan(NMPlatform * self, +gboolean nm_platform_ethtool_set_wake_on_lan(NMPlatform *self, int ifindex, _NMSettingWiredWakeOnLan wol, - const char * wol_password); -gboolean nm_platform_ethtool_set_link_settings(NMPlatform * self, + const char *wol_password); +gboolean nm_platform_ethtool_set_link_settings(NMPlatform *self, int ifindex, gboolean autoneg, guint32 speed, NMPlatformLinkDuplexType duplex); -gboolean nm_platform_ethtool_get_link_settings(NMPlatform * self, +gboolean nm_platform_ethtool_get_link_settings(NMPlatform *self, int ifindex, - gboolean * out_autoneg, - guint32 * out_speed, + gboolean *out_autoneg, + guint32 *out_speed, NMPlatformLinkDuplexType *out_duplex); NMEthtoolFeatureStates *nm_platform_ethtool_get_link_features(NMPlatform *self, int ifindex); gboolean nm_platform_ethtool_set_features( - NMPlatform * self, + NMPlatform *self, int ifindex, const NMEthtoolFeatureStates *features, const NMOptionBool *requested /* indexed by NMEthtoolID - _NM_ETHTOOL_ID_FEATURE_FIRST */, gboolean do_set /* or reset */); -gboolean nm_platform_ethtool_get_link_coalesce(NMPlatform * self, +gboolean nm_platform_ethtool_get_link_coalesce(NMPlatform *self, int ifindex, NMEthtoolCoalesceState *coalesce); -gboolean nm_platform_ethtool_set_coalesce(NMPlatform * self, +gboolean nm_platform_ethtool_set_coalesce(NMPlatform *self, int ifindex, const NMEthtoolCoalesceState *coalesce); @@ -2416,7 +2417,7 @@ nm_platform_ethtool_set_pause(NMPlatform *self, int ifindex, const NMEthtoolPaus void nm_platform_ip4_dev_route_blacklist_set(NMPlatform *self, int ifindex, - GPtrArray * ip4_dev_route_blacklist); + GPtrArray *ip4_dev_route_blacklist); struct _NMDedupMultiIndex *nm_platform_get_multi_idx(NMPlatform *self); @@ -2426,6 +2427,7 @@ NMPlatformIP4Route *nm_platform_ip4_address_generate_device_route(const NMPlatfo int ifindex, guint32 route_table, guint32 route_metric, + gboolean force_commit, NMPlatformIP4Route *dst); /*****************************************************************************/ |