diff options
-rw-r--r-- | include/net/genetlink.h | 14 | ||||
-rw-r--r-- | net/openvswitch/datapath.c | 8 | ||||
-rw-r--r-- | net/openvswitch/dp_notify.c | 6 |
3 files changed, 21 insertions, 7 deletions
diff --git a/include/net/genetlink.h b/include/net/genetlink.h index d8a8b1fd96c4..11ac77f6180c 100644 --- a/include/net/genetlink.h +++ b/include/net/genetlink.h | |||
@@ -351,5 +351,19 @@ static inline struct sk_buff *genlmsg_new(size_t payload, gfp_t flags) | |||
351 | return nlmsg_new(genlmsg_total_size(payload), flags); | 351 | return nlmsg_new(genlmsg_total_size(payload), flags); |
352 | } | 352 | } |
353 | 353 | ||
354 | /** | ||
355 | * genl_set_err - report error to genetlink broadcast listeners | ||
356 | * @net: the network namespace to report the error to | ||
357 | * @portid: the PORTID of a process that we want to skip (if any) | ||
358 | * @group: the broadcast group that will notice the error | ||
359 | * @code: error code, must be negative (as usual in kernelspace) | ||
360 | * | ||
361 | * This function returns the number of broadcast listeners that have set the | ||
362 | * NETLINK_RECV_NO_ENOBUFS socket option. | ||
363 | */ | ||
364 | static inline int genl_set_err(struct net *net, u32 portid, u32 group, int code) | ||
365 | { | ||
366 | return netlink_set_err(net->genl_sock, portid, group, code); | ||
367 | } | ||
354 | 368 | ||
355 | #endif /* __NET_GENERIC_NETLINK_H */ | 369 | #endif /* __NET_GENERIC_NETLINK_H */ |
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index 8ec8b73033e0..3e2bb15fd717 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c | |||
@@ -879,8 +879,8 @@ static int ovs_flow_cmd_new_or_set(struct sk_buff *skb, struct genl_info *info) | |||
879 | if (!IS_ERR(reply)) | 879 | if (!IS_ERR(reply)) |
880 | ovs_notify(reply, info, &ovs_dp_flow_multicast_group); | 880 | ovs_notify(reply, info, &ovs_dp_flow_multicast_group); |
881 | else | 881 | else |
882 | netlink_set_err(sock_net(skb->sk)->genl_sock, 0, | 882 | genl_set_err(sock_net(skb->sk), 0, |
883 | ovs_dp_flow_multicast_group.id, PTR_ERR(reply)); | 883 | ovs_dp_flow_multicast_group.id, PTR_ERR(reply)); |
884 | return 0; | 884 | return 0; |
885 | 885 | ||
886 | err_flow_free: | 886 | err_flow_free: |
@@ -1326,8 +1326,8 @@ static int ovs_dp_cmd_set(struct sk_buff *skb, struct genl_info *info) | |||
1326 | info->snd_seq, OVS_DP_CMD_NEW); | 1326 | info->snd_seq, OVS_DP_CMD_NEW); |
1327 | if (IS_ERR(reply)) { | 1327 | if (IS_ERR(reply)) { |
1328 | err = PTR_ERR(reply); | 1328 | err = PTR_ERR(reply); |
1329 | netlink_set_err(sock_net(skb->sk)->genl_sock, 0, | 1329 | genl_set_err(sock_net(skb->sk), 0, |
1330 | ovs_dp_datapath_multicast_group.id, err); | 1330 | ovs_dp_datapath_multicast_group.id, err); |
1331 | err = 0; | 1331 | err = 0; |
1332 | goto unlock; | 1332 | goto unlock; |
1333 | } | 1333 | } |
diff --git a/net/openvswitch/dp_notify.c b/net/openvswitch/dp_notify.c index 5c2dab276109..3d55ead6095c 100644 --- a/net/openvswitch/dp_notify.c +++ b/net/openvswitch/dp_notify.c | |||
@@ -34,9 +34,9 @@ static void dp_detach_port_notify(struct vport *vport) | |||
34 | OVS_VPORT_CMD_DEL); | 34 | OVS_VPORT_CMD_DEL); |
35 | ovs_dp_detach_port(vport); | 35 | ovs_dp_detach_port(vport); |
36 | if (IS_ERR(notify)) { | 36 | if (IS_ERR(notify)) { |
37 | netlink_set_err(ovs_dp_get_net(dp)->genl_sock, 0, | 37 | genl_set_err(ovs_dp_get_net(dp), 0, |
38 | ovs_dp_vport_multicast_group.id, | 38 | ovs_dp_vport_multicast_group.id, |
39 | PTR_ERR(notify)); | 39 | PTR_ERR(notify)); |
40 | return; | 40 | return; |
41 | } | 41 | } |
42 | 42 | ||