Commit 63f3444f authored by Thomas Graf's avatar Thomas Graf Committed by David S. Miller

[IPv4]: Use rtnl registration interface

Signed-off-by: default avatarThomas Graf <tgraf@suug.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9d9e6a58
...@@ -215,10 +215,6 @@ extern void fib_select_default(const struct flowi *flp, struct fib_result *res); ...@@ -215,10 +215,6 @@ extern void fib_select_default(const struct flowi *flp, struct fib_result *res);
/* Exported by fib_frontend.c */ /* Exported by fib_frontend.c */
extern struct nla_policy rtm_ipv4_policy[]; extern struct nla_policy rtm_ipv4_policy[];
extern void ip_fib_init(void); extern void ip_fib_init(void);
extern int inet_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
extern int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
extern int inet_rtm_getroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
extern int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb);
extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
struct net_device *dev, __be32 *spec_dst, u32 *itag); struct net_device *dev, __be32 *spec_dst, u32 *itag);
extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res); extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res);
...@@ -235,8 +231,6 @@ extern __be32 __fib_res_prefsrc(struct fib_result *res); ...@@ -235,8 +231,6 @@ extern __be32 __fib_res_prefsrc(struct fib_result *res);
extern struct fib_table *fib_hash_init(u32 id); extern struct fib_table *fib_hash_init(u32 id);
#ifdef CONFIG_IP_MULTIPLE_TABLES #ifdef CONFIG_IP_MULTIPLE_TABLES
extern int fib4_rules_dump(struct sk_buff *skb, struct netlink_callback *cb);
extern void __init fib4_rules_init(void); extern void __init fib4_rules_init(void);
#ifdef CONFIG_NET_CLS_ROUTE #ifdef CONFIG_NET_CLS_ROUTE
......
...@@ -48,7 +48,6 @@ ...@@ -48,7 +48,6 @@
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/rtnetlink.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/notifier.h> #include <linux/notifier.h>
#include <linux/inetdevice.h> #include <linux/inetdevice.h>
...@@ -62,7 +61,7 @@ ...@@ -62,7 +61,7 @@
#include <net/ip.h> #include <net/ip.h>
#include <net/route.h> #include <net/route.h>
#include <net/ip_fib.h> #include <net/ip_fib.h>
#include <net/netlink.h> #include <net/rtnetlink.h>
struct ipv4_devconf ipv4_devconf = { struct ipv4_devconf ipv4_devconf = {
.accept_redirects = 1, .accept_redirects = 1,
...@@ -1241,19 +1240,6 @@ errout: ...@@ -1241,19 +1240,6 @@ errout:
rtnl_set_sk_err(RTNLGRP_IPV4_IFADDR, err); rtnl_set_sk_err(RTNLGRP_IPV4_IFADDR, err);
} }
static struct rtnetlink_link inet_rtnetlink_table[RTM_NR_MSGTYPES] = {
[RTM_NEWADDR - RTM_BASE] = { .doit = inet_rtm_newaddr, },
[RTM_DELADDR - RTM_BASE] = { .doit = inet_rtm_deladdr, },
[RTM_GETADDR - RTM_BASE] = { .dumpit = inet_dump_ifaddr, },
[RTM_NEWROUTE - RTM_BASE] = { .doit = inet_rtm_newroute, },
[RTM_DELROUTE - RTM_BASE] = { .doit = inet_rtm_delroute, },
[RTM_GETROUTE - RTM_BASE] = { .doit = inet_rtm_getroute,
.dumpit = inet_dump_fib, },
#ifdef CONFIG_IP_MULTIPLE_TABLES
[RTM_GETRULE - RTM_BASE] = { .dumpit = fib4_rules_dump, },
#endif
};
#ifdef CONFIG_SYSCTL #ifdef CONFIG_SYSCTL
void inet_forward_change(void) void inet_forward_change(void)
...@@ -1636,7 +1622,10 @@ void __init devinet_init(void) ...@@ -1636,7 +1622,10 @@ void __init devinet_init(void)
{ {
register_gifconf(PF_INET, inet_gifconf); register_gifconf(PF_INET, inet_gifconf);
register_netdevice_notifier(&ip_netdev_notifier); register_netdevice_notifier(&ip_netdev_notifier);
rtnetlink_links[PF_INET] = inet_rtnetlink_table;
rtnl_register(PF_INET, RTM_NEWADDR, inet_rtm_newaddr, NULL);
rtnl_register(PF_INET, RTM_DELADDR, inet_rtm_deladdr, NULL);
rtnl_register(PF_INET, RTM_GETADDR, NULL, inet_dump_ifaddr);
#ifdef CONFIG_SYSCTL #ifdef CONFIG_SYSCTL
devinet_sysctl.sysctl_header = devinet_sysctl.sysctl_header =
register_sysctl_table(devinet_sysctl.devinet_root_dir); register_sysctl_table(devinet_sysctl.devinet_root_dir);
......
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
#include <linux/if_addr.h> #include <linux/if_addr.h>
#include <linux/if_arp.h> #include <linux/if_arp.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/netlink.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/list.h> #include <linux/list.h>
...@@ -46,6 +45,7 @@ ...@@ -46,6 +45,7 @@
#include <net/icmp.h> #include <net/icmp.h>
#include <net/arp.h> #include <net/arp.h>
#include <net/ip_fib.h> #include <net/ip_fib.h>
#include <net/rtnetlink.h>
#define FFprint(a...) printk(KERN_DEBUG a) #define FFprint(a...) printk(KERN_DEBUG a)
...@@ -540,7 +540,7 @@ errout: ...@@ -540,7 +540,7 @@ errout:
return err; return err;
} }
int inet_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) static int inet_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
{ {
struct fib_config cfg; struct fib_config cfg;
struct fib_table *tb; struct fib_table *tb;
...@@ -561,7 +561,7 @@ errout: ...@@ -561,7 +561,7 @@ errout:
return err; return err;
} }
int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) static int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
{ {
struct fib_config cfg; struct fib_config cfg;
struct fib_table *tb; struct fib_table *tb;
...@@ -582,7 +582,7 @@ errout: ...@@ -582,7 +582,7 @@ errout:
return err; return err;
} }
int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb) static int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb)
{ {
unsigned int h, s_h; unsigned int h, s_h;
unsigned int e = 0, s_e; unsigned int e = 0, s_e;
...@@ -925,6 +925,10 @@ void __init ip_fib_init(void) ...@@ -925,6 +925,10 @@ void __init ip_fib_init(void)
register_netdevice_notifier(&fib_netdev_notifier); register_netdevice_notifier(&fib_netdev_notifier);
register_inetaddr_notifier(&fib_inetaddr_notifier); register_inetaddr_notifier(&fib_inetaddr_notifier);
nl_fib_lookup_init(); nl_fib_lookup_init();
rtnl_register(PF_INET, RTM_NEWROUTE, inet_rtm_newroute, NULL);
rtnl_register(PF_INET, RTM_DELROUTE, inet_rtm_delroute, NULL);
rtnl_register(PF_INET, RTM_GETROUTE, NULL, inet_dump_fib);
} }
EXPORT_SYMBOL(inet_addr_type); EXPORT_SYMBOL(inet_addr_type);
......
...@@ -274,7 +274,7 @@ nla_put_failure: ...@@ -274,7 +274,7 @@ nla_put_failure:
return -ENOBUFS; return -ENOBUFS;
} }
int fib4_rules_dump(struct sk_buff *skb, struct netlink_callback *cb) static int fib4_rule_dump(struct sk_buff *skb, struct netlink_callback *cb)
{ {
return fib_rules_dump(skb, cb, AF_INET); return fib_rules_dump(skb, cb, AF_INET);
} }
...@@ -327,4 +327,6 @@ void __init fib4_rules_init(void) ...@@ -327,4 +327,6 @@ void __init fib4_rules_init(void)
list_add_tail(&default_rule.common.list, &fib4_rules); list_add_tail(&default_rule.common.list, &fib4_rules);
fib_rules_register(&fib4_rules_ops); fib_rules_register(&fib4_rules_ops);
rtnl_register(PF_INET, RTM_GETRULE, NULL, fib4_rule_dump);
} }
...@@ -82,7 +82,6 @@ ...@@ -82,7 +82,6 @@
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/rtnetlink.h>
#include <linux/inetdevice.h> #include <linux/inetdevice.h>
#include <linux/igmp.h> #include <linux/igmp.h>
#include <linux/pkt_sched.h> #include <linux/pkt_sched.h>
...@@ -104,6 +103,7 @@ ...@@ -104,6 +103,7 @@
#include <net/xfrm.h> #include <net/xfrm.h>
#include <net/ip_mp_alg.h> #include <net/ip_mp_alg.h>
#include <net/netevent.h> #include <net/netevent.h>
#include <net/rtnetlink.h>
#ifdef CONFIG_SYSCTL #ifdef CONFIG_SYSCTL
#include <linux/sysctl.h> #include <linux/sysctl.h>
#endif #endif
...@@ -2721,7 +2721,7 @@ nla_put_failure: ...@@ -2721,7 +2721,7 @@ nla_put_failure:
return -EMSGSIZE; return -EMSGSIZE;
} }
int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg) static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg)
{ {
struct rtmsg *rtm; struct rtmsg *rtm;
struct nlattr *tb[RTA_MAX+1]; struct nlattr *tb[RTA_MAX+1];
...@@ -3194,6 +3194,8 @@ int __init ip_rt_init(void) ...@@ -3194,6 +3194,8 @@ int __init ip_rt_init(void)
xfrm_init(); xfrm_init();
xfrm4_init(); xfrm4_init();
#endif #endif
rtnl_register(PF_INET, RTM_GETROUTE, inet_rtm_getroute, NULL);
return rc; return rc;
} }
......
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