Commit 134e63756d5f3d0f7604dfcca847b09d1b14fd66

Authored by Johannes Berg
Committed by David S. Miller
1 parent 11a28d373e

genetlink: make netns aware

This makes generic netlink network namespace aware. No
generic netlink families except for the controller family
are made namespace aware, they need to be checked one by
one and then set the family->netnsok member to true.

A new function genlmsg_multicast_netns() is introduced to
allow sending a multicast message in a given namespace,
for example when it applies to an object that lives in
that namespace, a new function genlmsg_multicast_allns()
to send a message to all network namespaces (for objects
that do not have an associated netns).

The function genlmsg_multicast() is changed to multicast
the message in just init_net, which is currently correct
for all generic netlink families since they only work in
init_net right now. Some will later want to work in all
net namespaces because they do not care about the netns
at all -- those will have to be converted to use one of
the new functions genlmsg_multicast_allns() or
genlmsg_multicast_netns() whenever they are made netns
aware in some way.

After this patch families can easily decide whether or
not they should be available in all net namespaces. Many
genl families us it for objects not related to networking
and should therefore be available in all namespaces, but
that will have to be done on a per family basis.

Note that this doesn't touch on the checkpoint/restart
problem where network namespaces could be used, genl
families and multicast groups are numbered globally and
I see no easy way of changing that, especially since it
must be possible to multicast to all network namespaces
for those families that do not care about netns.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 9 changed files with 223 additions and 63 deletions Side-by-side Diff

... ... @@ -63,7 +63,7 @@
63 63 return rv;
64 64 }
65 65  
66   - return genlmsg_unicast(skb, listener_nlpid);
  66 + return genlmsg_unicast(&init_net, skb, listener_nlpid);
67 67 }
68 68  
69 69 static int user_cmd(struct sk_buff *skb, struct genl_info *info)
include/net/genetlink.h
... ... @@ -3,6 +3,7 @@
3 3  
4 4 #include <linux/genetlink.h>
5 5 #include <net/netlink.h>
  6 +#include <net/net_namespace.h>
6 7  
7 8 /**
8 9 * struct genl_multicast_group - generic netlink multicast group
... ... @@ -27,6 +28,8 @@
27 28 * @name: name of family
28 29 * @version: protocol version
29 30 * @maxattr: maximum number of attributes supported
  31 + * @netnsok: set to true if the family can handle network
  32 + * namespaces and should be presented in all of them
30 33 * @attrbuf: buffer to store parsed attributes
31 34 * @ops_list: list of all assigned operations
32 35 * @family_list: family list
... ... @@ -39,6 +42,7 @@
39 42 char name[GENL_NAMSIZ];
40 43 unsigned int version;
41 44 unsigned int maxattr;
  45 + bool netnsok;
42 46 struct nlattr ** attrbuf; /* private */
43 47 struct list_head ops_list; /* private */
44 48 struct list_head family_list; /* private */
45 49  
... ... @@ -62,8 +66,32 @@
62 66 struct genlmsghdr * genlhdr;
63 67 void * userhdr;
64 68 struct nlattr ** attrs;
  69 +#ifdef CONFIG_NET_NS
  70 + struct net * _net;
  71 +#endif
65 72 };
66 73  
  74 +#ifdef CONFIG_NET_NS
  75 +static inline struct net *genl_info_net(struct genl_info *info)
  76 +{
  77 + return info->_net;
  78 +}
  79 +
  80 +static inline void genl_info_net_set(struct genl_info *info, struct net *net)
  81 +{
  82 + info->_net = net;
  83 +}
  84 +#else
  85 +static inline struct net *genl_info_net(struct genl_info *info)
  86 +{
  87 + return &init_net;
  88 +}
  89 +
  90 +static inline void genl_info_net_set(struct genl_info *info, struct net *net)
  91 +{
  92 +}
  93 +#endif
  94 +
