about summary refs log tree commit diff
path: root/src/nm-netlink-compat.h
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2012-03-24 01:37:02 +0100
committerMichael Biebl <biebl@debian.org>2012-03-24 01:37:02 +0100
commitde06e5715e780baade318f3490ac7a4c9ce84e32 (patch)
tree23fbc3fafc12072476eff98bee60100eb54c29db /src/nm-netlink-compat.h
parentb436a68a20ff3114ded32a7a3d70cdd4954039f9 (diff)
Imported Upstream version 0.9.4.0 upstream/0.9.4.0
Diffstat (limited to 'src/nm-netlink-compat.h')
-rw-r--r--src/nm-netlink-compat.h78
1 files changed, 76 insertions, 2 deletions
diff --git a/src/nm-netlink-compat.h b/src/nm-netlink-compat.h
index af21fb9a..eb0926ad 100644
--- a/src/nm-netlink-compat.h
+++ b/src/nm-netlink-compat.h
@@ -16,6 +16,7 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
  * Copyright (C) 2011 Caixa Magica Software.
+ * Copyright (C) 2011 - 2012 Red Hat, Inc.
  */
 
 #ifndef NM_NETLINK_COMPAT_H
@@ -68,7 +69,7 @@ __rtnl_link_alloc_cache (struct nl_sock *h, struct nl_cache **cache)
 
 /* functions with similar prototypes */
 #define nlmsg_datalen nlmsg_len
-#endif
+#endif  /* HAVE_LIBNL2 */
 
 
 /* libnl-1.0 compat functions */
@@ -202,6 +203,79 @@ __nl_cache_include (struct nl_cache *cache, struct nl_object *obj, change_func_t
 #define NLE_NOACCESS            27
 #define NLE_PERM                28
 #define NLE_PKTLOC_FILE         29
-#endif
+
+#endif  /* HAVE_LIBNL1 */
+
+/* Stuff that only libnl3 has */
+#if defined(HAVE_LIBNL1) || defined(HAVE_LIBNL2)
+
+static inline int
+rtnl_link_bond_add (struct nl_sock *h, const char *name, void *data)
+{
+	/* Bonding only in libnl3 */
+	return -NLE_OPNOTSUPP;
+}
+
+static inline int
+rtnl_link_get_kernel (struct nl_sock *h, int f, const char *name, struct rtnl_link **out_link)
+{
+	/* Bonding only in libnl3 */
+	return -NLE_OPNOTSUPP;
+}
+
+static inline char *
+rtnl_link_get_type (struct rtnl_link *rtnl_link)
+{
+	/* Bonding only in libnl3 */
+	return NULL;
+}
+
+static inline int
+rtnl_link_bond_enslave_ifindex (struct nl_sock *h, int master_ifidx, int slave_ifidx)
+{
+	/* Bonding only in libnl3 */
+	return -NLE_OPNOTSUPP;
+}
+
+static inline int
+rtnl_link_bond_release_ifindex (struct nl_sock *h, int slave_ifidx)
+{
+	/* Bonding only in libnl3 */
+	return -NLE_OPNOTSUPP;
+}
+
+static inline int
+rtnl_link_vlan_set_id (struct rtnl_link *l, int id)
+{
+	/* VLAN only in libnl3 */
+	return -NLE_OPNOTSUPP;
+}
+
+int rtnl_link_vlan_get_id (struct rtnl_link *l);
+int rtnl_link_vlan_set_flags (struct rtnl_link *l, unsigned int flags);
+int rtnl_link_vlan_set_ingress_map (struct rtnl_link *l, int from, uint32_t to);
+int rtnl_link_vlan_set_egress_map (struct rtnl_link *l, int from, uint32_t to);
+
+static inline int
+rtnl_link_set_type (struct rtnl_link *l, const char *type)
+{
+	/* Operation only in libnl3 */
+	return -NLE_OPNOTSUPP;
+}
+
+static inline int
+rtnl_link_add (struct nl_sock *sk, struct rtnl_link *l, int flags)
+{
+	/* Operation only in libnl3 */
+	return -NLE_OPNOTSUPP;
+}
+
+static inline int
+rtnl_link_delete(struct nl_sock *sk, const struct rtnl_link *l)
+{
+	/* Operation only in libnl3 */
+	return -NLE_OPNOTSUPP;
+}
+#endif  /* HAVE_LIBNL1 || HAVE_LIBNL2 */
 
 #endif /* NM_NETLINK_COMPAT_H */