From e3ad848f1c534444add715f9d8b856fae70c713d Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Nov 19 2015 16:13:39 +0000 Subject: import libnl3-3.2.21-10.el7 --- diff --git a/SOURCES/0011-support-IFLA_LINK_NETNSID-rh1255050.patch b/SOURCES/0011-support-IFLA_LINK_NETNSID-rh1255050.patch new file mode 100644 index 0000000..0ddd772 --- /dev/null +++ b/SOURCES/0011-support-IFLA_LINK_NETNSID-rh1255050.patch @@ -0,0 +1,539 @@ +From 42d8ecc85940e86213d194ae81bb74d174726084 Mon Sep 17 00:00:00 2001 +From: Thomas Graf +Date: Sat, 9 Nov 2013 10:04:35 +0100 +Subject: [PATCH 1/4] link: Fall back to global provisioned link cache if + object is not a cache resident + +... if that fails, print ifindices directly. + +Reported-by: Dan Williams +Signed-off-by: Thomas Graf +(cherry picked from commit 04040110cde4966e287e8d04a8ebea2855c89a79) +--- + lib/route/link.c | 31 +++++++++++++++++++++++-------- + 1 file changed, 23 insertions(+), 8 deletions(-) + +diff --git a/lib/route/link.c b/lib/route/link.c +index 1f27247..49a8b65 100644 +--- a/lib/route/link.c ++++ b/lib/route/link.c +@@ -599,6 +599,12 @@ static void link_dump_line(struct nl_object *obj, struct nl_dump_params *p) + char buf[128]; + struct nl_cache *cache = obj->ce_cache; + struct rtnl_link *link = (struct rtnl_link *) obj; ++ int fetched_cache = 0; ++ ++ if (!cache) { ++ cache = nl_cache_mngt_require_safe("route/link"); ++ fetched_cache = 1; ++ } + + nl_dump_line(p, "%s %s ", link->l_name, + nl_llproto2str(link->l_arptype, buf, sizeof(buf))); +@@ -607,10 +613,13 @@ static void link_dump_line(struct nl_object *obj, struct nl_dump_params *p) + nl_dump(p, "%s ", nl_addr2str(link->l_addr, buf, sizeof(buf))); + + if (link->ce_mask & LINK_ATTR_MASTER) { +- struct rtnl_link *master = rtnl_link_get(cache, link->l_master); +- nl_dump(p, "master %s ", master ? master->l_name : "inv"); +- if (master) +- rtnl_link_put(master); ++ if (cache) { ++ struct rtnl_link *master = rtnl_link_get(cache, link->l_master); ++ nl_dump(p, "master %s ", master ? master->l_name : "inv"); ++ if (master) ++ rtnl_link_put(master); ++ } else ++ nl_dump(p, "master %d ", link->l_master); + } + + rtnl_link_flags2str(link->l_flags, buf, sizeof(buf)); +@@ -618,10 +627,13 @@ static void link_dump_line(struct nl_object *obj, struct nl_dump_params *p) + nl_dump(p, "<%s> ", buf); + + if (link->ce_mask & LINK_ATTR_LINK) { +- struct rtnl_link *ll = rtnl_link_get(cache, link->l_link); +- nl_dump(p, "slave-of %s ", ll ? ll->l_name : "NONE"); +- if (ll) +- rtnl_link_put(ll); ++ if (cache) { ++ struct rtnl_link *ll = rtnl_link_get(cache, link->l_link); ++ nl_dump(p, "slave-of %s ", ll ? ll->l_name : "NONE"); ++ if (ll) ++ rtnl_link_put(ll); ++ } else ++ nl_dump(p, "slave-of %d ", link->l_link); + } + + if (link->ce_mask & LINK_ATTR_GROUP) +@@ -633,6 +645,9 @@ static void link_dump_line(struct nl_object *obj, struct nl_dump_params *p) + do_foreach_af(link, af_dump_line, p); + + nl_dump(p, "\n"); ++ ++ if (fetched_cache) ++ nl_cache_put(cache); + } + + static void link_dump_details(struct nl_object *obj, struct nl_dump_params *p) +-- +2.4.3 + + +From a67cd6a68c16292f724269bc8da5f2f2501cacb7 Mon Sep 17 00:00:00 2001 +From: Cong Wang +Date: Tue, 9 Jun 2015 21:53:09 -0700 +Subject: [PATCH 2/4] include/linux: update copy of kernel header "if_link.h" + +Taken from upstream kernel commit b953c0d234bc72e8489d3bf51a276c5c4ec85345 +(v4.1), file 'include/uapi/linux/if_link.h' (after `make headers_install`). + +Signed-off-by: Thomas Haller +(cherry picked from commit f808b84a5de7c33694d362807e897d8a064b9bcd) +--- + include/linux/if_link.h | 69 +++++++++++++++++++++++++++++++++++++++++++++---- + 1 file changed, 64 insertions(+), 5 deletions(-) + +diff --git a/include/linux/if_link.h b/include/linux/if_link.h +index ff95760..3d0d613 100644 +--- a/include/linux/if_link.h ++++ b/include/linux/if_link.h +@@ -1,5 +1,5 @@ +-#ifndef _UAPI_LINUX_IF_LINK_H +-#define _UAPI_LINUX_IF_LINK_H ++#ifndef _LINUX_IF_LINK_H ++#define _LINUX_IF_LINK_H + + #include + #include +@@ -145,6 +145,9 @@ enum { + IFLA_CARRIER, + IFLA_PHYS_PORT_ID, + IFLA_CARRIER_CHANGES, ++ IFLA_PHYS_SWITCH_ID, ++ IFLA_LINK_NETNSID, ++ IFLA_PHYS_PORT_NAME, + __IFLA_MAX + }; + +@@ -152,10 +155,8 @@ enum { + #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, +@@ -213,8 +214,24 @@ enum { + enum in6_addr_gen_mode { + IN6_ADDR_GEN_MODE_EUI64, + IN6_ADDR_GEN_MODE_NONE, ++ IN6_ADDR_GEN_MODE_STABLE_PRIVACY, + }; + ++/* Bridge section */ ++ ++enum { ++ IFLA_BR_UNSPEC, ++ IFLA_BR_FORWARD_DELAY, ++ IFLA_BR_HELLO_TIME, ++ IFLA_BR_MAX_AGE, ++ IFLA_BR_AGEING_TIME, ++ IFLA_BR_STP_STATE, ++ IFLA_BR_PRIORITY, ++ __IFLA_BR_MAX, ++}; ++ ++#define IFLA_BR_MAX (__IFLA_BR_MAX - 1) ++ + enum { + BRIDGE_MODE_UNSPEC, + BRIDGE_MODE_HAIRPIN, +@@ -231,6 +248,9 @@ enum { + IFLA_BRPORT_FAST_LEAVE, /* multicast fast leave */ + IFLA_BRPORT_LEARNING, /* mac learning */ + IFLA_BRPORT_UNICAST_FLOOD, /* flood unicast traffic */ ++ IFLA_BRPORT_PROXYARP, /* proxy ARP */ ++ IFLA_BRPORT_LEARNING_SYNC, /* mac learning sync from device */ ++ IFLA_BRPORT_PROXYARP_WIFI, /* proxy ARP for Wi-Fi */ + __IFLA_BRPORT_MAX + }; + #define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1) +@@ -291,6 +311,10 @@ enum { + IFLA_MACVLAN_UNSPEC, + IFLA_MACVLAN_MODE, + IFLA_MACVLAN_FLAGS, ++ IFLA_MACVLAN_MACADDR_MODE, ++ IFLA_MACVLAN_MACADDR, ++ IFLA_MACVLAN_MACADDR_DATA, ++ IFLA_MACVLAN_MACADDR_COUNT, + __IFLA_MACVLAN_MAX, + }; + +@@ -301,10 +325,33 @@ enum macvlan_mode { + MACVLAN_MODE_VEPA = 2, /* talk to other ports through ext bridge */ + MACVLAN_MODE_BRIDGE = 4, /* talk to bridge ports directly */ + MACVLAN_MODE_PASSTHRU = 8,/* take over the underlying device */ ++ MACVLAN_MODE_SOURCE = 16,/* use source MAC address list to assign */ ++}; ++ ++enum macvlan_macaddr_mode { ++ MACVLAN_MACADDR_ADD, ++ MACVLAN_MACADDR_DEL, ++ MACVLAN_MACADDR_FLUSH, ++ MACVLAN_MACADDR_SET, + }; + + #define MACVLAN_FLAG_NOPROMISC 1 + ++/* IPVLAN section */ ++enum { ++ IFLA_IPVLAN_UNSPEC, ++ IFLA_IPVLAN_MODE, ++ __IFLA_IPVLAN_MAX ++}; ++ ++#define IFLA_IPVLAN_MAX (__IFLA_IPVLAN_MAX - 1) ++ ++enum ipvlan_mode { ++ IPVLAN_MODE_L2 = 0, ++ IPVLAN_MODE_L3, ++ IPVLAN_MODE_MAX ++}; ++ + /* VXLAN section */ + enum { + IFLA_VXLAN_UNSPEC, +@@ -328,6 +375,10 @@ enum { + IFLA_VXLAN_UDP_CSUM, + IFLA_VXLAN_UDP_ZERO_CSUM6_TX, + IFLA_VXLAN_UDP_ZERO_CSUM6_RX, ++ IFLA_VXLAN_REMCSUM_TX, ++ IFLA_VXLAN_REMCSUM_RX, ++ IFLA_VXLAN_GBP, ++ IFLA_VXLAN_REMCSUM_NOPARTIAL, + __IFLA_VXLAN_MAX + }; + #define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1) +@@ -412,6 +463,9 @@ enum { + 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_RSS_QUERY_EN, /* RSS Redirection Table and Hash Key query ++ * on/off switch ++ */ + __IFLA_VF_MAX, + }; + +@@ -456,6 +510,11 @@ struct ifla_vf_link_state { + __u32 link_state; + }; + ++struct ifla_vf_rss_query_en { ++ __u32 vf; ++ __u32 setting; ++}; ++ + /* VF ports management section + * + * Nested layout of set/get msg is: +@@ -561,4 +620,4 @@ enum { + + #define IFLA_HSR_MAX (__IFLA_HSR_MAX - 1) + +-#endif /* _UAPI_LINUX_IF_LINK_H */ ++#endif /* _LINUX_IF_LINK_H */ +-- +2.4.3 + + +From f348f1be682ea7be2d6953162d618c0b8f69e2ab Mon Sep 17 00:00:00 2001 +From: Thomas Haller +Date: Fri, 14 Aug 2015 17:32:38 +0200 +Subject: [PATCH 3/4] route/link: add support for IFLA_LINK_NETNSID + +Signed-off-by: Thomas Haller +(cherry picked from commit 66aab65595fb20bf166936fcfa4c8568b58f7f68) +--- + include/netlink-private/types.h | 3 ++- + include/netlink/route/link.h | 14 ++++++++++++ + lib/route/link.c | 49 ++++++++++++++++++++++++++++++++++++++++- + 3 files changed, 64 insertions(+), 2 deletions(-) + +diff --git a/include/netlink-private/types.h b/include/netlink-private/types.h +index 70b95c1..598e79e 100644 +--- a/include/netlink-private/types.h ++++ b/include/netlink-private/types.h +@@ -157,8 +157,9 @@ struct rtnl_link + uint32_t l_index; + uint32_t l_flags; + uint32_t l_change; +- uint32_t l_mtu; ++ uint32_t l_mtu; + uint32_t l_link; ++ uint32_t l_link_netnsid; + uint32_t l_txqlen; + uint32_t l_weight; + uint32_t l_master; +diff --git a/include/netlink/route/link.h b/include/netlink/route/link.h +index 2d061be..ca37f66 100644 +--- a/include/netlink/route/link.h ++++ b/include/netlink/route/link.h +@@ -201,6 +201,20 @@ extern uint8_t rtnl_link_get_operstate(struct rtnl_link *); + extern void rtnl_link_set_linkmode(struct rtnl_link *, uint8_t); + extern uint8_t rtnl_link_get_linkmode(struct rtnl_link *); + ++#ifdef NL_RHEL7_ENABLE_LINK_NETNSID ++/* The API for IFLA_LINK_NETNSID was backported from upstream to ++ * RHEL-7 (https://bugzilla.redhat.com/show_bug.cgi?id=1255050). ++ * Using backported API can cause problems when upgrading ++ * or downgrading the libnl package or when the user chooses to ++ * compile libnl from upstream source. ++ * ++ * Only use it if you understand the consequences and are willing ++ * to cope with them. ++ * */ ++int rtnl_link_set_link_netnsid(struct rtnl_link *link, uint32_t link_netnsid); ++int rtnl_link_get_link_netnsid(const struct rtnl_link *link, uint32_t *out_link_netnsid); ++#endif ++ + extern const char * rtnl_link_get_ifalias(struct rtnl_link *); + extern void rtnl_link_set_ifalias(struct rtnl_link *, const char *); + +diff --git a/lib/route/link.c b/lib/route/link.c +index 49a8b65..d914fd5 100644 +--- a/lib/route/link.c ++++ b/lib/route/link.c +@@ -57,6 +57,7 @@ + #define LINK_ATTR_CARRIER (1 << 25) + #define LINK_ATTR_PROTINFO (1 << 26) + #define LINK_ATTR_AF_SPEC (1 << 27) ++#define LINK_ATTR_LINK_NETNSID (1 << 31) + + static struct nl_cache_ops rtnl_link_ops; + static struct nl_object_ops link_obj_ops; +@@ -443,6 +444,11 @@ static int link_msg_parser(struct nl_cache_ops *ops, struct sockaddr_nl *who, + link->ce_mask |= LINK_ATTR_LINK; + } + ++ if (tb[IFLA_LINK_NETNSID]) { ++ link->l_link_netnsid = nla_get_u32(tb[IFLA_LINK_NETNSID]); ++ link->ce_mask |= LINK_ATTR_LINK_NETNSID; ++ } ++ + if (tb[IFLA_WEIGHT]) { + link->l_weight = nla_get_u32(tb[IFLA_WEIGHT]); + link->ce_mask |= LINK_ATTR_WEIGHT; +@@ -627,7 +633,8 @@ static void link_dump_line(struct nl_object *obj, struct nl_dump_params *p) + nl_dump(p, "<%s> ", buf); + + if (link->ce_mask & LINK_ATTR_LINK) { +- if (cache) { ++ if ( cache ++ && !(link->ce_mask & LINK_ATTR_LINK_NETNSID)) { + struct rtnl_link *ll = rtnl_link_get(cache, link->l_link); + nl_dump(p, "slave-of %s ", ll ? ll->l_name : "NONE"); + if (ll) +@@ -635,6 +642,8 @@ static void link_dump_line(struct nl_object *obj, struct nl_dump_params *p) + } else + nl_dump(p, "slave-of %d ", link->l_link); + } ++ if (link->ce_mask & LINK_ATTR_LINK_NETNSID) ++ nl_dump(p, "link-netnsid %u ", link->l_link_netnsid); + + if (link->ce_mask & LINK_ATTR_GROUP) + nl_dump(p, "group %u ", link->l_group); +@@ -858,6 +867,7 @@ static int link_compare(struct nl_object *_a, struct nl_object *_b, + diff |= LINK_DIFF(IFINDEX, a->l_index != b->l_index); + diff |= LINK_DIFF(MTU, a->l_mtu != b->l_mtu); + diff |= LINK_DIFF(LINK, a->l_link != b->l_link); ++ diff |= LINK_DIFF(LINK_NETNSID, a->l_link_netnsid != b->l_link_netnsid); + diff |= LINK_DIFF(TXQLEN, a->l_txqlen != b->l_txqlen); + diff |= LINK_DIFF(WEIGHT, a->l_weight != b->l_weight); + diff |= LINK_DIFF(MASTER, a->l_master != b->l_master); +@@ -1238,6 +1248,9 @@ static int build_link_msg(int cmd, struct ifinfomsg *hdr, + if (link->ce_mask & LINK_ATTR_LINK) + NLA_PUT_U32(msg, IFLA_LINK, link->l_link); + ++ if (link->ce_mask & LINK_ATTR_LINK_NETNSID) ++ NLA_PUT_U32(msg, IFLA_LINK_NETNSID, link->l_link_netnsid); ++ + if (link->ce_mask & LINK_ATTR_MASTER) + NLA_PUT_U32(msg, IFLA_MASTER, link->l_master); + +@@ -1894,6 +1907,40 @@ int rtnl_link_get_link(struct rtnl_link *link) + } + + /** ++ * Set the netnsid of the link ++ * @arg link Link object ++ * @link_netnsid the netnsid to set ++ * ++ * Sets the IFLA_LINK_NETNSID attribute of the link ++ * @returns 0 on success ++ */ ++int rtnl_link_set_link_netnsid(struct rtnl_link *link, uint32_t link_netnsid) ++{ ++ link->l_link_netnsid = link_netnsid; ++ link->ce_mask |= LINK_ATTR_LINK_NETNSID; ++ return 0; ++} ++ ++/** ++ * Get the netnsid of the link ++ * @arg link Link object ++ * @out_link_netnsid the netnsid ++ * ++ * Gets the IFLA_LINK_NETNSID attribute of the link ++ * or returns an error if the value is unset. ++ * ++ * @returns 0 on success ++ */ ++int rtnl_link_get_link_netnsid(const struct rtnl_link *link, uint32_t *out_link_netnsid) ++{ ++ if (!(link->ce_mask & LINK_ATTR_LINK_NETNSID)) ++ return -NLE_INVAL; ++ ++ *out_link_netnsid = link->l_link_netnsid; ++ return 0; ++} ++ ++/** + * Set master link of link object + * @arg link Link object + * @arg ifindex Interface index of master link +-- +2.4.3 + + +From 7b4336d26a83d5de10bbaf67804400995848a51c Mon Sep 17 00:00:00 2001 +From: Thomas Haller +Date: Fri, 14 Aug 2015 17:32:36 +0200 +Subject: [PATCH 4/4] route/link: make link_netnsid argument (signed) int32_t + +Fixes: 66aab65595fb20bf166936fcfa4c8568b58f7f68 + +Signed-off-by: Thomas Haller +(cherry picked from commit 2fc97e66e7f509e89f36aa601939c314bdfe6c08) + +[thaller@redhat.com: while backporting, the patch was modified and +partially merged with commit 7bb956501ccd58ed3bbffc59de996f056e178683. +Instead of backporting new API for s32 attributes, it was defined locally] +--- + include/netlink-private/types.h | 2 +- + include/netlink/route/link.h | 4 ++-- + lib/route/link.c | 32 +++++++++++++++++++++++++++----- + 3 files changed, 30 insertions(+), 8 deletions(-) + +diff --git a/include/netlink-private/types.h b/include/netlink-private/types.h +index 598e79e..0550e8a 100644 +--- a/include/netlink-private/types.h ++++ b/include/netlink-private/types.h +@@ -159,7 +159,7 @@ struct rtnl_link + uint32_t l_change; + uint32_t l_mtu; + uint32_t l_link; +- uint32_t l_link_netnsid; ++ int32_t l_link_netnsid; + uint32_t l_txqlen; + uint32_t l_weight; + uint32_t l_master; +diff --git a/include/netlink/route/link.h b/include/netlink/route/link.h +index ca37f66..e1e6e20 100644 +--- a/include/netlink/route/link.h ++++ b/include/netlink/route/link.h +@@ -211,8 +211,8 @@ extern uint8_t rtnl_link_get_linkmode(struct rtnl_link *); + * Only use it if you understand the consequences and are willing + * to cope with them. + * */ +-int rtnl_link_set_link_netnsid(struct rtnl_link *link, uint32_t link_netnsid); +-int rtnl_link_get_link_netnsid(const struct rtnl_link *link, uint32_t *out_link_netnsid); ++int rtnl_link_set_link_netnsid(struct rtnl_link *link, int32_t link_netnsid); ++int rtnl_link_get_link_netnsid(const struct rtnl_link *link, int32_t *out_link_netnsid); + #endif + + extern const char * rtnl_link_get_ifalias(struct rtnl_link *); +diff --git a/lib/route/link.c b/lib/route/link.c +index d914fd5..fc88959 100644 +--- a/lib/route/link.c ++++ b/lib/route/link.c +@@ -59,6 +59,28 @@ + #define LINK_ATTR_AF_SPEC (1 << 27) + #define LINK_ATTR_LINK_NETNSID (1 << 31) + ++/***********************************************************************/ ++ ++/* upstream added new utility function. While backporting, ++ * they were needed, but we don't want to intoduce new ++ * API. Instead, define them locall.y */ ++ ++#define NLA_PUT_S32(msg, attrtype, value) \ ++ NLA_PUT_TYPE(msg, int32_t, attrtype, value) ++ ++/** ++ * Return payload of 32 bit integer attribute. ++ * @arg nla 32 bit integer attribute. ++ * ++ * @return Payload as 32 bit integer. ++ */ ++static int32_t nla_get_s32(const struct nlattr *nla) ++{ ++ return *(const int32_t *) nla_data(nla); ++} ++ ++/***********************************************************************/ ++ + static struct nl_cache_ops rtnl_link_ops; + static struct nl_object_ops link_obj_ops; + /** @endcond */ +@@ -445,7 +467,7 @@ static int link_msg_parser(struct nl_cache_ops *ops, struct sockaddr_nl *who, + } + + if (tb[IFLA_LINK_NETNSID]) { +- link->l_link_netnsid = nla_get_u32(tb[IFLA_LINK_NETNSID]); ++ link->l_link_netnsid = nla_get_s32(tb[IFLA_LINK_NETNSID]); + link->ce_mask |= LINK_ATTR_LINK_NETNSID; + } + +@@ -643,7 +665,7 @@ static void link_dump_line(struct nl_object *obj, struct nl_dump_params *p) + nl_dump(p, "slave-of %d ", link->l_link); + } + if (link->ce_mask & LINK_ATTR_LINK_NETNSID) +- nl_dump(p, "link-netnsid %u ", link->l_link_netnsid); ++ nl_dump(p, "link-netnsid %d ", link->l_link_netnsid); + + if (link->ce_mask & LINK_ATTR_GROUP) + nl_dump(p, "group %u ", link->l_group); +@@ -1249,7 +1271,7 @@ static int build_link_msg(int cmd, struct ifinfomsg *hdr, + NLA_PUT_U32(msg, IFLA_LINK, link->l_link); + + if (link->ce_mask & LINK_ATTR_LINK_NETNSID) +- NLA_PUT_U32(msg, IFLA_LINK_NETNSID, link->l_link_netnsid); ++ NLA_PUT_S32(msg, IFLA_LINK_NETNSID, link->l_link_netnsid); + + if (link->ce_mask & LINK_ATTR_MASTER) + NLA_PUT_U32(msg, IFLA_MASTER, link->l_master); +@@ -1914,7 +1936,7 @@ int rtnl_link_get_link(struct rtnl_link *link) + * Sets the IFLA_LINK_NETNSID attribute of the link + * @returns 0 on success + */ +-int rtnl_link_set_link_netnsid(struct rtnl_link *link, uint32_t link_netnsid) ++int rtnl_link_set_link_netnsid(struct rtnl_link *link, int32_t link_netnsid) + { + link->l_link_netnsid = link_netnsid; + link->ce_mask |= LINK_ATTR_LINK_NETNSID; +@@ -1931,7 +1953,7 @@ int rtnl_link_set_link_netnsid(struct rtnl_link *link, uint32_t link_netnsid) + * + * @returns 0 on success + */ +-int rtnl_link_get_link_netnsid(const struct rtnl_link *link, uint32_t *out_link_netnsid) ++int rtnl_link_get_link_netnsid(const struct rtnl_link *link, int32_t *out_link_netnsid) + { + if (!(link->ce_mask & LINK_ATTR_LINK_NETNSID)) + return -NLE_INVAL; +-- +2.4.3 + diff --git a/SOURCES/0012-rh1261028-rtnl-neigh-get.patch b/SOURCES/0012-rh1261028-rtnl-neigh-get.patch new file mode 100644 index 0000000..7aa32b1 --- /dev/null +++ b/SOURCES/0012-rh1261028-rtnl-neigh-get.patch @@ -0,0 +1,112 @@ +From 53d819c68d21accc815b59d887075b6e47e4c07f Mon Sep 17 00:00:00 2001 +From: Thomas Graf +Date: Fri, 1 Feb 2013 10:41:45 +0100 +Subject: [PATCH 1/2] neigh: Remove check for AF_UNSPEC in rtnl_neigh_get() + +This check was introduces to not accidently return AF_BRIDGE objects +to unaware API users as they do differ in structure. However, such +objects are only available if explicitely requests using the +NL_CACHE_AF_ITER flag or by using arg1 == AF_BRIDGE for the cache. + +Therefore remove this check and allow rtnl_neigh_get() to be used to +fetch any neighbor object of a cache. + +Reported-by: Maxime Bizon +Signed-off-by: Thomas Graf +(cherry picked from commit 8571f58f23763d8db7365d02c9b27832ad3d7005) +--- + lib/route/neigh.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/lib/route/neigh.c b/lib/route/neigh.c +index c0f80a2..288bb85 100644 +--- a/lib/route/neigh.c ++++ b/lib/route/neigh.c +@@ -532,6 +532,7 @@ int rtnl_neigh_alloc_cache(struct nl_sock *sock, struct nl_cache **result) + * @arg cache neighbour cache + * @arg ifindex interface index the neighbour is on + * @arg dst destination address of the neighbour ++ * + * @return neighbour handle or NULL if no match was found. + */ + struct rtnl_neigh * rtnl_neigh_get(struct nl_cache *cache, int ifindex, +@@ -540,8 +541,7 @@ struct rtnl_neigh * rtnl_neigh_get(struct nl_cache *cache, int ifindex, + struct rtnl_neigh *neigh; + + nl_list_for_each_entry(neigh, &cache->c_items, ce_list) { +- if (neigh->n_family == AF_UNSPEC && +- neigh->n_ifindex == ifindex && ++ if (neigh->n_ifindex == ifindex && + !nl_addr_cmp(neigh->n_dst, dst)) { + nl_object_get((struct nl_object *) neigh); + return neigh; +-- +2.4.3 + + +From 6212b5522f5b40110729cd3fe4ac9c3dcaa2eb88 Mon Sep 17 00:00:00 2001 +From: Thomas Haller +Date: Tue, 29 Sep 2015 18:32:23 +0200 +Subject: [PATCH 2/2] route: add capability indicating the behavior of + rtnl_neigh_get() + +A wrong behavior for rtnl_neigh_get() was introduced between 3.2.14 and 3.2.15 +(commit 64fcb47a36ec12d7e7f00605f6a8952ce985dd08). + +It was later fixed between 3.2.21 and 3.2.22 +(commit 8571f58f23763d8db7365d02c9b27832ad3d7005). + +Add a capability NL_CAPABILITY_RTNL_NEIGH_GET_FILTER_AF_UNSPEC_FIX +to indicate that this buggy behavior was fixed. + +https://bugzilla.redhat.com/show_bug.cgi?id=1261028 +http://lists.infradead.org/pipermail/libnl/2015-August/001951.html +Signed-off-by: Thomas Haller +(cherry picked from commit 2a8a7c31e6accf1a22caebace8da4c03028d5500) +--- + include/netlink/utils.h | 8 ++++++++ + lib/utils.c | 9 +++++++++ + 2 files changed, 17 insertions(+) + +diff --git a/include/netlink/utils.h b/include/netlink/utils.h +index 5b0d275..4b15372 100644 +--- a/include/netlink/utils.h ++++ b/include/netlink/utils.h +@@ -99,6 +99,14 @@ enum { + NL_CAPABILITY_NL_CONNECT_RETRY_GENERATE_PORT_ON_ADDRINUSE = 4, + #define NL_CAPABILITY_NL_CONNECT_RETRY_GENERATE_PORT_ON_ADDRINUSE NL_CAPABILITY_NL_CONNECT_RETRY_GENERATE_PORT_ON_ADDRINUSE + ++ /** ++ * Between 3.2.14 (64fcb47a36ec12d7e7f00605f6a8952ce985dd08) and 3.2.22 (8571f58f23763d8db7365d02c9b27832ad3d7005), ++ * rtnl_neigh_get() behaved differently and only returned objects with family AF_UNSPEC. ++ * This capability indicates, that the function was fixed. The absense of the capability, ++ * doesn't indicate however which behavior the function will have. So beware. */ ++ NL_CAPABILITY_RTNL_NEIGH_GET_FILTER_AF_UNSPEC_FIX = 10, ++#define NL_CAPABILITY_RTNL_NEIGH_GET_FILTER_AF_UNSPEC_FIX NL_CAPABILITY_RTNL_NEIGH_GET_FILTER_AF_UNSPEC_FIX ++ + __NL_CAPABILITY_MAX + #define NL_CAPABILITY_MAX (__NL_CAPABILITY_MAX - 1) + }; +diff --git a/lib/utils.c b/lib/utils.c +index 5149e07..6b6a87c 100644 +--- a/lib/utils.c ++++ b/lib/utils.c +@@ -1143,6 +1143,15 @@ int nl_has_capability (int capability) + 0, + 0, + 0), ++ _NL_SET(1, ++ 0, ++ NL_CAPABILITY_RTNL_NEIGH_GET_FILTER_AF_UNSPEC_FIX, ++ 0, ++ 0, ++ 0, ++ 0, ++ 0, ++ 0), + #undef _NL_SET + #undef _NL_SETV + #undef _NL_ASSERT +-- +2.4.3 + diff --git a/SPECS/libnl3.spec b/SPECS/libnl3.spec index 613c844..a0a5b27 100644 --- a/SPECS/libnl3.spec +++ b/SPECS/libnl3.spec @@ -3,7 +3,7 @@ Group: Development/Libraries License: LGPLv2 Name: libnl3 Version: 3.2.21 -Release: 9%{?dist} +Release: 10%{?dist} URL: http://www.infradead.org/~tgr/libnl/ Source: http://www.infradead.org/~tgr/libnl/files/libnl-%{version}.tar.gz Source1: http://www.infradead.org/~tgr/libnl/files/libnl-doc-%{version}.tar.gz @@ -24,6 +24,8 @@ Patch7: 0007-relax-parsing-protinfo.patch Patch8: 0008-rh1127718-inet6_addr_gen.patch Patch9: 0009-rh1181255-EAGAIN.patch Patch10: 0010-rh1249158-local-port-EADDRINUSE.patch +Patch11: 0011-support-IFLA_LINK_NETNSID-rh1255050.patch +Patch12: 0012-rh1261028-rtnl-neigh-get.patch %description This package contains a convenience library to simplify @@ -69,7 +71,9 @@ This package contains libnl3 API documentation %patch7 -p1 -b .0007-relax-parsing-protinfo.orig %patch8 -p1 -b .0008-rh1127718-inet6_addr_gen.orig %patch9 -p1 -b .0009-rh1181255-EAGAIN.orig -%patch10 -p1 +%patch10 -p1 -b .0010-rh1249158-local-port-EADDRINUSE.orig +%patch11 -p1 +%patch12 -p1 tar -xzf %SOURCE1 @@ -123,8 +127,12 @@ find $RPM_BUILD_ROOT -name \*.la -delete %doc libnl-doc-%{version}/api/* %changelog -* Mon Oct 5 2015 Thomas Haller - 3.2.21-9 -- improve local port handling for netlink socket with EADDRINUSE (rh #1268767) +* Wed Sep 30 2015 Thomas Haller - 3.2.21-10 +- rtnl: fix lookup in rtnl_neigh_get() to ignore address family (rh #1261028) + +* Mon Aug 24 2015 Thomas Haller - 3.2.21-9 +- improve local port handling for netlink socket with EADDRINUSE (rh #1249158) +- rtnl: backport support for link-netnsid attribute (rh #1255050) * Mon Jan 12 2015 Lubomir Rintel - 3.2.21-8 - properly propagate EAGAIN error status (rh #1181255)