67 95 /**
68 96 * struct genl_ops - generic netlink operations
69 97 * @cmd: command identifier
... ... @@ -98,8 +126,6 @@
98 126 extern void genl_unregister_mc_group(struct genl_family *family,
99 127 struct genl_multicast_group *grp);
100 128  
101   -extern struct sock *genl_sock;
102   -
103 129 /**
104 130 * genlmsg_put - Add generic netlink header to netlink message
105 131 * @skb: socket buffer holding the message
106 132  
107 133  
108 134  
109 135  
110 136  
... ... @@ -170,26 +196,52 @@
170 196 }
171 197  
172 198 /**
173   - * genlmsg_multicast - multicast a netlink message
  199 + * genlmsg_multicast_netns - multicast a netlink message to a specific netns
  200 + * @net: the net namespace
174 201 * @skb: netlink message as socket buffer
175 202 * @pid: own netlink pid to avoid sending to yourself
176 203 * @group: multicast group id
177 204 * @flags: allocation flags
178 205 */
  206 +static inline int genlmsg_multicast_netns(struct net *net, struct sk_buff *skb,
  207 + u32 pid, unsigned int group, gfp_t flags)
  208 +{
  209 + return nlmsg_multicast(net->genl_sock, skb, pid, group, flags);
  210 +}
  211 +
  212 +/**
  213 + * genlmsg_multicast - multicast a netlink message to the default netns
  214 + * @skb: netlink message as socket buffer
  215 + * @pid: own netlink pid to avoid sending to yourself
  216 + * @group: multicast group id
  217 + * @flags: allocation flags
  218 + */
179 219 static inline int genlmsg_multicast(struct sk_buff *skb, u32 pid,
180 220 unsigned int group, gfp_t flags)
181 221 {
182   - return nlmsg_multicast(genl_sock, skb, pid, group, flags);
  222 + return genlmsg_multicast_netns(&init_net, skb, pid, group, flags);
183 223 }
184 224  
185 225 /**
  226 + * genlmsg_multicast_allns - multicast a netlink message to all net namespaces
  227 + * @skb: netlink message as socket buffer
  228 + * @pid: own netlink pid to avoid sending to yourself
  229 + * @group: multicast group id
  230 + * @flags: allocation flags
  231 + *
  232 + * This function must hold the RTNL or rcu_read_lock().
  233 + */
  234 +int genlmsg_multicast_allns(struct sk_buff *skb, u32 pid,
  235 + unsigned int group, gfp_t flags);
  236 +
  237 +/**
186 238 * genlmsg_unicast - unicast a netlink message
187 239 * @skb: netlink message as socket buffer
188 240 * @pid: netlink pid of the destination socket
189 241 */
190   -static inline int genlmsg_unicast(struct sk_buff *skb, u32 pid)
  242 +static inline int genlmsg_unicast(struct net *net, struct sk_buff *skb, u32 pid)
191 243 {
192   - return nlmsg_unicast(genl_sock, skb, pid);
  244 + return nlmsg_unicast(net->genl_sock, skb, pid);
193 245 }
194 246  
195 247 /**
... ... @@ -199,7 +251,7 @@
199 251 */
200 252 static inline int genlmsg_reply(struct sk_buff *skb, struct genl_info *info)
201 253 {
202   - return genlmsg_unicast(skb, info->snd_pid);
  254 + return genlmsg_unicast(genl_info_net(info), skb, info->snd_pid);
203 255 }
204 256  
205 257 /**
include/net/net_namespace.h
... ... @@ -26,6 +26,7 @@
26 26 struct sock;
27 27 struct ctl_table_header;
28 28 struct net_generic;
  29 +struct sock;
29 30  
30 31 struct net {
31 32 atomic_t count; /* To decided when the network
... ... @@ -57,6 +58,7 @@
57 58 spinlock_t rules_mod_lock;
58 59  
59 60 struct sock *rtnl; /* rtnetlink socket */
  61 + struct sock *genl_sock;
60 62  
61 63 struct netns_core core;
62 64 struct netns_mib mib;
... ... @@ -108,7 +108,7 @@
108 108 /*
109 109 * Send taskstats data in @skb to listener with nl_pid @pid
110 110 */
111   -static int send_reply(struct sk_buff *skb, pid_t pid)
  111 +static int send_reply(struct sk_buff *skb, struct genl_info *info)
112 112 {
113 113 struct genlmsghdr *genlhdr = nlmsg_data(nlmsg_hdr(skb));
114 114 void *reply = genlmsg_data(genlhdr);
... ... @@ -120,7 +120,7 @@
120 120 return rc;
121 121 }
122 122  
123   - return genlmsg_unicast(skb, pid);
  123 + return genlmsg_reply(skb, info);
