[IPV4]: Cleanup the sysctl_net_ipv4.c file
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9ba639797606acbcd97be886f41fbce163914e7b Commit: 9ba639797606acbcd97be886f41fbce163914e7b Parent: 33eb9cfc700ae9ce621d47d6ca6d6b4ad7cd97f3 Author: Pavel Emelyanov [EMAIL PROTECTED] AuthorDate: Wed Dec 5 01:38:23 2007 -0800 Committer: David S. Miller [EMAIL PROTECTED] CommitDate: Mon Jan 28 14:56:27 2008 -0800 [IPV4]: Cleanup the sysctl_net_ipv4.c file This includes several cleanups: * tune Makefile to compile out this file when SYSCTL=n. Now it looks like net/core/sysctl_net_core.c one; * move the ipv4_config to af_inet.c to exist all the time; * remove additional sysctl_ip_nonlocal_bind declaration (it is already declared in net/ip.h); * remove no nonger needed ifdefs from this file. This is a preparation for using ctl paths for net/ipv4/ sysctl table. Signed-off-by: Pavel Emelyanov [EMAIL PROTECTED] Signed-off-by: David S. Miller [EMAIL PROTECTED] --- net/ipv4/Makefile |3 ++- net/ipv4/af_inet.c |4 net/ipv4/sysctl_net_ipv4.c | 13 - 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/net/ipv4/Makefile b/net/ipv4/Makefile index 93fe396..ad40ef3 100644 --- a/net/ipv4/Makefile +++ b/net/ipv4/Makefile @@ -10,9 +10,10 @@ obj-y := route.o inetpeer.o protocol.o \ tcp_minisocks.o tcp_cong.o \ datagram.o raw.o udp.o udplite.o \ arp.o icmp.o devinet.o af_inet.o igmp.o \ -sysctl_net_ipv4.o fib_frontend.o fib_semantics.o \ +fib_frontend.o fib_semantics.o \ inet_fragment.o +obj-$(CONFIG_SYSCTL) += sysctl_net_ipv4.o obj-$(CONFIG_IP_FIB_HASH) += fib_hash.o obj-$(CONFIG_IP_FIB_TRIE) += fib_trie.o obj-$(CONFIG_PROC_FS) += proc.o diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index c75f20b..0e4b6eb 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -126,6 +126,10 @@ extern void ip_mc_drop_socket(struct sock *sk); static struct list_head inetsw[SOCK_MAX]; static DEFINE_SPINLOCK(inetsw_lock); +struct ipv4_config ipv4_config; + +EXPORT_SYMBOL(ipv4_config); + /* New destruction routine */ void inet_sock_destruct(struct sock *sk) diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index bec6fe8..3546424 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c @@ -21,19 +21,10 @@ #include net/cipso_ipv4.h #include net/inet_frag.h -/* From af_inet.c */ -extern int sysctl_ip_nonlocal_bind; - -#ifdef CONFIG_SYSCTL static int zero; static int tcp_retr1_max = 255; static int ip_local_port_range_min[] = { 1, 1 }; static int ip_local_port_range_max[] = { 65535, 65535 }; -#endif - -struct ipv4_config ipv4_config; - -#ifdef CONFIG_SYSCTL static int ipv4_sysctl_forward(ctl_table *ctl, int write, struct file * filp, @@ -887,7 +878,3 @@ ctl_table ipv4_table[] = { }, { .ctl_name = 0 } }; - -#endif /* CONFIG_SYSCTL */ - -EXPORT_SYMBOL(ipv4_config); - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[IPV4]: Cleanup sysctl manipulations in devinet.c
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=51602b2a5e849babd94311e555bf1ba58151b8d4 Commit: 51602b2a5e849babd94311e555bf1ba58151b8d4 Parent: 01ecfe9ba63aa0f23bbdb15371916ba4d5382330 Author: Pavel Emelyanov [EMAIL PROTECTED] AuthorDate: Tue Dec 11 02:17:40 2007 -0800 Committer: David S. Miller [EMAIL PROTECTED] CommitDate: Mon Jan 28 14:57:09 2008 -0800 [IPV4]: Cleanup sysctl manipulations in devinet.c This includes: * moving neigh_sysctl_(un)register calls inside devinet_sysctl_(un)register ones, as they are always called in pairs; * making __devinet_sysctl_unregister() to unregister the ipv4_devconf struct, while original devinet_sysctl_unregister() works with the in_device to handle both - devconf and neigh sysctls; * make stubs for CONFIG_SYSCTL=n case to get rid of in-code ifdefs. Signed-off-by: Pavel Emelyanov [EMAIL PROTECTED] Signed-off-by: David S. Miller [EMAIL PROTECTED] --- net/ipv4/devinet.c | 59 +-- 1 files changed, 29 insertions(+), 30 deletions(-) diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index d1dc015..2dc2f7e 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c @@ -99,7 +99,14 @@ static void inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap, int destroy); #ifdef CONFIG_SYSCTL static void devinet_sysctl_register(struct in_device *idev); -static void devinet_sysctl_unregister(struct ipv4_devconf *p); +static void devinet_sysctl_unregister(struct in_device *idev); +#else +static inline void devinet_sysctl_register(struct in_device *idev) +{ +} +static inline void devinet_sysctl_unregister(struct in_device *idev) +{ +} #endif /* Locks all the inet devices. */ @@ -163,17 +170,10 @@ static struct in_device *inetdev_init(struct net_device *dev) goto out_kfree; /* Reference in_dev-dev */ dev_hold(dev); -#ifdef CONFIG_SYSCTL - neigh_sysctl_register(dev, in_dev-arp_parms, NET_IPV4, - NET_IPV4_NEIGH, ipv4, NULL, NULL); -#endif - /* Account for reference dev-ip_ptr (below) */ in_dev_hold(in_dev); -#ifdef CONFIG_SYSCTL devinet_sysctl_register(in_dev); -#endif ip_mc_init_dev(in_dev); if (dev-flags IFF_UP) ip_mc_up(in_dev); @@ -212,15 +212,9 @@ static void inetdev_destroy(struct in_device *in_dev) inet_free_ifa(ifa); } -#ifdef CONFIG_SYSCTL - devinet_sysctl_unregister(in_dev-cnf); -#endif - dev-ip_ptr = NULL; -#ifdef CONFIG_SYSCTL - neigh_sysctl_unregister(in_dev-arp_parms); -#endif + devinet_sysctl_unregister(in_dev); neigh_parms_release(arp_tbl, in_dev-arp_parms); arp_ifdown(dev); @@ -1113,13 +1107,8 @@ static int inetdev_event(struct notifier_block *this, unsigned long event, */ inetdev_changename(dev, in_dev); -#ifdef CONFIG_SYSCTL - devinet_sysctl_unregister(in_dev-cnf); - neigh_sysctl_unregister(in_dev-arp_parms); - neigh_sysctl_register(dev, in_dev-arp_parms, NET_IPV4, - NET_IPV4_NEIGH, ipv4, NULL, NULL); + devinet_sysctl_unregister(in_dev); devinet_sysctl_register(in_dev); -#endif break; } out: @@ -1518,21 +1507,31 @@ out: return; } +static void __devinet_sysctl_unregister(struct ipv4_devconf *cnf) +{ + struct devinet_sysctl_table *t = cnf-sysctl; + + if (t == NULL) + return; + + cnf-sysctl = NULL; + unregister_sysctl_table(t-sysctl_header); + kfree(t-dev_name); + kfree(t); +} + static void devinet_sysctl_register(struct in_device *idev) { - return __devinet_sysctl_register(idev-dev-name, idev-dev-ifindex, + neigh_sysctl_register(idev-dev, idev-arp_parms, NET_IPV4, + NET_IPV4_NEIGH, ipv4, NULL, NULL); + __devinet_sysctl_register(idev-dev-name, idev-dev-ifindex, idev-cnf); } -static void devinet_sysctl_unregister(struct ipv4_devconf *p) +static void devinet_sysctl_unregister(struct in_device *idev) { - if (p-sysctl) { - struct devinet_sysctl_table *t = p-sysctl; - p-sysctl = NULL; - unregister_sysctl_table(t-sysctl_header); - kfree(t-dev_name); - kfree(t); - } + __devinet_sysctl_unregister(idev-cnf); + neigh_sysctl_unregister(idev-arp_parms); } #endif - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[IPV4]: Cleanup IN_DEV_MFORWARD macro
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=01ecfe9ba63aa0f23bbdb15371916ba4d5382330 Commit: 01ecfe9ba63aa0f23bbdb15371916ba4d5382330 Parent: 95c9382a345262637d3e5c7da5f09f0f46daa930 Author: Pavel Emelyanov [EMAIL PROTECTED] AuthorDate: Tue Dec 11 02:16:47 2007 -0800 Committer: David S. Miller [EMAIL PROTECTED] CommitDate: Mon Jan 28 14:57:08 2008 -0800 [IPV4]: Cleanup IN_DEV_MFORWARD macro This is essentially IN_DEV_ANDCONF with proper arguments. Signed-off-by: Pavel Emelyanov [EMAIL PROTECTED] Signed-off-by: David S. Miller [EMAIL PROTECTED] --- include/linux/inetdevice.h |4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h index dd093ea..962a062 100644 --- a/include/linux/inetdevice.h +++ b/include/linux/inetdevice.h @@ -78,9 +78,7 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev) (max(IPV4_DEVCONF_ALL(attr), IN_DEV_CONF_GET((in_dev), attr))) #define IN_DEV_FORWARD(in_dev) IN_DEV_CONF_GET((in_dev), FORWARDING) -#define IN_DEV_MFORWARD(in_dev) (IPV4_DEVCONF_ALL(MC_FORWARDING) \ -IPV4_DEVCONF((in_dev)-cnf, \ - MC_FORWARDING)) +#define IN_DEV_MFORWARD(in_dev)IN_DEV_ANDCONF((in_dev), MC_FORWARDING) #define IN_DEV_RPFILTER(in_dev)IN_DEV_ANDCONF((in_dev), RP_FILTER) #define IN_DEV_SOURCE_ROUTE(in_dev)IN_DEV_ANDCONF((in_dev), \ ACCEPT_SOURCE_ROUTE) - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[IPV4]: Cleanup the devinet_sysctl_register
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9fa896429905eccc263ff0d5e592ecaf651af12d Commit: 9fa896429905eccc263ff0d5e592ecaf651af12d Parent: c3bac5a71b24f6ed892b250d4f7511cedc33d34c Author: Pavel Emelyanov [EMAIL PROTECTED] AuthorDate: Sun Dec 2 00:17:46 2007 +1100 Committer: David S. Miller [EMAIL PROTECTED] CommitDate: Mon Jan 28 14:55:25 2008 -0800 [IPV4]: Cleanup the devinet_sysctl_register I moved the call to kmalloc() from the *t declaration into the code (this is confusing when a variable is initialized with the result of some call) and removed unneeded comment near the error path. Just like I did with the neigh ctl-s. Besides, I fixed the goto's and the labels - they were indented with spaces :( Signed-off-by: Pavel Emelyanov [EMAIL PROTECTED] Signed-off-by: Herbert Xu [EMAIL PROTECTED] Signed-off-by: David S. Miller [EMAIL PROTECTED] --- net/ipv4/devinet.c | 17 + 1 files changed, 9 insertions(+), 8 deletions(-) diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 6e75c88..72dd0ec 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c @@ -1506,12 +1506,13 @@ static void devinet_sysctl_register(struct in_device *in_dev, { int i; struct net_device *dev = in_dev ? in_dev-dev : NULL; - struct devinet_sysctl_table *t = kmemdup(devinet_sysctl, sizeof(*t), -GFP_KERNEL); + struct devinet_sysctl_table *t; char *dev_name = NULL; + t = kmemdup(devinet_sysctl, sizeof(*t), GFP_KERNEL); if (!t) - return; + goto out; + for (i = 0; i ARRAY_SIZE(t-devinet_vars) - 1; i++) { t-devinet_vars[i].data += (char *)p - (char *)ipv4_devconf; t-devinet_vars[i].extra1 = p; @@ -1532,7 +1533,7 @@ static void devinet_sysctl_register(struct in_device *in_dev, */ dev_name = kstrdup(dev_name, GFP_KERNEL); if (!dev_name) - goto free; + goto free; t-devinet_dev[0].procname= dev_name; t-devinet_dev[0].child = t-devinet_vars; @@ -1542,16 +1543,16 @@ static void devinet_sysctl_register(struct in_device *in_dev, t-sysctl_header = register_sysctl_table(t-devinet_root_dir); if (!t-sysctl_header) - goto free_procname; + goto free_procname; p-sysctl = t; return; - /* error path */ - free_procname: +free_procname: kfree(dev_name); - free: +free: kfree(t); +out: return; } - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[IPV4]: Cleanup call to __neigh_lookup()
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1b1ac759d7c6bba6e5f4731ef6ea720b6636e27c Commit: 1b1ac759d7c6bba6e5f4731ef6ea720b6636e27c Parent: 0621ed2e4edbe2f6f83dafbf85eecefae7aaf2e8 Author: Jean Delvare [EMAIL PROTECTED] AuthorDate: Sat Jul 14 20:51:44 2007 -0700 Committer: David S. Miller [EMAIL PROTECTED] CommitDate: Sat Jul 14 20:51:44 2007 -0700 [IPV4]: Cleanup call to __neigh_lookup() Back in the times of Linux 2.2, negative values for the creat parameter of __neigh_lookup() had a particular meaning, but no longer, so we should pass 1 instead. Signed-off-by: Jean Delvare [EMAIL PROTECTED] Signed-off-by: David S. Miller [EMAIL PROTECTED] --- net/ipv4/arp.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index e00767e..9ab9d53 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c @@ -885,7 +885,7 @@ static int arp_process(struct sk_buff *skb) if (n == NULL arp-ar_op == htons(ARPOP_REPLY) inet_addr_type(sip) == RTN_UNICAST) - n = __neigh_lookup(arp_tbl, sip, dev, -1); + n = __neigh_lookup(arp_tbl, sip, dev, 1); } if (n) { - To unsubscribe from this list: send the line unsubscribe git-commits-head in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[IPV4]: cleanup
Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=132adf54639cf7dd9315e8df89c2faa59f6e46d9 Commit: 132adf54639cf7dd9315e8df89c2faa59f6e46d9 Parent: 1ac58ee37f439044eb09381f33c97ce0e7f2643b Author: Stephen Hemminger [EMAIL PROTECTED] AuthorDate: Thu Mar 8 20:44:43 2007 -0800 Committer: David S. Miller [EMAIL PROTECTED] CommitDate: Wed Apr 25 22:24:11 2007 -0700 [IPV4]: cleanup Add whitespace around keywords. Signed-off-by: Stephen Hemminger [EMAIL PROTECTED] Signed-off-by: David S. Miller [EMAIL PROTECTED] --- net/ipv4/af_inet.c |2 +- net/ipv4/arp.c |2 +- net/ipv4/cipso_ipv4.c|2 +- net/ipv4/devinet.c |4 +- net/ipv4/fib_trie.c | 17 +- net/ipv4/ip_fragment.c | 26 +- net/ipv4/ip_output.c |2 +- net/ipv4/ip_sockglue.c | 1127 +- net/ipv4/ipconfig.c |4 +- net/ipv4/ipmr.c | 305 ++-- net/ipv4/xfrm4_mode_tunnel.c |2 +- net/ipv4/xfrm4_policy.c |2 +- 12 files changed, 745 insertions(+), 750 deletions(-) diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index df41856..6e5575b 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -1339,7 +1339,7 @@ static int __init inet_init(void) * Initialise per-cpu ipv4 mibs */ - if(init_ipv4_mibs()) + if (init_ipv4_mibs()) printk(KERN_CRIT inet_init: Cannot init ipv4 mibs\n); ; ipv4_proc_init(); diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index 1a3488a..e6e196c 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c @@ -1178,7 +1178,7 @@ int arp_ioctl(unsigned int cmd, void __user *arg) goto out; } - switch(cmd) { + switch (cmd) { case SIOCDARP: err = arp_req_delete(r, dev); break; diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c index 2ce5b69..b0182aa 100644 --- a/net/ipv4/cipso_ipv4.c +++ b/net/ipv4/cipso_ipv4.c @@ -1174,7 +1174,7 @@ static int cipso_v4_map_cat_rng_ntoh(const struct cipso_v4_doi *doi_def, u16 cat_low; u16 cat_high; - for(net_iter = 0; net_iter net_cat_len; net_iter += 4) { + for (net_iter = 0; net_iter net_cat_len; net_iter += 4) { cat_high = ntohs(*((__be16 *)net_cat[net_iter])); if ((net_iter + 4) = net_cat_len) cat_low = ntohs(*((__be16 *)net_cat[net_iter + 2])); diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 98a00d0..043857b 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c @@ -633,7 +633,7 @@ int devinet_ioctl(unsigned int cmd, void __user *arg) dev_load(ifr.ifr_name); #endif - switch(cmd) { + switch (cmd) { case SIOCGIFADDR: /* Get interface address */ case SIOCGIFBRDADDR:/* Get the broadcast address */ case SIOCGIFDSTADDR:/* Get the destination address */ @@ -708,7 +708,7 @@ int devinet_ioctl(unsigned int cmd, void __user *arg) if (!ifa cmd != SIOCSIFADDR cmd != SIOCSIFFLAGS) goto done; - switch(cmd) { + switch (cmd) { case SIOCGIFADDR: /* Get interface address */ sin-sin_addr.s_addr = ifa-ifa_local; goto rarok; diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index 214c347..c331c43 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c @@ -350,11 +350,10 @@ static void __tnode_free_rcu(struct rcu_head *head) static inline void tnode_free(struct tnode *tn) { - if(IS_LEAF(tn)) { + if (IS_LEAF(tn)) { struct leaf *l = (struct leaf *) tn; call_rcu_bh(l-rcu, __leaf_free_rcu); - } - else + } else call_rcu(tn-rcu, __tnode_free_rcu); } @@ -553,7 +552,7 @@ static struct node *resize(struct trie *t, struct tnode *tn) /* Keep root node larger */ - if(!tn-parent) + if (!tn-parent) inflate_threshold_use = inflate_threshold_root; else inflate_threshold_use = inflate_threshold; @@ -584,7 +583,7 @@ static struct node *resize(struct trie *t, struct tnode *tn) /* Keep root node larger */ - if(!tn-parent) + if (!tn-parent) halve_threshold_use = halve_threshold_root; else halve_threshold_use = halve_threshold; @@ -2039,12 +2038,12 @@ static struct node *fib_trie_get_first(struct fib_trie_iter *iter, { struct node *n ; - if(!t) + if (!t) return NULL; n = rcu_dereference(t-trie); - if(!iter) + if (!iter) return NULL; if (n) { @@ -2084,7 +2083,7 @@ static void trie_collect_stats(struct trie *t, struct trie_stat *s) int i; s-tnodes