Update to 3.2.26-rc1 (again)

The previous attempt to update to 3.2.26-rc broke some symbols.
This commit is contained in:
Thomas Haller 2015-03-07 10:50:25 +01:00
parent d5e2226a50
commit da56fdcb5e
8 changed files with 266 additions and 836 deletions

2
.gitignore vendored
View File

@ -13,3 +13,5 @@
/libnl-doc-3.2.25-rc1.tar.gz
/libnl-3.2.25.tar.gz
/libnl-doc-3.2.25.tar.gz
/libnl-3.2.26-rc1.tar.gz
/libnl-doc-3.2.26-rc1.tar.gz

View File

@ -1,203 +0,0 @@
From c4b26bbcfeb6ca3deaa926c6f7921df83e9db06c Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Fri, 26 Sep 2014 23:19:43 +0200
Subject: [PATCH] link/inet6: add support for tokenized interface identifiers
http://tools.ietf.org/html/draft-chown-6man-tokenised-ipv6-identifiers-02
[thaller@redhat.com: Add OOM handling, fix whitespace issues]
https://github.com/thom311/libnl/pull/63
(cherry picked from b0d0d339cd69834bd05cb5c704fbf06677f754eb)
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Thomas Haller <thaller@redhat.com>
---
include/Makefile.am | 1 +
include/linux/if_link.h | 1 +
include/netlink/route/link/inet6.h | 31 +++++++++++++++++
lib/route/link/inet6.c | 70 ++++++++++++++++++++++++++++++++++++++
4 files changed, 103 insertions(+)
create mode 100644 include/netlink/route/link/inet6.h
diff --git a/include/Makefile.am b/include/Makefile.am
index 765cf5a..40ed84f 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -48,6 +48,7 @@ nobase_libnlinclude_HEADERS = \
netlink/route/link/bridge.h \
netlink/route/link/can.h \
netlink/route/link/inet.h \
+ netlink/route/link/inet6.h \
netlink/route/link/info-api.h \
netlink/route/link/macvlan.h \
netlink/route/link/vlan.h \
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index 8b84939..bbe6991 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -196,6 +196,7 @@ enum {
IFLA_INET6_MCAST, /* MC things. What of them? */
IFLA_INET6_CACHEINFO, /* time values and max reasm size */
IFLA_INET6_ICMP6STATS, /* statistics (icmpv6) */
+ IFLA_INET6_TOKEN, /* device token */
__IFLA_INET6_MAX
};
diff --git a/include/netlink/route/link/inet6.h b/include/netlink/route/link/inet6.h
new file mode 100644
index 0000000..71886d7
--- /dev/null
+++ b/include/netlink/route/link/inet6.h
@@ -0,0 +1,31 @@
+/*
+ * netlink/route/link/inet6.h INET6 Link Module
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation version 2.1
+ * of the License.
+ *
+ * Copyright (c) 2014 Dan Williams <dcbw@redhat.com>
+ */
+
+#ifndef NETLINK_LINK_INET6_H_
+#define NETLINK_LINK_INET6_H_
+
+#include <netlink/netlink.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int rtnl_link_inet6_get_token(struct rtnl_link *,
+ struct nl_addr **);
+
+extern int rtnl_link_inet6_set_token(struct rtnl_link *,
+ struct nl_addr *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/lib/route/link/inet6.c b/lib/route/link/inet6.c
index 6fa2741..eb4fa3f 100644
--- a/lib/route/link/inet6.c
+++ b/lib/route/link/inet6.c
@@ -20,6 +20,7 @@ struct inet6_data
uint32_t i6_flags;
struct ifla_cacheinfo i6_cacheinfo;
uint32_t i6_conf[DEVCONF_MAX];
+ struct in6_addr i6_token;
};
static void *inet6_alloc(struct rtnl_link *link)
@@ -48,6 +49,7 @@ static struct nla_policy inet6_policy[IFLA_INET6_MAX+1] = {
[IFLA_INET6_CONF] = { .minlen = 4 },
[IFLA_INET6_STATS] = { .minlen = 8 },
[IFLA_INET6_ICMP6STATS] = { .minlen = 8 },
+ [IFLA_INET6_TOKEN] = { .minlen = sizeof(struct in6_addr) },
};
static const uint8_t map_stat_id_from_IPSTATS_MIB_v1[__IPSTATS_MIB_MAX] = {
@@ -155,6 +157,10 @@ static int inet6_parse_protinfo(struct rtnl_link *link, struct nlattr *attr,
if (tb[IFLA_INET6_CONF])
nla_memcpy(&i6->i6_conf, tb[IFLA_INET6_CONF],
sizeof(i6->i6_conf));
+
+ if (tb[IFLA_INET6_TOKEN])
+ nla_memcpy(&i6->i6_token, tb[IFLA_INET6_TOKEN],
+ sizeof(struct in6_addr));
/*
* Due to 32bit data alignment, these addresses must be copied to an
@@ -264,6 +270,7 @@ static void inet6_dump_details(struct rtnl_link *link,
struct nl_dump_params *p, void *data)
{
struct inet6_data *i6 = data;
+ struct nl_addr *addr;
char buf[64], buf2[64];
int i, n = 0;
@@ -281,6 +288,11 @@ static void inet6_dump_details(struct rtnl_link *link,
nl_dump(p, " retrans-time %s\n",
nl_msec2str(i6->i6_cacheinfo.retrans_time, buf, sizeof(buf)));
+ addr = nl_addr_build(AF_INET6, &i6->i6_token, sizeof(i6->i6_token));
+ nl_dump(p, " token %s\n",
+ nl_addr2str(addr, buf, sizeof(buf)));
+ nl_addr_put(addr);
+
nl_dump_line(p, " devconf:\n");
nl_dump_line(p, " ");
@@ -473,6 +485,64 @@ static struct rtnl_link_af_ops inet6_ops = {
.ao_protinfo_policy = &protinfo_policy,
};
+/**
+ * Get IPv6 tokenized interface identifier
+ * @arg link Link object
+ * @arg token Tokenized interface identifier on success
+ *
+ * Returns the link's IPv6 tokenized interface identifier.
+ *
+ * @return 0 on success
+ * @return -NLE_NOMEM failure to allocate struct nl_addr result
+ * @return -NLE_NOATTR configuration setting not available
+ * @return -NLE_NOADDR tokenized interface identifier is not set
+ */
+int rtnl_link_inet6_get_token(struct rtnl_link *link, struct nl_addr **addr)
+{
+ struct inet6_data *id;
+
+ if (!(id = rtnl_link_af_data(link, &inet6_ops)))
+ return -NLE_NOATTR;
+
+ *addr = nl_addr_build(AF_INET6, &id->i6_token, sizeof(id->i6_token));
+ if (!*addr)
+ return -NLE_NOMEM;
+ if (nl_addr_iszero(*addr)) {
+ nl_addr_put(*addr);
+ *addr = NULL;
+ return -NLE_NOADDR;
+ }
+
+ return 0;
+}
+
+/**
+ * Set IPv6 tokenized interface identifier
+ * @arg link Link object
+ * @arg token Tokenized interface identifier
+ *
+ * Sets the link's IPv6 tokenized interface identifier.
+ *
+ * @return 0 on success
+ * @return -NLE_NOMEM could not allocate inet6 data
+ * @return -NLE_INVAL addr is not a valid inet6 address
+ */
+int rtnl_link_inet6_set_token(struct rtnl_link *link, struct nl_addr *addr)
+{
+ struct inet6_data *id;
+
+ if ((nl_addr_get_family(addr) != AF_INET6) ||
+ (nl_addr_get_len(addr) != sizeof(id->i6_token)))
+ return -NLE_INVAL;
+
+ if (!(id = rtnl_link_af_alloc(link, &inet6_ops)))
+ return -NLE_NOMEM;
+
+ memcpy(&id->i6_token, nl_addr_get_binary_addr(addr),
+ sizeof(id->i6_token));
+ return 0;
+}
+
static void __init inet6_init(void)
{
rtnl_link_af_register(&inet6_ops);
--
1.9.3

147
0001-nl-socket-set-fd.patch Normal file
View File

@ -0,0 +1,147 @@
From 3b0d92d7b0df034d0e98be852569a6dec771121e Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Fri, 6 Mar 2015 12:33:49 +0100
Subject: [PATCH 1/1] lib/socket: detect protocol in nl_socket_set_fd()
With support for socket option SO_PROTOCOL we don't need the protocol
argument to nl_socket_set_fd(). Maybe we should drop the protocol argument
and just not support nl_socket_set_fd() on older systems. But instead
keep the argument and allow passing -1 to autodetect it.
If the user sets a protocol option, we check via getsockopt() that the
value is correct and error out otherwise.
On older kernels, the user must set the value. Otherwise
nl_socket_set_fd() will fail.
Signed-off-by: Thomas Haller <thaller@redhat.com>
(cherry picked from commit 24d333075ab4efa1406d836b821e1484a124dbfc)
---
lib/socket.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 63 insertions(+), 9 deletions(-)
diff --git a/lib/socket.c b/lib/socket.c
index 049b8b9..b29d1da 100644
--- a/lib/socket.c
+++ b/lib/socket.c
@@ -29,6 +29,8 @@
#include "defs.h"
+#include "sys/socket.h"
+
#include <netlink-private/netlink.h>
#include <netlink-private/socket.h>
#include <netlink/netlink.h>
@@ -577,7 +579,12 @@ int nl_socket_get_fd(const struct nl_sock *sk)
* socket similar to nl_connect().
*
* @arg sk Netlink socket (required)
- * @arg protocol Netlink protocol to use (required)
+ * @arg protocol The socket protocol (optional). Linux 2.6.32 supports
+ * the socket option SO_PROTOCOL. In this case, you can set
+ * protocol to a negative value and let it autodetect.
+ * If you set it to a non-negative value, the detected protocol
+ * must match the one provided.
+ * To support older kernels, you must specify the protocol.
* @arg fd Socket file descriptor to use (required)
*
* Set the socket file descriptor. @fd must be valid and bind'ed.
@@ -592,7 +599,7 @@ int nl_socket_get_fd(const struct nl_sock *sk)
* possibly unusable.
*
* @retval -NLE_BAD_SOCK Netlink socket is already connected
- * @retval -NLE_INVAL Socket is not connected
+ * @retval -NLE_INVAL Socket is of unexpected type
*/
int nl_socket_set_fd(struct nl_sock *sk, int protocol, int fd)
{
@@ -600,6 +607,7 @@ int nl_socket_set_fd(struct nl_sock *sk, int protocol, int fd)
socklen_t addrlen;
char buf[64];
struct sockaddr_nl local = { 0 };
+ int so_type = -1, so_protocol = -1;
if (sk->s_fd != -1)
return -NLE_BAD_SOCK;
@@ -610,16 +618,62 @@ int nl_socket_set_fd(struct nl_sock *sk, int protocol, int fd)
err = getsockname(fd, (struct sockaddr *) &local,
&addrlen);
if (err < 0) {
- NL_DBG(4, "nl_socket_set_fd(%p): getsockname() failed with %d (%s)\n",
- sk, errno, strerror_r(errno, buf, sizeof(buf)));
+ NL_DBG(4, "nl_socket_set_fd(%p,%d): getsockname() failed with %d (%s)\n",
+ sk, fd, errno, strerror_r(errno, buf, sizeof(buf)));
return -nl_syserr2nlerr(errno);
}
-
if (addrlen != sizeof(local))
- return -NLE_NOADDR;
+ return -NLE_INVAL;
+ if (local.nl_family != AF_NETLINK) {
+ NL_DBG(4, "nl_socket_set_fd(%p,%d): getsockname() returned family %d instead of %d (AF_NETLINK)\n",
+ sk, fd, local.nl_family, AF_NETLINK);
+ return -NLE_INVAL;
+ }
+
+ addrlen = sizeof(so_type);
+ err = getsockopt(fd, SOL_SOCKET, SO_TYPE, &so_type, &addrlen);
+ if (err < 0) {
+ NL_DBG(4, "nl_socket_set_fd(%p,%d): getsockopt() for SO_TYPE failed with %d (%s)\n",
+ sk, fd, errno, strerror_r(errno, buf, sizeof(buf)));
+ return -nl_syserr2nlerr(errno);
+ }
+ if (addrlen != sizeof(so_type))
+ return -NLE_INVAL;
+ if (so_type != SOCK_RAW) {
+ NL_DBG(4, "nl_socket_set_fd(%p,%d): getsockopt() returned SO_TYPE %d instead of %d (SOCK_RAW)\n",
+ sk, fd, so_type, SOCK_RAW);
+ return -NLE_INVAL;
+ }
- if (local.nl_family != AF_NETLINK)
- return -NLE_AF_NOSUPPORT;
+#if SO_PROTOCOL
+ addrlen = sizeof(so_protocol);
+ err = getsockopt(fd, SOL_SOCKET, SO_PROTOCOL, &so_protocol, &addrlen);
+ if (err < 0) {
+ if (errno == ENOPROTOOPT)
+ goto no_so_protocol;
+ NL_DBG(4, "nl_socket_set_fd(%p,%d): getsockopt() for SO_PROTOCOL failed with %d (%s)\n",
+ sk, fd, errno, strerror_r(errno, buf, sizeof(buf)));
+ return -nl_syserr2nlerr(errno);
+ }
+ if (addrlen != sizeof(so_protocol))
+ return -NLE_INVAL;
+ if (protocol >= 0 && protocol != so_protocol) {
+ NL_DBG(4, "nl_socket_set_fd(%p,%d): getsockopt() for SO_PROTOCOL returned %d instead of %d\n",
+ sk, fd, so_protocol, protocol);
+ return -NLE_INVAL;
+ }
+
+ if (0)
+#endif
+ {
+no_so_protocol:
+ if (protocol < 0) {
+ NL_DBG(4, "nl_socket_set_fd(%p,%d): unknown protocol and unable to detect it via SO_PROTOCOL socket option\n",
+ sk, fd);
+ return -NLE_INVAL;
+ }
+ so_protocol = protocol;
+ }
if (sk->s_local.nl_pid != local.nl_pid) {
/* the port id differs. The socket is using a port id not managed by
@@ -629,7 +683,7 @@ int nl_socket_set_fd(struct nl_sock *sk, int protocol, int fd)
}
sk->s_local = local;
sk->s_fd = fd;
- sk->s_proto = protocol;
+ sk->s_proto = so_protocol;
return 0;
}
--
1.9.3

99
0002-fedora-symbols.patch Normal file
View File

@ -0,0 +1,99 @@
From db6d08eb00fc84ecef0b14d79cc290470cfb4e98 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Mon, 9 Mar 2015 17:16:56 +0100
Subject: [PATCH 1/1] build: revert moving unstable symbols from libnl_3 linker
section
In the past, libnl3 had only one section (libnl_3) in the
linker version script. Between 3.2.25 and 3.2.26 release,
this was cleaned up and new symbols were added to libnl_3_2_26
section. Commit d2a30fb also moved new symbols since 3.2.25
to that section.
Fedora 21 and later already uses these symbols in the previous
version (@libnl_3). Updating there would break symbol lookup.
As we have users of the unstable version from pre-3.2.26, move
those symbols back. Note that this now breaks unstable users since
d2a30fb (5 weeks ago) -- which probably are much fewer affected
users.
Fixes: d2a30fbb36d668fe64f43bddfc9c53ee0362334f
Signed-off-by: Thomas Haller <thaller@redhat.com>
(cherry picked from commit cd4f66c321c91b10776af8749a60396185f462e1)
---
libnl-3.sym | 8 ++++++--
libnl-route-3.sym | 18 +++++++++++-------
2 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/libnl-3.sym b/libnl-3.sym
index c8ef8a3..621bfe0 100644
--- a/libnl-3.sym
+++ b/libnl-3.sym
@@ -320,13 +320,17 @@ global:
nlmsg_total_size;
nlmsg_valid_hdr;
nlmsg_validate;
+
+ # The following symbols were added during the development of 3.2.26.
+ # Keep them in libnl_3 to avoid breaking users.
+ nl_cache_pickup_checkdup;
+ nl_pickup_keep_syserr;
+
local:
*;
};
libnl_3_2_26 {
global:
- nl_cache_pickup_checkdup;
- nl_pickup_keep_syserr;
nl_socket_set_fd;
} libnl_3;
diff --git a/libnl-route-3.sym b/libnl-route-3.sym
index 139a499..03b7c4e 100644
--- a/libnl-route-3.sym
+++ b/libnl-route-3.sym
@@ -832,12 +832,9 @@ global:
rtnl_u32_set_hashmask;
rtnl_u32_set_hashtable;
rtnl_u32_set_link;
-local:
- *;
-};
-libnl_3_2_26 {
-global:
+ # The following symbols were added during the development of 3.2.26.
+ # Keep them in libnl_3 to avoid breaking users.
rtnl_class_hfsc_get_fsc;
rtnl_class_hfsc_get_rsc;
rtnl_class_hfsc_get_usc;
@@ -852,6 +849,15 @@ global:
rtnl_link_inet6_str2addrgenmode;
rtnl_qdisc_hfsc_get_defcls;
rtnl_qdisc_hfsc_set_defcls;
+ rtnl_u32_add_mark;
+ rtnl_u32_del_mark;
+
+local:
+ *;
+};
+
+libnl_3_2_26 {
+global:
rtnl_skbedit_get_action;
rtnl_skbedit_get_mark;
rtnl_skbedit_get_priority;
@@ -862,7 +868,5 @@ global:
rtnl_skbedit_set_queue_mapping;
rtnl_tc_stat2str;
rtnl_tc_str2stat;
- rtnl_u32_add_mark;
- rtnl_u32_del_mark;
rtnl_u32_get_classid;
} libnl_3;
--
1.9.3

View File

@ -1,586 +0,0 @@
From 5d3e671169b7588ca0718ca372f9ddf3296269f5 Mon Sep 17 00:00:00 2001
From: Dan Williams <dcbw@redhat.com>
Date: Fri, 25 Jul 2014 14:27:09 -0500
Subject: [PATCH 1/4] veth: add kernel header linux/veth.h for VETH defines
Similar to what's done with <linux/if_link.h>, make sure used defines
actually exist. Otherwise building on even slightly older kernels
fails.
Taken from upstream kernel commit 1860e379875dfe7271c649058aeddffe5afd9d0d
(tag: v3.15), file 'include/uapi/linux/veth.h'.
Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
(cherry picked from commit 9dc6e6da90016a33929f262bea0187396e1a061b)
---
include/linux/if_link.h | 8 --------
include/linux/veth.h | 12 ++++++++++++
lib/route/link/veth.c | 1 +
3 files changed, 13 insertions(+), 8 deletions(-)
create mode 100644 include/linux/veth.h
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index bbe6991..86a7945 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -314,14 +314,6 @@ struct ifla_vxlan_port_range {
__be16 high;
};
-enum {
- VETH_INFO_UNSPEC,
- VETH_INFO_PEER,
-
- __VETH_INFO_MAX
-#define VETH_INFO_MAX (__VETH_INFO_MAX - 1)
-};
-
/* SR-IOV virtual function management section */
enum {
diff --git a/include/linux/veth.h b/include/linux/veth.h
new file mode 100644
index 0000000..3354c1e
--- /dev/null
+++ b/include/linux/veth.h
@@ -0,0 +1,12 @@
+#ifndef __NET_VETH_H_
+#define __NET_VETH_H_
+
+enum {
+ VETH_INFO_UNSPEC,
+ VETH_INFO_PEER,
+
+ __VETH_INFO_MAX
+#define VETH_INFO_MAX (__VETH_INFO_MAX - 1)
+};
+
+#endif
diff --git a/lib/route/link/veth.c b/lib/route/link/veth.c
index e7e4a26..1c5b125 100644
--- a/lib/route/link/veth.c
+++ b/lib/route/link/veth.c
@@ -32,6 +32,7 @@
#include <netlink/route/link/veth.h>
#include <linux/if_link.h>
+#include <linux/veth.h>
static struct nla_policy veth_policy[VETH_INFO_MAX+1] = {
[VETH_INFO_PEER] = { .minlen = sizeof(struct ifinfomsg) },
--
1.9.3
From 8dbc6df4f386fca7b09ce894f19a0c2be4a64962 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Tue, 9 Dec 2014 17:47:51 +0100
Subject: [PATCH 2/4] build: mark header linux-private/linux/veth.h as
noinst_HEADERS
Fixes: 9dc6e6da90016a33929f262bea0187396e1a061b
(cherry picked from commit b56f88c9b3c22466fabeb1d751666bc4f79d347c)
Conflicts:
include/Makefile.am
---
include/Makefile.am | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/Makefile.am b/include/Makefile.am
index 40ed84f..41f700f 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -142,6 +142,7 @@ noinst_HEADERS = \
linux/pkt_sched.h \
linux/rtnetlink.h \
linux/snmp.h \
+ linux/veth.h \
linux/tc_ematch/tc_em_meta.h \
netlink-private/genl.h \
netlink-private/netlink.h \
--
1.9.3
From 609715e276167aaaaa64e0aa6c845f8bcf5eaa4f Mon Sep 17 00:00:00 2001
From: Dan Williams <dcbw@redhat.com>
Date: Fri, 25 Jul 2014 14:33:38 -0500
Subject: [PATCH 3/4] link: update copy of kernel header
include/linux/if_link.h
The next patch will use some of these defines, so update.
Taken from upstream kernel commit bc91b0f07ada5535427373a4e2050877bcc12218,
file 'include/uapi/linux/if_link.h'.
Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
(cherry picked from commit b51815a9dbd8e45fd2558bbe337fb360ca2fd861)
Conflicts:
include/linux/if_link.h
---
include/linux/if_link.h | 121 ++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 118 insertions(+), 3 deletions(-)
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index 86a7945..ff95760 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -144,12 +144,19 @@ enum {
IFLA_NUM_RX_QUEUES,
IFLA_CARRIER,
IFLA_PHYS_PORT_ID,
+ IFLA_CARRIER_CHANGES,
__IFLA_MAX
};
#define IFLA_MAX (__IFLA_MAX - 1)
+/* backwards compatibility for userspace */
+#ifndef __KERNEL__
+#define IFLA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifinfomsg))))
+#define IFLA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifinfomsg))
+#endif
+
enum {
IFLA_INET_UNSPEC,
IFLA_INET_CONF,
@@ -197,11 +204,17 @@ enum {
IFLA_INET6_CACHEINFO, /* time values and max reasm size */
IFLA_INET6_ICMP6STATS, /* statistics (icmpv6) */
IFLA_INET6_TOKEN, /* device token */
+ IFLA_INET6_ADDR_GEN_MODE, /* implicit address generator mode */
__IFLA_INET6_MAX
};
#define IFLA_INET6_MAX (__IFLA_INET6_MAX - 1)
+enum in6_addr_gen_mode {
+ IN6_ADDR_GEN_MODE_EUI64,
+ IN6_ADDR_GEN_MODE_NONE,
+};
+
enum {
BRIDGE_MODE_UNSPEC,
BRIDGE_MODE_HAIRPIN,
@@ -216,6 +229,8 @@ enum {
IFLA_BRPORT_GUARD, /* bpdu guard */
IFLA_BRPORT_PROTECT, /* root port protection */
IFLA_BRPORT_FAST_LEAVE, /* multicast fast leave */
+ IFLA_BRPORT_LEARNING, /* mac learning */
+ IFLA_BRPORT_UNICAST_FLOOD, /* flood unicast traffic */
__IFLA_BRPORT_MAX
};
#define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1)
@@ -232,6 +247,8 @@ enum {
IFLA_INFO_KIND,
IFLA_INFO_DATA,
IFLA_INFO_XSTATS,
+ IFLA_INFO_SLAVE_KIND,
+ IFLA_INFO_SLAVE_DATA,
__IFLA_INFO_MAX,
};
@@ -292,7 +309,7 @@ enum macvlan_mode {
enum {
IFLA_VXLAN_UNSPEC,
IFLA_VXLAN_ID,
- IFLA_VXLAN_GROUP,
+ IFLA_VXLAN_GROUP, /* group or remote address */
IFLA_VXLAN_LINK,
IFLA_VXLAN_LOCAL,
IFLA_VXLAN_TTL,
@@ -300,11 +317,17 @@ enum {
IFLA_VXLAN_LEARNING,
IFLA_VXLAN_AGEING,
IFLA_VXLAN_LIMIT,
- IFLA_VXLAN_PORT_RANGE,
+ IFLA_VXLAN_PORT_RANGE, /* source port */
IFLA_VXLAN_PROXY,
IFLA_VXLAN_RSC,
IFLA_VXLAN_L2MISS,
IFLA_VXLAN_L3MISS,
+ IFLA_VXLAN_PORT, /* destination port */
+ IFLA_VXLAN_GROUP6,
+ IFLA_VXLAN_LOCAL6,
+ IFLA_VXLAN_UDP_CSUM,
+ IFLA_VXLAN_UDP_ZERO_CSUM6_TX,
+ IFLA_VXLAN_UDP_ZERO_CSUM6_RX,
__IFLA_VXLAN_MAX
};
#define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1)
@@ -314,6 +337,63 @@ struct ifla_vxlan_port_range {
__be16 high;
};
+/* Bonding section */
+
+enum {
+ IFLA_BOND_UNSPEC,
+ IFLA_BOND_MODE,
+ IFLA_BOND_ACTIVE_SLAVE,
+ IFLA_BOND_MIIMON,
+ IFLA_BOND_UPDELAY,
+ IFLA_BOND_DOWNDELAY,
+ IFLA_BOND_USE_CARRIER,
+ IFLA_BOND_ARP_INTERVAL,
+ IFLA_BOND_ARP_IP_TARGET,
+ IFLA_BOND_ARP_VALIDATE,
+ IFLA_BOND_ARP_ALL_TARGETS,
+ IFLA_BOND_PRIMARY,
+ IFLA_BOND_PRIMARY_RESELECT,
+ IFLA_BOND_FAIL_OVER_MAC,
+ IFLA_BOND_XMIT_HASH_POLICY,
+ IFLA_BOND_RESEND_IGMP,
+ IFLA_BOND_NUM_PEER_NOTIF,
+ IFLA_BOND_ALL_SLAVES_ACTIVE,
+ IFLA_BOND_MIN_LINKS,
+ IFLA_BOND_LP_INTERVAL,
+ IFLA_BOND_PACKETS_PER_SLAVE,
+ IFLA_BOND_AD_LACP_RATE,
+ IFLA_BOND_AD_SELECT,
+ IFLA_BOND_AD_INFO,
+ __IFLA_BOND_MAX,
+};
+
+#define IFLA_BOND_MAX (__IFLA_BOND_MAX - 1)
+
+enum {
+ IFLA_BOND_AD_INFO_UNSPEC,
+ IFLA_BOND_AD_INFO_AGGREGATOR,
+ IFLA_BOND_AD_INFO_NUM_PORTS,
+ IFLA_BOND_AD_INFO_ACTOR_KEY,
+ IFLA_BOND_AD_INFO_PARTNER_KEY,
+ IFLA_BOND_AD_INFO_PARTNER_MAC,
+ __IFLA_BOND_AD_INFO_MAX,
+};
+
+#define IFLA_BOND_AD_INFO_MAX (__IFLA_BOND_AD_INFO_MAX - 1)
+
+enum {
+ IFLA_BOND_SLAVE_UNSPEC,
+ IFLA_BOND_SLAVE_STATE,
+ IFLA_BOND_SLAVE_MII_STATUS,
+ IFLA_BOND_SLAVE_LINK_FAILURE_COUNT,
+ IFLA_BOND_SLAVE_PERM_HWADDR,
+ IFLA_BOND_SLAVE_QUEUE_ID,
+ IFLA_BOND_SLAVE_AD_AGGREGATOR_ID,
+ __IFLA_BOND_SLAVE_MAX,
+};
+
+#define IFLA_BOND_SLAVE_MAX (__IFLA_BOND_SLAVE_MAX - 1)
+
/* SR-IOV virtual function management section */
enum {
@@ -328,8 +408,10 @@ enum {
IFLA_VF_UNSPEC,
IFLA_VF_MAC, /* Hardware queue specific attributes */
IFLA_VF_VLAN,
- IFLA_VF_TX_RATE, /* TX Bandwidth Allocation */
+ IFLA_VF_TX_RATE, /* Max TX Bandwidth Allocation */
IFLA_VF_SPOOFCHK, /* Spoof Checking on/off switch */
+ IFLA_VF_LINK_STATE, /* link state enable/disable/auto switch */
+ IFLA_VF_RATE, /* Min and Max TX Bandwidth Allocation */
__IFLA_VF_MAX,
};
@@ -351,11 +433,29 @@ struct ifla_vf_tx_rate {
__u32 rate; /* Max TX bandwidth in Mbps, 0 disables throttling */
};
+struct ifla_vf_rate {
+ __u32 vf;
+ __u32 min_tx_rate; /* Min Bandwidth in Mbps */
+ __u32 max_tx_rate; /* Max Bandwidth in Mbps */
+};
+
struct ifla_vf_spoofchk {
__u32 vf;
__u32 setting;
};
+enum {
+ IFLA_VF_LINK_STATE_AUTO, /* link state of the uplink */
+ IFLA_VF_LINK_STATE_ENABLE, /* link always up */
+ IFLA_VF_LINK_STATE_DISABLE, /* link always down */
+ __IFLA_VF_LINK_STATE_MAX,
+};
+
+struct ifla_vf_link_state {
+ __u32 vf;
+ __u32 link_state;
+};
+
/* VF ports management section
*
* Nested layout of set/get msg is:
@@ -446,4 +546,19 @@ enum {
#define IFLA_IPOIB_MAX (__IFLA_IPOIB_MAX - 1)
+
+/* HSR section */
+
+enum {
+ IFLA_HSR_UNSPEC,
+ IFLA_HSR_SLAVE1,
+ IFLA_HSR_SLAVE2,
+ IFLA_HSR_MULTICAST_SPEC, /* Last byte of supervision addr */
+ IFLA_HSR_SUPERVISION_ADDR, /* Supervision frame multicast addr */
+ IFLA_HSR_SEQ_NR,
+ __IFLA_HSR_MAX,
+};
+
+#define IFLA_HSR_MAX (__IFLA_HSR_MAX - 1)
+
#endif /* _UAPI_LINUX_IF_LINK_H */
--
1.9.3
From 1f2ba593c91d9c58652c4eb6e31694267b896261 Mon Sep 17 00:00:00 2001
From: Dan Williams <dcbw@redhat.com>
Date: Fri, 25 Jul 2014 14:36:29 -0500
Subject: [PATCH 4/4] link/inet6: add link IPv6 address generation mode support
Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
(cherry picked from commit 558f966782539f6d975da705fd73cea561c9dc83)
Conflicts:
include/netlink/route/link/inet6.h
lib/route/link/inet6.c
---
include/netlink/route/link/inet6.h | 12 ++++
lib/route/link/inet6.c | 115 +++++++++++++++++++++++++++++++++----
2 files changed, 117 insertions(+), 10 deletions(-)
diff --git a/include/netlink/route/link/inet6.h b/include/netlink/route/link/inet6.h
index 71886d7..7e81967 100644
--- a/include/netlink/route/link/inet6.h
+++ b/include/netlink/route/link/inet6.h
@@ -18,12 +18,24 @@
extern "C" {
#endif
+const char * rtnl_link_inet6_addrgenmode2str (uint8_t mode,
+ char *buf,
+ size_t len);
+
+uint8_t rtnl_link_inet6_str2addrgenmode (const char *mode);
+
extern int rtnl_link_inet6_get_token(struct rtnl_link *,
struct nl_addr **);
extern int rtnl_link_inet6_set_token(struct rtnl_link *,
struct nl_addr *);
+extern int rtnl_link_inet6_get_addr_gen_mode(struct rtnl_link *,
+ uint8_t *);
+
+extern int rtnl_link_inet6_set_addr_gen_mode(struct rtnl_link *,
+ uint8_t);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/route/link/inet6.c b/lib/route/link/inet6.c
index eb4fa3f..e3cf73a 100644
--- a/lib/route/link/inet6.c
+++ b/lib/route/link/inet6.c
@@ -15,17 +15,26 @@
#include <netlink/route/rtnl.h>
#include <netlink-private/route/link/api.h>
+#define I6_ADDR_GEN_MODE_UNKNOWN UINT8_MAX
+
struct inet6_data
{
uint32_t i6_flags;
struct ifla_cacheinfo i6_cacheinfo;
uint32_t i6_conf[DEVCONF_MAX];
struct in6_addr i6_token;
+ uint8_t i6_addr_gen_mode;
};
static void *inet6_alloc(struct rtnl_link *link)
{
- return calloc(1, sizeof(struct inet6_data));
+ struct inet6_data *i6;
+
+ i6 = calloc(1, sizeof(struct inet6_data));
+ if (i6)
+ i6->i6_addr_gen_mode = I6_ADDR_GEN_MODE_UNKNOWN;
+
+ return i6;
}
static void *inet6_clone(struct rtnl_link *link, void *data)
@@ -44,12 +53,13 @@ static void inet6_free(struct rtnl_link *link, void *data)
}
static struct nla_policy inet6_policy[IFLA_INET6_MAX+1] = {
- [IFLA_INET6_FLAGS] = { .type = NLA_U32 },
- [IFLA_INET6_CACHEINFO] = { .minlen = sizeof(struct ifla_cacheinfo) },
- [IFLA_INET6_CONF] = { .minlen = 4 },
- [IFLA_INET6_STATS] = { .minlen = 8 },
- [IFLA_INET6_ICMP6STATS] = { .minlen = 8 },
- [IFLA_INET6_TOKEN] = { .minlen = sizeof(struct in6_addr) },
+ [IFLA_INET6_FLAGS] = { .type = NLA_U32 },
+ [IFLA_INET6_CACHEINFO] = { .minlen = sizeof(struct ifla_cacheinfo) },
+ [IFLA_INET6_CONF] = { .minlen = 4 },
+ [IFLA_INET6_STATS] = { .minlen = 8 },
+ [IFLA_INET6_ICMP6STATS] = { .minlen = 8 },
+ [IFLA_INET6_TOKEN] = { .minlen = sizeof(struct in6_addr) },
+ [IFLA_INET6_ADDR_GEN_MODE] = { .type = NLA_U8 },
};
static const uint8_t map_stat_id_from_IPSTATS_MIB_v1[__IPSTATS_MIB_MAX] = {
@@ -160,8 +170,11 @@ static int inet6_parse_protinfo(struct rtnl_link *link, struct nlattr *attr,
if (tb[IFLA_INET6_TOKEN])
nla_memcpy(&i6->i6_token, tb[IFLA_INET6_TOKEN],
- sizeof(struct in6_addr));
-
+ sizeof(struct in6_addr));
+
+ if (tb[IFLA_INET6_ADDR_GEN_MODE])
+ i6->i6_addr_gen_mode = nla_get_u8 (tb[IFLA_INET6_ADDR_GEN_MODE]);
+
/*
* Due to 32bit data alignment, these addresses must be copied to an
* aligned location prior to access.
@@ -206,6 +219,19 @@ static int inet6_parse_protinfo(struct rtnl_link *link, struct nlattr *attr,
return 0;
}
+static int inet6_fill_af(struct rtnl_link *link, struct nl_msg *msg, void *data)
+{
+ struct inet6_data *id = data;
+
+ if (id->i6_addr_gen_mode != I6_ADDR_GEN_MODE_UNKNOWN)
+ NLA_PUT_U8(msg, IFLA_INET6_ADDR_GEN_MODE, id->i6_addr_gen_mode);
+
+ return 0;
+
+nla_put_failure:
+ return -NLE_MSGSIZE;
+}
+
/* These live in include/net/if_inet6.h and should be moved to include/linux */
#define IF_RA_OTHERCONF 0x80
#define IF_RA_MANAGED 0x40
@@ -265,6 +291,22 @@ static char *inet6_devconf2str(int type, char *buf, size_t len)
ARRAY_SIZE(inet6_devconf));
}
+static const struct trans_tbl inet6_addr_gen_mode[] = {
+ __ADD(IN6_ADDR_GEN_MODE_EUI64, eui64)
+ __ADD(IN6_ADDR_GEN_MODE_NONE, none)
+};
+
+const char *rtnl_link_inet6_addrgenmode2str(uint8_t mode, char *buf, size_t len)
+{
+ return __type2str(mode, buf, len, inet6_addr_gen_mode,
+ ARRAY_SIZE(inet6_addr_gen_mode));
+}
+
+uint8_t rtnl_link_inet6_str2addrgenmode(const char *mode)
+{
+ return (uint8_t) __str2type(mode, inet6_addr_gen_mode,
+ ARRAY_SIZE(inet6_addr_gen_mode));
+}
static void inet6_dump_details(struct rtnl_link *link,
struct nl_dump_params *p, void *data)
@@ -293,6 +335,10 @@ static void inet6_dump_details(struct rtnl_link *link,
nl_addr2str(addr, buf, sizeof(buf)));
nl_addr_put(addr);
+ nl_dump(p, " link-local address mode %s\n",
+ rtnl_link_inet6_addrgenmode2str(i6->i6_addr_gen_mode,
+ buf, sizeof(buf)));
+
nl_dump_line(p, " devconf:\n");
nl_dump_line(p, " ");
@@ -480,6 +526,7 @@ static struct rtnl_link_af_ops inet6_ops = {
.ao_free = &inet6_free,
.ao_parse_protinfo = &inet6_parse_protinfo,
.ao_parse_af = &inet6_parse_protinfo,
+ .ao_fill_af = &inet6_fill_af,
.ao_dump[NL_DUMP_DETAILS] = &inet6_dump_details,
.ao_dump[NL_DUMP_STATS] = &inet6_dump_stats,
.ao_protinfo_policy = &protinfo_policy,
@@ -493,7 +540,7 @@ static struct rtnl_link_af_ops inet6_ops = {
* Returns the link's IPv6 tokenized interface identifier.
*
* @return 0 on success
- * @return -NLE_NOMEM failure to allocate struct nl_addr result
+ * @return -NLE_NOMEM failure to allocate struct nl_addr result
* @return -NLE_NOATTR configuration setting not available
* @return -NLE_NOADDR tokenized interface identifier is not set
*/
@@ -543,6 +590,54 @@ int rtnl_link_inet6_set_token(struct rtnl_link *link, struct nl_addr *addr)
return 0;
}
+/**
+ * Get IPv6 link-local address generation mode
+ * @arg link Link object
+ * @arg mode Generation mode on success
+ *
+ * Returns the link's IPv6 link-local address generation mode.
+ *
+ * @return 0 on success
+ * @return -NLE_NOATTR configuration setting not available
+ * @return -NLE_INVAL generation mode unknown. If the link was received via
+ * netlink, it means that address generation mode is not
+ * supported by the kernel.
+ */
+int rtnl_link_inet6_get_addr_gen_mode(struct rtnl_link *link, uint8_t *mode)
+{
+ struct inet6_data *id;
+
+ if (!(id = rtnl_link_af_data(link, &inet6_ops)))
+ return -NLE_NOATTR;
+
+ if (id->i6_addr_gen_mode == I6_ADDR_GEN_MODE_UNKNOWN)
+ return -NLE_INVAL;
+
+ *mode = id->i6_addr_gen_mode;
+ return 0;
+}
+
+/**
+ * Set IPv6 link-local address generation mode
+ * @arg link Link object
+ * @arg mode Generation mode
+ *
+ * Sets the link's IPv6 link-local address generation mode.
+ *
+ * @return 0 on success
+ * @return -NLE_NOMEM could not allocate inet6 data
+ */
+int rtnl_link_inet6_set_addr_gen_mode(struct rtnl_link *link, uint8_t mode)
+{
+ struct inet6_data *id;
+
+ if (!(id = rtnl_link_af_alloc(link, &inet6_ops)))
+ return -NLE_NOMEM;
+
+ id->i6_addr_gen_mode = mode;
+ return 0;
+}
+
static void __init inet6_init(void)
{
rtnl_link_af_register(&inet6_ops);
--
1.9.3

View File

@ -1,32 +0,0 @@
From 8d37b0184165ab2eece798c17146b290cfd3103c Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Mon, 5 Jan 2015 12:12:25 +0100
Subject: [PATCH 1/1] python: fix package meta data in setup.py
http://lists.infradead.org/pipermail/libnl/2015-January/001802.html
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
(cherry picked from commit c7ae0c7d67d376bb8a3fbbe8e35a25de7e4c8ebd)
---
python/setup.py.in | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/python/setup.py.in b/python/setup.py.in
index 346c770..0cd35d0 100644
--- a/python/setup.py.in
+++ b/python/setup.py.in
@@ -35,6 +35,10 @@ setup(name = 'netlink',
description = 'Python wrapper for netlink protocols',
author = 'Thomas Graf',
author_email = 'tgraf@suug.ch',
+ url = 'http://www.infradead.org/~tgr/libnl/',
+ license = 'LGPL 2',
+ platforms = 'linux2',
+ long_description = 'Experimental python bindings for libnl',
ext_modules = [netlink_capi, route_capi, genl_capi],
package_dir = {'': '@srcdir@'},
packages = ['netlink', 'netlink.genl', 'netlink.route',
--
1.9.3

View File

@ -1,18 +1,17 @@
Name: libnl3
Version: 3.2.26
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Convenience library for kernel netlink sockets
Group: Development/Libraries
License: LGPLv2
URL: http://www.infradead.org/~tgr/libnl/
%define fullversion 3.2.25
%define fullversion %{version}-rc1
Source: http://www.infradead.org/~tgr/libnl/files/libnl-%{fullversion}.tar.gz
Source1: http://www.infradead.org/~tgr/libnl/files/libnl-doc-%{fullversion}.tar.gz
Patch1: 0001-link-inet6-add-support-for-tokenized-interface-ident.patch
Patch2: 0002-i6-addr-gen-mode.patch
Patch3: 0003-fix-python-meta-data.patch
Patch1: 0001-nl-socket-set-fd.patch
Patch2: 0002-fedora-symbols.patch
BuildRequires: flex bison
BuildRequires: python
@ -71,9 +70,8 @@ Python 3 bindings for libnl3
%prep
%setup -q -n libnl-%{fullversion}
%patch1 -p1 -b .0001-link-inet6-add-support-for-tokenized-interface-ident.orig
%patch2 -p1 -b .0002-i6-addr-gen-mode.orig
%patch3 -p1 -b .0003-fix-python-meta-data.orig
%patch1 -p1 -b .0001-nl-socket-set-fd.orig
%patch2 -p1 -b .0002-fedora-symbols.orig
tar -xzf %SOURCE1
@ -154,14 +152,19 @@ popd
%{python3_sitearch}/netlink-*.egg-info
%changelog
* Mon Mar 9 2015 Thomas Haller <thaller@redhat.com> - 3.2.26-3
- Update to 3.2.26-rc1
- fix broken symbols from 3.2.26-1
- backport upstream fix for nl_socket_set_fd()
* Sat Mar 7 2015 Thomas Haller <thaller@redhat.com> - 3.2.26-2
* Revert update to 3.2.26-rc1 to previous 3.2.25-6
- Revert update to 3.2.26-rc1 to previous 3.2.25-6
* Fri Mar 6 2015 Thomas Haller <thaller@redhat.com> - 3.2.26-1
* Update to 3.2.26-rc1
- Update to 3.2.26-rc1
* Tue Feb 3 2015 Thomas Haller <thaller@redhat.com> - 3.2.25-6
* add new packages with language bindings for Python 2 and Python 3 (rh #1167112)
- add new packages with language bindings for Python 2 and Python 3 (rh #1167112)
* Tue Dec 9 2014 Thomas Haller <thaller@redhat.com> - 3.2.25-5
- Add support for IPv6 link local address generation
@ -173,10 +176,10 @@ popd
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
* Wed Jul 16 2014 Thomas Haller <thaller@redhat.com> 3.2.25-2
* Update to 3.2.25
- Update to 3.2.25
* Fri Jul 4 2014 Thomas Haller <thaller@redhat.com> 3.2.25-1
* Update to 3.2.25-rc1
- Update to 3.2.25-rc1
* Sun Jun 8 2014 Peter Robinson <pbrobinson@fedoraproject.org> 3.2.24-5
- Run autoreconf for new automake, cleanup spec

View File

@ -1,2 +1,2 @@
03f74d0cd5037cadc8cdfa313bbd195c libnl-3.2.25.tar.gz
641f73052d9f54e720efe1a476a20237 libnl-doc-3.2.25.tar.gz
1d2bf6120ec2f479df9aa43d876f06b9 libnl-3.2.26-rc1.tar.gz
5af8721bedc132c9fb8bcc3f2c6ee2f9 libnl-doc-3.2.26-rc1.tar.gz