124 124 }
125 125  
126 126 /*
... ... @@ -150,7 +150,7 @@
150 150 if (!skb_next)
151 151 break;
152 152 }
153   - rc = genlmsg_unicast(skb_cur, s->pid);
  153 + rc = genlmsg_unicast(&init_net, skb_cur, s->pid);
154 154 if (rc == -ECONNREFUSED) {
155 155 s->valid = 0;
156 156 delcount++;
... ... @@ -418,7 +418,7 @@
418 418 goto err;
419 419 }
420 420  
421   - rc = send_reply(rep_skb, info->snd_pid);
  421 + rc = send_reply(rep_skb, info);
422 422  
423 423 err:
424 424 fput_light(file, fput_needed);
... ... @@ -487,7 +487,7 @@
487 487 } else
488 488 goto err;
489 489  
490   - return send_reply(rep_skb, info->snd_pid);
  490 + return send_reply(rep_skb, info);
491 491 err:
492 492 nlmsg_free(rep_skb);
493 493 return rc;
net/irda/irnetlink.c
... ... @@ -115,7 +115,7 @@
115 115  
116 116 genlmsg_end(msg, hdr);
117 117  
118   - return genlmsg_unicast(msg, info->snd_pid);
  118 + return genlmsg_reply(msg, info);
119 119  
120 120 err_out:
121 121 nlmsg_free(msg);
net/netfilter/ipvs/ip_vs_ctl.c
... ... @@ -3231,7 +3231,7 @@
3231 3231 }
3232 3232  
3233 3233 genlmsg_end(msg, reply);
3234   - ret = genlmsg_unicast(msg, info->snd_pid);
  3234 + ret = genlmsg_reply(msg, info);
3235 3235 goto out;
3236 3236  
3237 3237 nla_put_failure:
net/netlink/genetlink.c
... ... @@ -18,8 +18,6 @@
18 18 #include <net/sock.h>
19 19 #include <net/genetlink.h>
20 20  
21   -struct sock *genl_sock = NULL;
22   -
23 21 static DEFINE_MUTEX(genl_mutex); /* serialization of message processing */
24 22  
25 23 static inline void genl_lock(void)
26 24  
... ... @@ -175,11 +173,32 @@
175 173 mc_groups_longs++;
176 174 }
177 175  
178   - err = netlink_change_ngroups(genl_sock,
179   - mc_groups_longs * BITS_PER_LONG);
180   - if (err)
181   - goto out;
  176 + if (family->netnsok) {
  177 + struct net *net;
182 178  
  179 + rcu_read_lock();
  180 + for_each_net_rcu(net) {
  181 + err = netlink_change_ngroups(net->genl_sock,
  182 + mc_groups_longs * BITS_PER_LONG);
  183 + if (err) {
  184 + /*
  185 + * No need to roll back, can only fail if
  186 + * memory allocation fails and then the
  187 + * number of _possible_ groups has been
  188 + * increased on some sockets which is ok.
  189 + */
  190 + rcu_read_unlock();
  191 + goto out;
  192 + }
  193 + }
  194 + rcu_read_unlock();
  195 + } else {
  196 + err = netlink_change_ngroups(init_net.genl_sock,
  197 + mc_groups_longs * BITS_PER_LONG);
  198 + if (err)
  199 + goto out;
  200 + }
  201 +
