From 0d17440688ad83de46e94e9fa11edb5a7fb3d180 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Mon, 17 Dec 2007 15:07:43 +0100 Subject: [PATCH 1/7] mac80211: round station cleanup timer The station cleanup timer runs every ten seconds, the exact timing is not relevant at all so it can well run together with other things to save power. Signed-off-by: Johannes Berg Signed-off-by: John W. Linville --- net/mac80211/sta_info.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index e8491554a5dc..cfd8ee9adad0 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include "ieee80211_i.h" @@ -306,7 +307,8 @@ static void sta_info_cleanup(unsigned long data) } read_unlock_bh(&local->sta_lock); - local->sta_cleanup.expires = jiffies + STA_INFO_CLEANUP_INTERVAL; + local->sta_cleanup.expires = + round_jiffies(jiffies + STA_INFO_CLEANUP_INTERVAL); add_timer(&local->sta_cleanup); } @@ -345,7 +347,8 @@ void sta_info_init(struct ieee80211_local *local) INIT_LIST_HEAD(&local->sta_list); init_timer(&local->sta_cleanup); - local->sta_cleanup.expires = jiffies + STA_INFO_CLEANUP_INTERVAL; + local->sta_cleanup.expires = + round_jiffies(jiffies + STA_INFO_CLEANUP_INTERVAL); local->sta_cleanup.data = (unsigned long) local; local->sta_cleanup.function = sta_info_cleanup; From 81100eb80add328c4d2a377326f15aa0e7236398 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Tue, 18 Dec 2007 15:11:35 +0100 Subject: [PATCH 2/7] mac80211: warn when receiving frames with unaligned data This patch makes mac80211 warn (once) when the driver passes up a frame in which the payload data is not aligned on a four-byte boundary, with a long comment for people who run into the condition and need to know what to do. Signed-off-by: Johannes Berg Signed-off-by: John W. Linville --- net/mac80211/rx.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 00f908d9275e..a7263fc476bd 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -1443,6 +1443,7 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb, struct ieee80211_sub_if_data *prev = NULL; struct sk_buff *skb_new; u8 *bssid; + int hdrlen; /* * key references and virtual interfaces are protected using RCU @@ -1472,6 +1473,18 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb, rx.fc = le16_to_cpu(hdr->frame_control); type = rx.fc & IEEE80211_FCTL_FTYPE; + /* + * Drivers are required to align the payload data to a four-byte + * boundary, so the last two bits of the address where it starts + * may not be set. The header is required to be directly before + * the payload data, padding like atheros hardware adds which is + * inbetween the 802.11 header and the payload is not supported, + * the driver is required to move the 802.11 header further back + * in that case. + */ + hdrlen = ieee80211_get_hdrlen(rx.fc); + WARN_ON_ONCE(((unsigned long)(skb->data + hdrlen)) & 3); + if (type == IEEE80211_FTYPE_DATA || type == IEEE80211_FTYPE_MGMT) local->dot11ReceivedFragmentCount++; From fae718ddaf2b00e222dddec6717aca023376723c Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Mon, 24 Dec 2007 21:09:10 -0800 Subject: [PATCH 3/7] [NETFILTER]: nf_conntrack_ipv4: fix module parameter compatibility Some users do "modprobe ip_conntrack hashsize=...". Since we have the module aliases this loads nf_conntrack_ipv4 and nf_conntrack, the hashsize parameter is unknown for nf_conntrack_ipv4 however and makes it fail. Allow to specify hashsize= for both nf_conntrack and nf_conntrack_ipv4. Note: the nf_conntrack message in the ringbuffer will display an incorrect hashsize since nf_conntrack is first pulled in as a dependency and calculates the size itself, then it gets changed through a call to nf_conntrack_set_hashsize(). Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller --- include/net/netfilter/nf_conntrack.h | 1 + net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | 3 +++ net/netfilter/nf_conntrack_core.c | 5 +++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index 90fb66d99d0c..4ac5ab187c2a 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h @@ -249,6 +249,7 @@ static inline int nf_ct_is_untracked(const struct sk_buff *skb) return (skb->nfct == &nf_conntrack_untracked.ct_general); } +extern int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp); extern unsigned int nf_conntrack_htable_size; extern int nf_conntrack_checksum; extern atomic_t nf_conntrack_count; diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c index 831e9b29806d..910dae732a0f 100644 --- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c +++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c @@ -419,6 +419,9 @@ struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv4 __read_mostly = { .me = THIS_MODULE, }; +module_param_call(hashsize, nf_conntrack_set_hashsize, param_get_uint, + &nf_conntrack_htable_size, 0600); + MODULE_ALIAS("nf_conntrack-" __stringify(AF_INET)); MODULE_ALIAS("ip_conntrack"); MODULE_LICENSE("GPL"); diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index 000c2fb462d0..a4d5cdeb0110 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c @@ -1016,7 +1016,7 @@ struct hlist_head *nf_ct_alloc_hashtable(int *sizep, int *vmalloced) } EXPORT_SYMBOL_GPL(nf_ct_alloc_hashtable); -int set_hashsize(const char *val, struct kernel_param *kp) +int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp) { int i, bucket, hashsize, vmalloced; int old_vmalloced, old_size; @@ -1063,8 +1063,9 @@ int set_hashsize(const char *val, struct kernel_param *kp) nf_ct_free_hashtable(old_hash, old_vmalloced, old_size); return 0; } +EXPORT_SYMBOL_GPL(nf_conntrack_set_hashsize); -module_param_call(hashsize, set_hashsize, param_get_uint, +module_param_call(hashsize, nf_conntrack_set_hashsize, param_get_uint, &nf_conntrack_htable_size, 0600); int __init nf_conntrack_init(void) From c6e991de4bd22dcdf9b9d9035e18b63b0bf2d198 Mon Sep 17 00:00:00 2001 From: Toyo Abe Date: Mon, 24 Dec 2007 21:29:35 -0800 Subject: [PATCH 4/7] [TUNTAP]: Fix wrong debug message. This is a trivial fix of debug message. When a persist flag is set, the message should say "enabled". Signed-off-by: Toyo Abe Signed-off-by: David S. Miller --- drivers/net/tun.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 1f7644695976..f8b8c71187a0 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -610,7 +610,7 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file, tun->flags &= ~TUN_PERSIST; DBG(KERN_INFO "%s: persist %s\n", - tun->dev->name, arg ? "disabled" : "enabled"); + tun->dev->name, arg ? "enabled" : "disabled"); break; case TUNSETOWNER: From 75ec533ec3335913009c32de878d5ed7cbe0d41c Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 24 Dec 2007 21:59:24 -0800 Subject: [PATCH 5/7] [NET] tc_nat: header install iproute2 build needs tc_nat.h header from kernel make install_headers. Signed-off-by: Stephen Hemminger Signed-off-by: David S. Miller --- include/linux/tc_act/Kbuild | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/tc_act/Kbuild b/include/linux/tc_act/Kbuild index 78dfbac36375..6dac0d7365cc 100644 --- a/include/linux/tc_act/Kbuild +++ b/include/linux/tc_act/Kbuild @@ -2,3 +2,4 @@ header-y += tc_gact.h header-y += tc_ipt.h header-y += tc_mirred.h header-y += tc_pedit.h +header-y += tc_nat.h From ecef969e5b376f98b142e22deb1cec2f23e4f5d6 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 25 Dec 2007 17:23:59 -0800 Subject: [PATCH 6/7] [VETH]: move veth.h to include/linux Move veth.h from net/ to linux/ since it is a user api, and add it to user header processing Kbuild. [ Use header-y as suggested by Sam Ravnborg. -DaveM ] Signed-off-by: Stephen Hemminger Signed-off-by: David S. Miller --- drivers/net/veth.c | 2 +- include/linux/Kbuild | 1 + include/{net => linux}/veth.h | 0 3 files changed, 2 insertions(+), 1 deletion(-) rename include/{net => linux}/veth.h (100%) diff --git a/drivers/net/veth.c b/drivers/net/veth.c index fdd1e034569d..43af9e9b2652 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c @@ -15,7 +15,7 @@ #include #include -#include +#include #define DRV_NAME "veth" #define DRV_VERSION "1.0" diff --git a/include/linux/Kbuild b/include/linux/Kbuild index 9abf5a806c15..f30fa92a44a1 100644 --- a/include/linux/Kbuild +++ b/include/linux/Kbuild @@ -153,6 +153,7 @@ header-y += toshiba.h header-y += ultrasound.h header-y += un.h header-y += utime.h +header-y += veth.h header-y += video_decoder.h header-y += video_encoder.h header-y += videotext.h diff --git a/include/net/veth.h b/include/linux/veth.h similarity index 100% rename from include/net/veth.h rename to include/linux/veth.h From a6c05c3d064dbb83be88cba3189beb5db9d2dfc3 Mon Sep 17 00:00:00 2001 From: Simon Horman Date: Tue, 25 Dec 2007 20:54:42 -0800 Subject: [PATCH 7/7] [IPV4]: Fix ip command line processing. Recently the documentation in Documentation/nfsroot.txt was update to note that in fact ip=off and ip=::::::off as the latter is ignored and the default (on) is used. This was certainly a step in the direction of reducing confusion. But it seems to me that the code ought to be fixed up so that ip=::::::off actually turns off ip autoconfiguration. This patch also notes more specifically that ip=on (aka ip=::::::on) is the default. Signed-off-by: Simon Horman Signed-off-by: David S. Miller --- Documentation/nfsroot.txt | 5 +---- net/ipv4/ipconfig.c | 10 ++++------ 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/Documentation/nfsroot.txt b/Documentation/nfsroot.txt index 9b956a969362..c86dd38e2281 100644 --- a/Documentation/nfsroot.txt +++ b/Documentation/nfsroot.txt @@ -97,10 +97,6 @@ ip=:::::: autoconfiguration will take place. The most common way to use this is "ip=dhcp". - Note that "ip=off" is not the same thing as "ip=::::::off", because in - the latter autoconfiguration will take place if any of DHCP, BOOTP or RARP - are compiled in the kernel. - IP address of the client. Default: Determined using autoconfiguration. @@ -150,6 +146,7 @@ ip=:::::: off or none: don't use autoconfiguration on or any: use any protocol available in the kernel + (default) dhcp: use DHCP bootp: use BOOTP rarp: use RARP diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c index 96400b0bd08a..420f56ad59f8 100644 --- a/net/ipv4/ipconfig.c +++ b/net/ipv4/ipconfig.c @@ -1403,6 +1403,10 @@ static int __init ic_proto_name(char *name) if (!strcmp(name, "on") || !strcmp(name, "any")) { return 1; } + if (!strcmp(name, "off") || !strcmp(name, "none")) { + ic_enable = 0; + return 1; + } #ifdef CONFIG_IP_PNP_DHCP else if (!strcmp(name, "dhcp")) { ic_proto_enabled &= ~IC_RARP; @@ -1437,12 +1441,6 @@ static int __init ip_auto_config_setup(char *addrs) ic_set_manually = 1; - ic_enable = (*addrs && - (strcmp(addrs, "off") != 0) && - (strcmp(addrs, "none") != 0)); - if (!ic_enable) - return 1; - if (ic_proto_name(addrs)) return 1;