summary refs log tree commit diff
path: root/src/platform/nm-platform.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/platform/nm-platform.h')
-rw-r--r--src/platform/nm-platform.h84
1 files changed, 43 insertions, 41 deletions
diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h
index 8ac129a0..b94c440a 100644
--- a/src/platform/nm-platform.h
+++ b/src/platform/nm-platform.h
@@ -27,11 +27,11 @@
 #include <linux/if_link.h>
 
 #include "nm-dbus-interface.h"
-#include "nm-default.h"
-#include "NetworkManagerUtils.h"
-#include "nm-setting-vlan.h"
 #include "nm-core-types-internal.h"
 
+#include "nm-core-utils.h"
+#include "nm-setting-vlan.h"
+
 #define NM_TYPE_PLATFORM            (nm_platform_get_type ())
 #define NM_PLATFORM(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_PLATFORM, NMPlatform))
 #define NM_PLATFORM_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_PLATFORM, NMPlatformClass))
@@ -61,6 +61,7 @@ typedef struct _NMPlatform NMPlatform;
 #define NM_IN6_ADDR_GEN_MODE_EUI64             0    /* IN6_ADDR_GEN_MODE_EUI64 */
 #define NM_IN6_ADDR_GEN_MODE_NONE              1    /* IN6_ADDR_GEN_MODE_NONE */
 #define NM_IN6_ADDR_GEN_MODE_STABLE_PRIVACY    2    /* IN6_ADDR_GEN_MODE_STABLE_PRIVACY */
+#define NM_IN6_ADDR_GEN_MODE_RANDOM            3    /* IN6_ADDR_GEN_MODE_RANDOM */
 
 #define NM_IFF_MULTI_QUEUE                     0x0100 /* IFF_MULTI_QUEUE */
 
@@ -118,7 +119,6 @@ struct _NMPlatformLink {
 	/* NMPlatform initializes this field with a static string. */
 	const char *driver;
 
-	gboolean initialized;
 	int master;
 
 	/* rtnl_link_get_link(), IFLA_LINK.
@@ -126,6 +126,11 @@ struct _NMPlatformLink {
 	 * this field be set to (negative) NM_PLATFORM_LINK_OTHER_NETNS. */
 	int parent;
 
+	/* IFF_* flags. Note that the flags in 'struct ifinfomsg' are declared as 'unsigned'. */
+	guint n_ifi_flags;
+
+	guint mtu;
+
 	/* rtnl_link_get_arptype(), ifinfomsg.ifi_type. */
 	guint32 arptype;
 
@@ -146,15 +151,11 @@ struct _NMPlatformLink {
 	 * initialized with memset(0) has and unset value.*/
 	guint8 inet6_addr_gen_mode_inv;
 
-	/* IFF_* flags as u32. Note that ifi_flags in 'struct ifinfomsg' is declared as 'unsigned',
-	 * but libnl stores the flag internally as u32.  */
-	guint32 flags;
-
-	/* @connected is mostly identical to (@flags & IFF_UP). Except for bridge/bond masters,
+	/* @connected is mostly identical to (@n_ifi_flags & IFF_UP). Except for bridge/bond masters,
 	 * where we coerce the link as disconnect if it has no slaves. */
-	gboolean connected;
+	bool connected:1;
 
-	guint mtu;
+	bool initialized:1;
 };
 
 typedef enum { /*< skip >*/
@@ -268,7 +269,7 @@ struct _NMPlatformIP6Address {
 	__NMPlatformIPAddress_COMMON;
 	struct in6_addr address;
 	struct in6_addr peer_address;
-	guint flags; /* ifa_flags from <linux/if_addr.h>, field type "unsigned int" is as used in rtnl_addr_get_flags. */
+	guint32 n_ifa_flags; /* ifa_flags from <linux/if_addr.h>, field type "unsigned int" is as used in rtnl_addr_get_flags. */
 };
 
 typedef union {
@@ -362,16 +363,16 @@ extern const NMPlatformVTableRoute nm_platform_vtable_route_v4;
 extern const NMPlatformVTableRoute nm_platform_vtable_route_v6;
 
 typedef struct {
+	in_addr_t local;
+	in_addr_t remote;
 	int parent_ifindex;
 	guint16 input_flags;
 	guint16 output_flags;
 	guint32 input_key;
 	guint32 output_key;
-	in_addr_t local;
-	in_addr_t remote;
 	guint8 ttl;
 	guint8 tos;
-	gboolean path_mtu_discovery;
+	bool path_mtu_discovery:1;
 } NMPlatformLnkGre;
 
 typedef struct {
@@ -380,42 +381,42 @@ typedef struct {
 } NMPlatformLnkInfiniband;
 
 typedef struct {
-	int parent_ifindex;
 	struct in6_addr local;
 	struct in6_addr remote;
+	int parent_ifindex;
 	guint8 ttl;
 	guint8 tclass;
 	guint8 encap_limit;
-	guint flow_label;
 	guint8 proto;
+	guint flow_label;
 } NMPlatformLnkIp6Tnl;
 
 typedef struct {
-	int parent_ifindex;
 	in_addr_t local;
 	in_addr_t remote;
+	int parent_ifindex;
 	guint8 ttl;
 	guint8 tos;
-	gboolean path_mtu_discovery;
+	bool path_mtu_discovery:1;
 } NMPlatformLnkIpIp;
 
 typedef struct {
 	guint mode;
-	gboolean no_promisc;
-	gboolean tap;
+	bool no_promisc:1;
+	bool tap:1;
 } NMPlatformLnkMacvlan;
 
 typedef NMPlatformLnkMacvlan NMPlatformLnkMacvtap;
 
 typedef struct {
-	int parent_ifindex;
 	in_addr_t local;
 	in_addr_t remote;
+	int parent_ifindex;
 	guint8 ttl;
 	guint8 tos;
-	gboolean path_mtu_discovery;
-	guint16 flags;
 	guint8 proto;
+	bool path_mtu_discovery:1;
+	guint16 flags;
 } NMPlatformLnkSit;
 
 typedef struct {
@@ -425,33 +426,33 @@ typedef struct {
 } NMPlatformLnkVlan;
 
 typedef struct {
-	int parent_ifindex;
-	guint32 id;
-	in_addr_t group;
-	in_addr_t local;
 	struct in6_addr group6;
 	struct in6_addr local6;
-	guint8 tos;
-	guint8 ttl;
-	gboolean learning;
+	in_addr_t group;
+	in_addr_t local;
+	int parent_ifindex;
+	guint32 id;
 	guint32 ageing;
 	guint32 limit;
 	guint16 dst_port;
 	guint16 src_port_min;
 	guint16 src_port_max;
-	gboolean proxy;
-	gboolean rsc;
-	gboolean l2miss;
-	gboolean l3miss;
+	guint8 tos;
+	guint8 ttl;
+	bool learning:1;
+	bool proxy:1;
+	bool rsc:1;
+	bool l2miss:1;
+	bool l3miss:1;
 } NMPlatformLnkVxlan;
 
 typedef struct {
 	gint64 owner;
 	gint64 group;
 	const char *mode;
-	gboolean no_pi;
-	gboolean vnet_hdr;
-	gboolean multi_queue;
+	bool no_pi:1;
+	bool vnet_hdr:1;
+	bool multi_queue:1;
 } NMPlatformTunProperties;
 
 /******************************************************************/
@@ -593,7 +594,7 @@ typedef struct {
 	                             struct in6_addr peer_address,
 	                             guint32 lifetime,
 	                             guint32 preferred_lft,
-	                             guint flags);
+	                             guint32 flags);
 	gboolean (*ip4_address_delete) (NMPlatform *, int ifindex, in_addr_t address, int plen, in_addr_t peer_address);
 	gboolean (*ip6_address_delete) (NMPlatform *, int ifindex, struct in6_addr address, int plen);
 	const NMPlatformIP4Address *(*ip4_address_get) (NMPlatform *, int ifindex, in_addr_t address, int plen, in_addr_t peer_address);
@@ -666,7 +667,8 @@ _nm_platform_uint8_inv (guint8 scope)
 
 const char *nm_link_type_to_string (NMLinkType link_type);
 
-const char *nm_platform_error_to_string (NMPlatformError error);
+const char *_nm_platform_error_to_string (NMPlatformError error);
+#define nm_platform_error_to_string(error) NM_UTILS_LOOKUP_STR (_nm_platform_error_to_string, error)
 
 gboolean nm_platform_sysctl_set (NMPlatform *self, const char *path, const char *value);
 char *nm_platform_sysctl_get (NMPlatform *self, const char *path);
@@ -859,7 +861,7 @@ gboolean nm_platform_ip6_address_add (NMPlatform *self,
                                       struct in6_addr peer_address,
                                       guint32 lifetime,
                                       guint32 preferred_lft,
-                                      guint flags);
+                                      guint32 flags);
 gboolean nm_platform_ip4_address_delete (NMPlatform *self, int ifindex, in_addr_t address, int plen, in_addr_t peer_address);
 gboolean nm_platform_ip6_address_delete (NMPlatform *self, int ifindex, struct in6_addr address, int plen);
 gboolean nm_platform_ip4_address_sync (NMPlatform *self, int ifindex, const GArray *known_addresses, GPtrArray **out_added_addresses);