183 202 grp->id = id;
184 203 set_bit(id, mc_groups);
185 204 list_add_tail(&grp->list, &family->mcast_groups);
186 205  
... ... @@ -195,8 +214,14 @@
195 214 static void __genl_unregister_mc_group(struct genl_family *family,
196 215 struct genl_multicast_group *grp)
197 216 {
  217 + struct net *net;
198 218 BUG_ON(grp->family != family);
199   - netlink_clear_multicast_users(genl_sock, grp->id);
  219 +
  220 + rcu_read_lock();
  221 + for_each_net_rcu(net)
  222 + netlink_clear_multicast_users(net->genl_sock, grp->id);
  223 + rcu_read_unlock();
  224 +
200 225 clear_bit(grp->id, mc_groups);
201 226 list_del(&grp->list);
202 227 genl_ctrl_event(CTRL_CMD_DELMCAST_GRP, grp);
... ... @@ -467,6 +492,7 @@
467 492 {
468 493 struct genl_ops *ops;
469 494 struct genl_family *family;
  495 + struct net *net = sock_net(skb->sk);
470 496 struct genl_info info;
471 497 struct genlmsghdr *hdr = nlmsg_data(nlh);
472 498 int hdrlen, err;
... ... @@ -475,6 +501,10 @@
475 501 if (family == NULL)
476 502 return -ENOENT;
477 503  
  504 + /* this family doesn't exist in this netns */
  505 + if (!family->netnsok && !net_eq(net, &init_net))
  506 + return -ENOENT;
  507 +
478 508 hdrlen = GENL_HDRLEN + family->hdrsize;
479 509 if (nlh->nlmsg_len < nlmsg_msg_size(hdrlen))
480 510 return -EINVAL;
... ... @@ -492,7 +522,7 @@
492 522 return -EOPNOTSUPP;
493 523  
494 524 genl_unlock();
495   - err = netlink_dump_start(genl_sock, skb, nlh,
  525 + err = netlink_dump_start(net->genl_sock, skb, nlh,
496 526 ops->dumpit, ops->done);
497 527 genl_lock();
498 528 return err;
... ... @@ -514,6 +544,7 @@
514 544 info.genlhdr = nlmsg_data(nlh);
515 545 info.userhdr = nlmsg_data(nlh) + GENL_HDRLEN;
516 546 info.attrs = family->attrbuf;
  547 + genl_info_net_set(&info, net);
517 548  
518 549 return ops->doit(skb, &info);
519 550 }
... ... @@ -534,6 +565,7 @@
534 565 .name = "nlctrl",
535 566 .version = 0x2,
536 567 .maxattr = CTRL_ATTR_MAX,
  568 + .netnsok = true,
537 569 };
538 570  
539 571 static int ctrl_fill_info(struct genl_family *family, u32 pid, u32 seq,
... ... @@ -650,6 +682,7 @@
650 682  
651 683 int i, n = 0;
652 684 struct genl_family *rt;
  685 + struct net *net = sock_net(skb->sk);
653 686 int chains_to_skip = cb->args[0];
654 687 int fams_to_skip = cb->args[1];
655 688  
... ... @@ -658,6 +691,8 @@
658 691 continue;
659 692 n = 0;
660 693 list_for_each_entry(rt, genl_family_chain(i), family_list) {
  694 + if (!rt->netnsok && !net_eq(net, &init_net))
  695 + continue;
661 696 if (++n < fams_to_skip)
662 697 continue;
663 698 if (ctrl_fill_info(rt, NETLINK_CB(cb->skb).pid,
... ... @@ -729,6 +764,7 @@
729 764 if (info->attrs[CTRL_ATTR_FAMILY_ID]) {
730 765 u16 id = nla_get_u16(info->attrs[CTRL_ATTR_FAMILY_ID]);
731 766 res = genl_family_find_byid(id);
  767 + err = -ENOENT;
732 768 }
733 769  
734 770 if (info->attrs[CTRL_ATTR_FAMILY_NAME]) {
735 771  
736 772  
737 773  
738 774  
739 775  
740 776  
741 777  
742 778  
743 779  
744 780  
... ... @@ -736,51 +772,63 @@
736 772  
737 773 name = nla_data(info->attrs[CTRL_ATTR_FAMILY_NAME]);
738 774 res = genl_family_find_byname(name);
  775 + err = -ENOENT;
739 776 }
740 777  
741   - if (res == NULL) {
742   - err = -ENOENT;
743   - goto errout;
  778 + if (res == NULL)
  779 + return err;
  780 +
  781 + if (!res->netnsok && !net_eq(genl_info_net(info), &init_net)) {
  782 + /* family doesn't exist here */
  783 + return -ENOENT;
744 784 }
745 785  
746 786 msg = ctrl_build_family_msg(res, info->snd_pid, info->snd_seq,
747 787 CTRL_CMD_NEWFAMILY);
748   - if (IS_ERR(msg)) {
749   - err = PTR_ERR(msg);
750   - goto errout;
751   - }
  788 + if (IS_ERR(msg))
  789 + return PTR_ERR(msg);
752 790  
753   - err = genlmsg_reply(msg, info);
754   -errout:
755   - return err;
  791 + return genlmsg_reply(msg, info);
756 792 }
757 793  
758 794 static int genl_ctrl_event(int event, void *data)
759 795 {
760 796 struct sk_buff *msg;
  797 + struct genl_family *family;
  798 + struct genl_multicast_group *grp;
761 799  
762   - if (genl_sock == NULL)
  800 + /* genl is still initialising */
  801 + if (!init_net.genl_sock)
763 802 return 0;
764 803  
765 804 switch (event) {
766 805 case CTRL_CMD_NEWFAMILY:
767 806 case CTRL_CMD_DELFAMILY:
768   - msg = ctrl_build_family_msg(data, 0, 0, event);
769   - if (IS_ERR(msg))
770   - return PTR_ERR(msg);
771   -
772   - genlmsg_multicast(msg, 0, GENL_ID_CTRL, GFP_KERNEL);
  807 + family = data;
  808 + msg = ctrl_build_family_msg(family, 0, 0, event);
773 809 break;
774 810 case CTRL_CMD_NEWMCAST_GRP:
775 811 case CTRL_CMD_DELMCAST_GRP:
  812 + grp = data;
  813 + family = grp->family;
776 814 msg = ctrl_build_mcgrp_msg(data, 0, 0, event);
777   - if (IS_ERR(msg))
778   - return PTR_ERR(msg);
779   -
780   - genlmsg_multicast(msg, 0, GENL_ID_CTRL, GFP_KERNEL);
781 815 break;
  816 + default:
  817 + return -EINVAL;
782 818 }
783 819  
  820 + if (IS_ERR(msg))
  821 + return PTR_ERR(msg);
  822 +
  823 + if (!family->netnsok) {
  824 + genlmsg_multicast_netns(&init_net, msg, 0,
  825 + GENL_ID_CTRL, GFP_KERNEL);
  826 + } else {
  827 + rcu_read_lock();
  828 + genlmsg_multicast_allns(msg, 0, GENL_ID_CTRL, GFP_ATOMIC);
  829 + rcu_read_unlock();
  830 + }
  831 +
784 832 return 0;
785 833 }
786 834  
... ... @@ -795,6 +843,33 @@
795 843 .name = "notify",
796 844 };
797 845  
  846 +static int __net_init genl_pernet_init(struct net *net)
  847 +{
  848 + /* we'll bump the group number right afterwards */
  849 + net->genl_sock = netlink_kernel_create(net, NETLINK_GENERIC, 0,
  850 + genl_rcv, &genl_mutex,
  851 + THIS_MODULE);
  852 +
  853 + if (!net->genl_sock && net_eq(net, &init_net))
  854 + panic("GENL: Cannot initialize generic netlink\n");
  855 +
  856 + if (!net->genl_sock)
  857 + return -ENOMEM;
  858 +
  859 + return 0;
  860 +}
  861 +
  862 +static void __net_exit genl_pernet_exit(struct net *net)
  863 +{
  864 + netlink_kernel_release(net->genl_sock);
  865 + net->genl_sock = NULL;
  866 +}
  867 +
  868 +static struct pernet_operations genl_pernet_ops = {
  869 + .init = genl_pernet_init,
  870 + .exit = genl_pernet_exit,
  871 +};
  872 +
798 873 static int __init genl_init(void)
799 874 {
800 875 int i, err;
801 876  
802 877  
803 878  
804 879  
805 880  
806 881  
... ... @@ -804,37 +879,68 @@
804 879  
805 880 err = genl_register_family(&genl_ctrl);
806 881 if (err < 0)
807   - goto errout;
  882 + goto problem;
808 883  
809 884 err = genl_register_ops(&genl_ctrl, &genl_ctrl_ops);
810 885 if (err < 0)
811   - goto errout_register;
  886 + goto problem;
812 887  
813 888 netlink_set_nonroot(NETLINK_GENERIC, NL_NONROOT_RECV);
814 889  
815   - /* we'll bump the group number right afterwards */
816   - genl_sock = netlink_kernel_create(&init_net, NETLINK_GENERIC, 0,
817   - genl_rcv, &genl_mutex, THIS_MODULE);
818   - if (genl_sock == NULL)
819   - panic("GENL: Cannot initialize generic netlink\n");
  890 + err = register_pernet_subsys(&genl_pernet_ops);
  891 + if (err)
  892 + goto problem;
820 893  
821 894 err = genl_register_mc_group(&genl_ctrl, &notify_grp);
822 895 if (err < 0)
823   - goto errout_register;
  896 + goto problem;
824 897  
825 898 return 0;
826 899  
827   -errout_register:
828   - genl_unregister_family(&genl_ctrl);
829   -errout:
  900 +problem:
830 901 panic("GENL: Cannot register controller: %d\n", err);
831 902 }
832 903  
833 904 subsys_initcall(genl_init);
834 905  
835   -EXPORT_SYMBOL(genl_sock);
836 906 EXPORT_SYMBOL(genl_register_ops);
837 907 EXPORT_SYMBOL(genl_unregister_ops);
838 908 EXPORT_SYMBOL(genl_register_family);
839 909 EXPORT_SYMBOL(genl_unregister_family);
  910 +
  911 +static int genlmsg_mcast(struct sk_buff *skb, u32 pid, unsigned long group,
  912 + gfp_t flags)
  913 +{
  914 + struct sk_buff *tmp;
  915 + struct net *net, *prev = NULL;
  916 + int err;
  917 +
  918 + for_each_net_rcu(net) {
  919 + if (prev) {
  920 + tmp = skb_clone(skb, flags);
  921 + if (!tmp) {
  922 + err = -ENOMEM;
  923 + goto error;
  924 + }
  925 + err = nlmsg_multicast(prev->genl_sock, tmp,
  926 + pid, group, flags);
  927 + if (err)
  928 + goto error;
  929 + }
  930 +
  931 + prev = net;
  932 + }
  933 +
  934 + return nlmsg_multicast(prev->genl_sock, skb, pid, group, flags);
  935 + error:
  936 + kfree_skb(skb);
  937 + return err;
  938 +}
  939 +
  940 +int genlmsg_multicast_allns(struct sk_buff *skb, u32 pid, unsigned int group,
  941 + gfp_t flags)
  942 +{
  943 + return genlmsg_mcast(skb, pid, group, flags);
  944 +}
  945 +EXPORT_SYMBOL(genlmsg_multicast_allns);
... ... @@ -62,7 +62,7 @@
62 62 rep_nlh = nlmsg_hdr(rep_buf);
63 63 memcpy(rep_nlh, req_nlh, hdr_space);
64 64 rep_nlh->nlmsg_len = rep_buf->len;
65   - genlmsg_unicast(rep_buf, NETLINK_CB(skb).pid);
  65 + genlmsg_unicast(&init_net, rep_buf, NETLINK_CB(skb).pid);
66 66 }
67 67  
68 68 return 0;
net/wireless/nl80211.c
... ... @@ -413,7 +413,7 @@
413 413  
414 414 cfg80211_unlock_rdev(dev);
415 415  
416   - return genlmsg_unicast(msg, info->snd_pid);
  416 + return genlmsg_reply(msg, info);
417 417  
418 418 out_free:
419 419 nlmsg_free(msg);
... ... @@ -739,7 +739,7 @@
739 739 dev_put(netdev);
740 740 cfg80211_unlock_rdev(dev);
741 741  
742   - return genlmsg_unicast(msg, info->snd_pid);
  742 + return genlmsg_reply(msg, info);
743 743  
744 744 out_free:
745 745 nlmsg_free(msg);
... ... @@ -1030,7 +1030,7 @@
1030 1030 goto nla_put_failure;
1031 1031  
1032 1032 genlmsg_end(msg, hdr);
1033   - err = genlmsg_unicast(msg, info->snd_pid);
  1033 + err = genlmsg_reply(msg, info);
1034 1034 goto out;
1035 1035  
1036 1036 nla_put_failure:
... ... @@ -1618,7 +1618,7 @@
1618 1618 dev, mac_addr, &sinfo) < 0)
1619 1619 goto out_free;
1620 1620  
1621   - err = genlmsg_unicast(msg, info->snd_pid);
  1621 + err = genlmsg_reply(msg, info);
1622 1622 goto out;
1623 1623  
1624 1624 out_free:
... ... @@ -2087,7 +2087,7 @@
2087 2087 dev, dst, next_hop, &pinfo) < 0)
2088 2088 goto out_free;
2089 2089  
2090   - err = genlmsg_unicast(msg, info->snd_pid);
  2090 + err = genlmsg_reply(msg, info);
2091 2091 goto out;
2092 2092  
2093 2093 out_free:
... ... @@ -2436,7 +2436,7 @@
2436 2436 cur_params.dot11MeshHWMPnetDiameterTraversalTime);
2437 2437 nla_nest_end(msg, pinfoattr);
2438 2438 genlmsg_end(msg, hdr);
2439   - err = genlmsg_unicast(msg, info->snd_pid);
  2439 + err = genlmsg_reply(msg, info);
2440 2440 goto out;
2441 2441  
2442 2442 nla_put_failure:
... ... @@ -2624,7 +2624,7 @@
2624 2624 nla_nest_end(msg, nl_reg_rules);
2625 2625  
2626 2626 genlmsg_end(msg, hdr);
2627   - err = genlmsg_unicast(msg, info->snd_pid);
  2627 + err = genlmsg_reply(msg, info);
2628 2628 goto out;
2629 2629  
2630 2630 nla_put_failure: