Commit 46c264da authored by Nicolas Dichtel's avatar Nicolas Dichtel Committed by David S. Miller

bridge/nl: remove wrong use of NLM_F_MULTI

NLM_F_MULTI must be used only when a NLMSG_DONE message is sent. In fact,
it is sent only at the end of a dump.

Libraries like libnl will wait forever for NLMSG_DONE.

Fixes: e5a55a89 ("net: create generic bridge ops")
Fixes: 815cccbf ("ixgbe: add setlink, getlink support to ixgbe and ixgbevf")
CC: John Fastabend <john.r.fastabend@intel.com>
CC: Sathya Perla <sathya.perla@emulex.com>
CC: Subbu Seetharaman <subbu.seetharaman@emulex.com>
CC: Ajit Khaparde <ajit.khaparde@emulex.com>
CC: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
CC: intel-wired-lan@lists.osuosl.org
CC: Jiri Pirko <jiri@resnulli.us>
CC: Scott Feldman <sfeldma@gmail.com>
CC: Stephen Hemminger <stephen@networkplumber.org>
CC: bridge@lists.linux-foundation.org
Signed-off-by: default avatarNicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 82199679
...@@ -4846,7 +4846,8 @@ static int be_ndo_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh, ...@@ -4846,7 +4846,8 @@ static int be_ndo_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh,
} }
static int be_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, static int be_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
struct net_device *dev, u32 filter_mask) struct net_device *dev, u32 filter_mask,
int nlflags)
{ {
struct be_adapter *adapter = netdev_priv(dev); struct be_adapter *adapter = netdev_priv(dev);
int status = 0; int status = 0;
...@@ -4868,7 +4869,7 @@ static int be_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, ...@@ -4868,7 +4869,7 @@ static int be_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
return ndo_dflt_bridge_getlink(skb, pid, seq, dev, return ndo_dflt_bridge_getlink(skb, pid, seq, dev,
hsw_mode == PORT_FWD_TYPE_VEPA ? hsw_mode == PORT_FWD_TYPE_VEPA ?
BRIDGE_MODE_VEPA : BRIDGE_MODE_VEB, BRIDGE_MODE_VEPA : BRIDGE_MODE_VEB,
0, 0); 0, 0, nlflags);
} }
#ifdef CONFIG_BE2NET_VXLAN #ifdef CONFIG_BE2NET_VXLAN
......
...@@ -8053,10 +8053,10 @@ static int i40e_ndo_bridge_setlink(struct net_device *dev, ...@@ -8053,10 +8053,10 @@ static int i40e_ndo_bridge_setlink(struct net_device *dev,
#ifdef HAVE_BRIDGE_FILTER #ifdef HAVE_BRIDGE_FILTER
static int i40e_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, static int i40e_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
struct net_device *dev, struct net_device *dev,
u32 __always_unused filter_mask) u32 __always_unused filter_mask, int nlflags)
#else #else
static int i40e_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, static int i40e_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
struct net_device *dev) struct net_device *dev, int nlflags)
#endif /* HAVE_BRIDGE_FILTER */ #endif /* HAVE_BRIDGE_FILTER */
{ {
struct i40e_netdev_priv *np = netdev_priv(dev); struct i40e_netdev_priv *np = netdev_priv(dev);
...@@ -8078,7 +8078,8 @@ static int i40e_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, ...@@ -8078,7 +8078,8 @@ static int i40e_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
if (!veb) if (!veb)
return 0; return 0;
return ndo_dflt_bridge_getlink(skb, pid, seq, dev, veb->bridge_mode); return ndo_dflt_bridge_getlink(skb, pid, seq, dev, veb->bridge_mode,
nlflags);
} }
#endif /* HAVE_BRIDGE_ATTRIBS */ #endif /* HAVE_BRIDGE_ATTRIBS */
......
...@@ -8044,7 +8044,7 @@ static int ixgbe_ndo_bridge_setlink(struct net_device *dev, ...@@ -8044,7 +8044,7 @@ static int ixgbe_ndo_bridge_setlink(struct net_device *dev,
static int ixgbe_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, static int ixgbe_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
struct net_device *dev, struct net_device *dev,
u32 filter_mask) u32 filter_mask, int nlflags)
{ {
struct ixgbe_adapter *adapter = netdev_priv(dev); struct ixgbe_adapter *adapter = netdev_priv(dev);
...@@ -8052,7 +8052,7 @@ static int ixgbe_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, ...@@ -8052,7 +8052,7 @@ static int ixgbe_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
return 0; return 0;
return ndo_dflt_bridge_getlink(skb, pid, seq, dev, return ndo_dflt_bridge_getlink(skb, pid, seq, dev,
adapter->bridge_mode, 0, 0); adapter->bridge_mode, 0, 0, nlflags);
} }
static void *ixgbe_fwd_add(struct net_device *pdev, struct net_device *vdev) static void *ixgbe_fwd_add(struct net_device *pdev, struct net_device *vdev)
......
...@@ -4176,14 +4176,15 @@ static int rocker_port_bridge_setlink(struct net_device *dev, ...@@ -4176,14 +4176,15 @@ static int rocker_port_bridge_setlink(struct net_device *dev,
static int rocker_port_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, static int rocker_port_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
struct net_device *dev, struct net_device *dev,
u32 filter_mask) u32 filter_mask, int nlflags)
{ {
struct rocker_port *rocker_port = netdev_priv(dev); struct rocker_port *rocker_port = netdev_priv(dev);
u16 mode = BRIDGE_MODE_UNDEF; u16 mode = BRIDGE_MODE_UNDEF;
u32 mask = BR_LEARNING | BR_LEARNING_SYNC; u32 mask = BR_LEARNING | BR_LEARNING_SYNC;
return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode, return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode,
rocker_port->brport_flags, mask); rocker_port->brport_flags, mask,
nlflags);
} }
static int rocker_port_get_phys_port_name(struct net_device *dev, static int rocker_port_get_phys_port_name(struct net_device *dev,
......
...@@ -977,7 +977,8 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev, ...@@ -977,7 +977,8 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
* int (*ndo_bridge_setlink)(struct net_device *dev, struct nlmsghdr *nlh, * int (*ndo_bridge_setlink)(struct net_device *dev, struct nlmsghdr *nlh,
* u16 flags) * u16 flags)
* int (*ndo_bridge_getlink)(struct sk_buff *skb, u32 pid, u32 seq, * int (*ndo_bridge_getlink)(struct sk_buff *skb, u32 pid, u32 seq,
* struct net_device *dev, u32 filter_mask) * struct net_device *dev, u32 filter_mask,
* int nlflags)
* int (*ndo_bridge_dellink)(struct net_device *dev, struct nlmsghdr *nlh, * int (*ndo_bridge_dellink)(struct net_device *dev, struct nlmsghdr *nlh,
* u16 flags); * u16 flags);
* *
...@@ -1173,7 +1174,8 @@ struct net_device_ops { ...@@ -1173,7 +1174,8 @@ struct net_device_ops {
int (*ndo_bridge_getlink)(struct sk_buff *skb, int (*ndo_bridge_getlink)(struct sk_buff *skb,
u32 pid, u32 seq, u32 pid, u32 seq,
struct net_device *dev, struct net_device *dev,
u32 filter_mask); u32 filter_mask,
int nlflags);
int (*ndo_bridge_dellink)(struct net_device *dev, int (*ndo_bridge_dellink)(struct net_device *dev,
struct nlmsghdr *nlh, struct nlmsghdr *nlh,
u16 flags); u16 flags);
......
...@@ -122,5 +122,5 @@ extern int ndo_dflt_fdb_del(struct ndmsg *ndm, ...@@ -122,5 +122,5 @@ extern int ndo_dflt_fdb_del(struct ndmsg *ndm,
extern int ndo_dflt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, extern int ndo_dflt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
struct net_device *dev, u16 mode, struct net_device *dev, u16 mode,
u32 flags, u32 mask); u32 flags, u32 mask, int nlflags);
#endif /* __LINUX_RTNETLINK_H */ #endif /* __LINUX_RTNETLINK_H */
...@@ -394,7 +394,7 @@ void br_ifinfo_notify(int event, struct net_bridge_port *port) ...@@ -394,7 +394,7 @@ void br_ifinfo_notify(int event, struct net_bridge_port *port)
* Dump information about all ports, in response to GETLINK * Dump information about all ports, in response to GETLINK
*/ */
int br_getlink(struct sk_buff *skb, u32 pid, u32 seq, int br_getlink(struct sk_buff *skb, u32 pid, u32 seq,
struct net_device *dev, u32 filter_mask) struct net_device *dev, u32 filter_mask, int nlflags)
{ {
struct net_bridge_port *port = br_port_get_rtnl(dev); struct net_bridge_port *port = br_port_get_rtnl(dev);
...@@ -402,7 +402,7 @@ int br_getlink(struct sk_buff *skb, u32 pid, u32 seq, ...@@ -402,7 +402,7 @@ int br_getlink(struct sk_buff *skb, u32 pid, u32 seq,
!(filter_mask & RTEXT_FILTER_BRVLAN_COMPRESSED)) !(filter_mask & RTEXT_FILTER_BRVLAN_COMPRESSED))
return 0; return 0;
return br_fill_ifinfo(skb, port, pid, seq, RTM_NEWLINK, NLM_F_MULTI, return br_fill_ifinfo(skb, port, pid, seq, RTM_NEWLINK, nlflags,
filter_mask, dev); filter_mask, dev);
} }
......
...@@ -828,7 +828,7 @@ void br_ifinfo_notify(int event, struct net_bridge_port *port); ...@@ -828,7 +828,7 @@ void br_ifinfo_notify(int event, struct net_bridge_port *port);
int br_setlink(struct net_device *dev, struct nlmsghdr *nlmsg, u16 flags); int br_setlink(struct net_device *dev, struct nlmsghdr *nlmsg, u16 flags);
int br_dellink(struct net_device *dev, struct nlmsghdr *nlmsg, u16 flags); int br_dellink(struct net_device *dev, struct nlmsghdr *nlmsg, u16 flags);
int br_getlink(struct sk_buff *skb, u32 pid, u32 seq, struct net_device *dev, int br_getlink(struct sk_buff *skb, u32 pid, u32 seq, struct net_device *dev,
u32 filter_mask); u32 filter_mask, int nlflags);
#ifdef CONFIG_SYSFS #ifdef CONFIG_SYSFS
/* br_sysfs_if.c */ /* br_sysfs_if.c */
......
...@@ -2854,7 +2854,7 @@ static int brport_nla_put_flag(struct sk_buff *skb, u32 flags, u32 mask, ...@@ -2854,7 +2854,7 @@ static int brport_nla_put_flag(struct sk_buff *skb, u32 flags, u32 mask,
int ndo_dflt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, int ndo_dflt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
struct net_device *dev, u16 mode, struct net_device *dev, u16 mode,
u32 flags, u32 mask) u32 flags, u32 mask, int nlflags)
{ {
struct nlmsghdr *nlh; struct nlmsghdr *nlh;
struct ifinfomsg *ifm; struct ifinfomsg *ifm;
...@@ -2863,7 +2863,7 @@ int ndo_dflt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, ...@@ -2863,7 +2863,7 @@ int ndo_dflt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
u8 operstate = netif_running(dev) ? dev->operstate : IF_OPER_DOWN; u8 operstate = netif_running(dev) ? dev->operstate : IF_OPER_DOWN;
struct net_device *br_dev = netdev_master_upper_dev_get(dev); struct net_device *br_dev = netdev_master_upper_dev_get(dev);
nlh = nlmsg_put(skb, pid, seq, RTM_NEWLINK, sizeof(*ifm), NLM_F_MULTI); nlh = nlmsg_put(skb, pid, seq, RTM_NEWLINK, sizeof(*ifm), nlflags);
if (nlh == NULL) if (nlh == NULL)
return -EMSGSIZE; return -EMSGSIZE;
...@@ -2969,7 +2969,8 @@ static int rtnl_bridge_getlink(struct sk_buff *skb, struct netlink_callback *cb) ...@@ -2969,7 +2969,8 @@ static int rtnl_bridge_getlink(struct sk_buff *skb, struct netlink_callback *cb)
if (br_dev && br_dev->netdev_ops->ndo_bridge_getlink) { if (br_dev && br_dev->netdev_ops->ndo_bridge_getlink) {
if (idx >= cb->args[0] && if (idx >= cb->args[0] &&
br_dev->netdev_ops->ndo_bridge_getlink( br_dev->netdev_ops->ndo_bridge_getlink(
skb, portid, seq, dev, filter_mask) < 0) skb, portid, seq, dev, filter_mask,
NLM_F_MULTI) < 0)
break; break;
idx++; idx++;
} }
...@@ -2977,7 +2978,8 @@ static int rtnl_bridge_getlink(struct sk_buff *skb, struct netlink_callback *cb) ...@@ -2977,7 +2978,8 @@ static int rtnl_bridge_getlink(struct sk_buff *skb, struct netlink_callback *cb)
if (ops->ndo_bridge_getlink) { if (ops->ndo_bridge_getlink) {
if (idx >= cb->args[0] && if (idx >= cb->args[0] &&
ops->ndo_bridge_getlink(skb, portid, seq, dev, ops->ndo_bridge_getlink(skb, portid, seq, dev,
filter_mask) < 0) filter_mask,
NLM_F_MULTI) < 0)
break; break;
idx++; idx++;
} }
...@@ -3018,7 +3020,7 @@ static int rtnl_bridge_notify(struct net_device *dev) ...@@ -3018,7 +3020,7 @@ static int rtnl_bridge_notify(struct net_device *dev)
goto errout; goto errout;
} }
err = dev->netdev_ops->ndo_bridge_getlink(skb, 0, 0, dev, 0); err = dev->netdev_ops->ndo_bridge_getlink(skb, 0, 0, dev, 0, 0);
if (err < 0) if (err < 0)
goto errout; goto errout;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment