diff options
author | Neil Horman <nhorman@tuxdriver.com> | 2012-05-29 05:30:41 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-05-29 22:33:56 -0400 |
commit | e9412c37082b5c932e83364aaed0c38c2ce33acb (patch) | |
tree | 479e716c478173830e378f432d3d0b24c6979541 /net | |
parent | 2033e9bf06f07e049bbc77e9452856df846714cc (diff) |
genetlink: Build a generic netlink family module alias
Generic netlink searches for -type- formatted aliases when requesting a module to
fulfill a protocol request (i.e. net-pf-16-proto-16-type-<x>, where x is a type
value). However generic netlink protocols have no well defined type numbers,
they have string names. Modify genl_ctrl_getfamily to request an alias in the
format net-pf-16-proto-16-family-<x> instead, where x is a generic string, and
add a macro that builds on the previously added MODULE_ALIAS_NET_PF_PROTO_NAME
macro to allow modules to specifify those generic strings.
Note, l2tp previously hacked together an net-pf-16-proto-16-type-l2tp alias
using the MODULE_ALIAS macro, with these updates we can convert that to use the
PROTO_NAME macro.
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
CC: Eric Dumazet <eric.dumazet@gmail.com>
CC: James Chapman <jchapman@katalix.com>
CC: David Miller <davem@davemloft.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/l2tp/l2tp_netlink.c | 3 | ||||
-rw-r--r-- | net/netlink/genetlink.c | 2 |
2 files changed, 2 insertions, 3 deletions
diff --git a/net/l2tp/l2tp_netlink.c b/net/l2tp/l2tp_netlink.c index 8577264378fe..ddc553e76671 100644 --- a/net/l2tp/l2tp_netlink.c +++ b/net/l2tp/l2tp_netlink.c | |||
@@ -923,5 +923,4 @@ MODULE_AUTHOR("James Chapman <jchapman@katalix.com>"); | |||
923 | MODULE_DESCRIPTION("L2TP netlink"); | 923 | MODULE_DESCRIPTION("L2TP netlink"); |
924 | MODULE_LICENSE("GPL"); | 924 | MODULE_LICENSE("GPL"); |
925 | MODULE_VERSION("1.0"); | 925 | MODULE_VERSION("1.0"); |
926 | MODULE_ALIAS("net-pf-" __stringify(PF_NETLINK) "-proto-" \ | 926 | MODULE_ALIAS_GENL_FAMILY("l2tp"); |
927 | __stringify(NETLINK_GENERIC) "-type-" "l2tp"); | ||
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index 8340ace837f2..2cc7c1ee7690 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c | |||
@@ -836,7 +836,7 @@ static int ctrl_getfamily(struct sk_buff *skb, struct genl_info *info) | |||
836 | #ifdef CONFIG_MODULES | 836 | #ifdef CONFIG_MODULES |
837 | if (res == NULL) { | 837 | if (res == NULL) { |
838 | genl_unlock(); | 838 | genl_unlock(); |
839 | request_module("net-pf-%d-proto-%d-type-%s", | 839 | request_module("net-pf-%d-proto-%d-family-%s", |
840 | PF_NETLINK, NETLINK_GENERIC, name); | 840 | PF_NETLINK, NETLINK_GENERIC, name); |
841 | genl_lock(); | 841 | genl_lock(); |
842 | res = genl_family_find_byname(name); | 842 | res = genl_family_find_byname(name); |