mirror of
https://github.com/openvswitch/ovs
synced 2025-10-15 14:17:18 +00:00
datapath: genl_notify() on port disappearances.
Before this patch, if a vport detached itself from the datapath without interaction from userspace, rtnetlink notifications would be sent, but genl notifications would not. Feature #6809. Signed-off-by: Ethan Jackson <ethan@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
This commit is contained in:
@@ -1603,7 +1603,7 @@ static struct genl_family dp_vport_genl_family = {
|
|||||||
.maxattr = OVS_VPORT_ATTR_MAX
|
.maxattr = OVS_VPORT_ATTR_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct genl_multicast_group dp_vport_multicast_group = {
|
struct genl_multicast_group dp_vport_multicast_group = {
|
||||||
.name = OVS_VPORT_MCGROUP
|
.name = OVS_VPORT_MCGROUP
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1662,7 +1662,7 @@ error:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Called with RTNL lock or RCU read lock. */
|
/* Called with RTNL lock or RCU read lock. */
|
||||||
static struct sk_buff *ovs_vport_cmd_build_info(struct vport *vport, u32 pid,
|
struct sk_buff *ovs_vport_cmd_build_info(struct vport *vport, u32 pid,
|
||||||
u32 seq, u8 cmd)
|
u32 seq, u8 cmd)
|
||||||
{
|
{
|
||||||
struct sk_buff *skb;
|
struct sk_buff *skb;
|
||||||
|
@@ -144,6 +144,7 @@ struct dp_upcall_info {
|
|||||||
};
|
};
|
||||||
|
|
||||||
extern struct notifier_block dp_device_notifier;
|
extern struct notifier_block dp_device_notifier;
|
||||||
|
extern struct genl_multicast_group dp_vport_multicast_group;
|
||||||
extern int (*dp_ioctl_hook)(struct net_device *dev, struct ifreq *rq, int cmd);
|
extern int (*dp_ioctl_hook)(struct net_device *dev, struct ifreq *rq, int cmd);
|
||||||
|
|
||||||
void dp_process_received_packet(struct vport *, struct sk_buff *);
|
void dp_process_received_packet(struct vport *, struct sk_buff *);
|
||||||
@@ -154,5 +155,7 @@ void set_internal_devs_mtu(const struct datapath *dp);
|
|||||||
|
|
||||||
struct datapath *get_dp(int dp_idx);
|
struct datapath *get_dp(int dp_idx);
|
||||||
const char *dp_name(const struct datapath *dp);
|
const char *dp_name(const struct datapath *dp);
|
||||||
|
struct sk_buff *ovs_vport_cmd_build_info(struct vport *, u32 pid, u32 seq,
|
||||||
|
u8 cmd);
|
||||||
|
|
||||||
#endif /* datapath.h */
|
#endif /* datapath.h */
|
||||||
|
@@ -9,6 +9,7 @@
|
|||||||
/* Handle changes to managed devices */
|
/* Handle changes to managed devices */
|
||||||
|
|
||||||
#include <linux/netdevice.h>
|
#include <linux/netdevice.h>
|
||||||
|
#include <net/genetlink.h>
|
||||||
|
|
||||||
#include "datapath.h"
|
#include "datapath.h"
|
||||||
#include "vport-internal_dev.h"
|
#include "vport-internal_dev.h"
|
||||||
@@ -33,8 +34,23 @@ static int dp_device_event(struct notifier_block *unused, unsigned long event,
|
|||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case NETDEV_UNREGISTER:
|
case NETDEV_UNREGISTER:
|
||||||
if (!is_internal_dev(dev))
|
if (!is_internal_dev(dev)) {
|
||||||
|
struct sk_buff *reply;
|
||||||
|
|
||||||
dp_detach_port(vport);
|
dp_detach_port(vport);
|
||||||
|
reply = ovs_vport_cmd_build_info(vport, 0, 0,
|
||||||
|
OVS_VPORT_CMD_DEL);
|
||||||
|
if (IS_ERR(reply)) {
|
||||||
|
netlink_set_err(INIT_NET_GENL_SOCK, 0,
|
||||||
|
dp_vport_multicast_group.id,
|
||||||
|
PTR_ERR(reply));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
genl_notify(reply, dev_net(dev), 0,
|
||||||
|
dp_vport_multicast_group.id, NULL,
|
||||||
|
GFP_KERNEL);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NETDEV_CHANGENAME:
|
case NETDEV_CHANGENAME:
|
||||||
|
Reference in New Issue
Block a user