* Re: [PATCH] ipv6: Prevent access to uninitialized fib_table_hash via /proc/net/ipv6_route
From: Neil Horman @ 2012-06-15 10:56 UTC (permalink / raw)
To: Thomas Graf; +Cc: davem, netdev
In-Reply-To: <e4b53a15fadbe5c1aa5402fcc8172b0ee281da33.1339750783.git.tgraf@suug.ch>
On Fri, Jun 15, 2012 at 11:00:17AM +0200, Thomas Graf wrote:
> /proc/net/ipv6_route reflects the contents of fib_table_hash. The proc
> handler is installed in ip6_route_net_init() whereas fib_table_hash is
> allocated in fib6_net_init() _after_ the proc handler has been installed.
>
> This opens up a short time frame to access fib_table_hash with its pants
> down.
>
> fib6_init() as a whole can't be moved to an earlier position as it also
> registers the rtnetlink message handlers which should be registered at
> the end. Therefore split it into fib6_init() which is run early and
> fib6_init_late() to register the rtnetlink message handlers.
>
> Signed-off-by: Thomas Graf <tgraf@suug.ch>
Reviewed-by: Neil Horman <nhorman@tuxdriver.com>
>
^ permalink raw reply
* Re: [PATCH 05/10] netfilter: merge tcpv[4,6]_net_init into tcp_net_init
From: Pablo Neira Ayuso @ 2012-06-15 11:44 UTC (permalink / raw)
To: Gao feng; +Cc: netdev, netfilter-devel
In-Reply-To: <1339668445-23848-5-git-send-email-gaofeng@cn.fujitsu.com>
On Thu, Jun 14, 2012 at 06:07:20PM +0800, Gao feng wrote:
> merge tcpv4_net_init and tcpv6_net_init into tcp_net_init to
> reduce the redundancy codes.
>
> and use nf_proto_net.users to identify if it's the first time
> we use the nf_proto_net. when it's the first time,we will
> initialized it.
>
> Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
> ---
> net/netfilter/nf_conntrack_proto_tcp.c | 57 ++++++++------------------------
> 1 files changed, 14 insertions(+), 43 deletions(-)
>
> diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c
> index 6db9d3c..e3d5427 100644
> --- a/net/netfilter/nf_conntrack_proto_tcp.c
> +++ b/net/netfilter/nf_conntrack_proto_tcp.c
> @@ -1593,18 +1593,14 @@ static int tcp_kmemdup_compat_sysctl_table(struct nf_proto_net *pn)
> return 0;
> }
>
> -static int tcpv4_init_net(struct net *net, u_int16_t proto)
> +static int tcp_init_net(struct net *net, u_int16_t proto)
> {
> - int i;
> int ret = 0;
> struct nf_tcp_net *tn = tcp_pernet(net);
> struct nf_proto_net *pn = (struct nf_proto_net *)tn;
while at it, it would be fine if you use &tn->pn instead. I know this
cast is making the trick, but what I propose is better practise.
> -#ifdef CONFIG_SYSCTL
> - if (!pn->ctl_table) {
> -#else
> - if (!pn->users++) {
> -#endif
> + if (!pn->users) {
> + int i = 0;
> for (i = 0; i < TCP_CONNTRACK_TIMEOUT_MAX; i++)
> tn->timeouts[i] = tcp_timeouts[i];
>
> @@ -1613,45 +1609,20 @@ static int tcpv4_init_net(struct net *net, u_int16_t proto)
> tn->tcp_max_retrans = nf_ct_tcp_max_retrans;
> }
>
> - ret = tcp_kmemdup_compat_sysctl_table(pn);
> + if (proto == AF_INET) {
> + ret = tcp_kmemdup_compat_sysctl_table(pn);
> + if (ret < 0)
> + return ret;
>
> - if (ret < 0)
> - return ret;
> + ret = tcp_kmemdup_sysctl_table(pn);
One thing I noticed: This kmemdup will happen twice, once for IPv4 and
once for IPv6. I think this should happen only once, as both TCP
tracker for IPv4 and IPv6 are sharing the same nf_proto_net.
So it should happen inside the if (!pn->users) thing.
AFAICS, then this should look like the following:
if (pn->users)
return 0;
/*
* here comes all per-net initialization
*/
> + if (ret < 0)
> + nf_ct_kfree_compat_sysctl_table(pn);
> + } else
> + ret = tcp_kmemdup_sysctl_table(pn);
>
> - ret = tcp_kmemdup_sysctl_table(pn);
> -
> -#ifdef CONFIG_SYSCTL
> -#ifdef CONFIG_NF_CONNTRACK_PROC_COMPAT
> - if (ret < 0) {
> - kfree(pn->ctl_compat_table);
> - pn->ctl_compat_table = NULL;
> - }
> -#endif
> -#endif
> return ret;
> }
>
> -static int tcpv6_init_net(struct net *net, u_int16_t proto)
> -{
> - int i;
> - struct nf_tcp_net *tn = tcp_pernet(net);
> - struct nf_proto_net *pn = (struct nf_proto_net *)tn;
> -
> -#ifdef CONFIG_SYSCTL
> - if (!pn->ctl_table) {
> -#else
> - if (!pn->users++) {
> -#endif
> - for (i = 0; i < TCP_CONNTRACK_TIMEOUT_MAX; i++)
> - tn->timeouts[i] = tcp_timeouts[i];
> - tn->tcp_loose = nf_ct_tcp_loose;
> - tn->tcp_be_liberal = nf_ct_tcp_be_liberal;
> - tn->tcp_max_retrans = nf_ct_tcp_max_retrans;
> - }
> -
> - return tcp_kmemdup_sysctl_table(pn);
> -}
> -
> struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp4 __read_mostly =
> {
> .l3proto = PF_INET,
> @@ -1684,7 +1655,7 @@ struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp4 __read_mostly =
> .nla_policy = tcp_timeout_nla_policy,
> },
> #endif /* CONFIG_NF_CT_NETLINK_TIMEOUT */
> - .init_net = tcpv4_init_net,
> + .init_net = tcp_init_net,
> };
> EXPORT_SYMBOL_GPL(nf_conntrack_l4proto_tcp4);
>
> @@ -1720,6 +1691,6 @@ struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp6 __read_mostly =
> .nla_policy = tcp_timeout_nla_policy,
> },
> #endif /* CONFIG_NF_CT_NETLINK_TIMEOUT */
> - .init_net = tcpv6_init_net,
> + .init_net = tcp_init_net,
> };
> EXPORT_SYMBOL_GPL(nf_conntrack_l4proto_tcp6);
> --
> 1.7.7.6
>
^ permalink raw reply
* Re: [PATCH] leds: Rename led_brightness_set() to led_set_brightness()
From: Bryan Wu @ 2012-06-15 12:20 UTC (permalink / raw)
To: shuahkhan
Cc: rpurdie, johannes, linville, davem, LKML, linux-wireless, netdev,
linux-leds
In-Reply-To: <1339685540.2603.1.camel@lorien2>
On Thu, Jun 14, 2012 at 10:52 PM, Shuah Khan <shuahkhan@gmail.com> wrote:
> On Wed, 2012-06-13 at 14:34 -0600, Shuah Khan wrote:
>> Rename leds external interface led_brightness_set() to led_set_brightness().
>> This is the second phase of the change to reduce confusion between the
>> leds internal and external interfaces that set brightness. With this change,
>> now the external interface is led_set_brightness(). The first phase renamed
>> the internal interface led_set_brightness() to __led_set_brightness().
>> There are no changes to the interface implementations.
>>
>> Signed-off-by: Shuah Khan <shuahkhan@gmail.com>
>
> Bryan,
>
> Just in case you didn't see this patch. cc'ing linux-leds
>
I found I missed this patch and cause building failure in linux-next.
applied to my for-next.
Thanks,
-Bryan
>
>> ---
>> drivers/leds/led-class.c | 2 +-
>> drivers/leds/led-core.c | 4 ++--
>> drivers/leds/led-triggers.c | 2 +-
>> drivers/leds/ledtrig-oneshot.c | 2 +-
>> drivers/leds/ledtrig-timer.c | 2 +-
>> include/linux/leds.h | 4 ++--
>> net/mac80211/led.c | 2 +-
>> 7 files changed, 9 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
>> index cb0a6eb..c599095 100644
>> --- a/drivers/leds/led-class.c
>> +++ b/drivers/leds/led-class.c
>> @@ -222,7 +222,7 @@ void led_classdev_unregister(struct led_classdev *led_cdev)
>> #endif
>>
>> /* Stop blinking */
>> - led_brightness_set(led_cdev, LED_OFF);
>> + led_set_brightness(led_cdev, LED_OFF);
>>
>> device_unregister(led_cdev->dev);
>>
>> diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c
>> index 176961b..8a09c5f 100644
>> --- a/drivers/leds/led-core.c
>> +++ b/drivers/leds/led-core.c
>> @@ -103,7 +103,7 @@ void led_blink_set_oneshot(struct led_classdev *led_cdev,
>> }
>> EXPORT_SYMBOL(led_blink_set_oneshot);
>>
>> -void led_brightness_set(struct led_classdev *led_cdev,
>> +void led_set_brightness(struct led_classdev *led_cdev,
>> enum led_brightness brightness)
>> {
>> /* stop and clear soft-blink timer */
>> @@ -113,4 +113,4 @@ void led_brightness_set(struct led_classdev *led_cdev,
>>
>> __led_set_brightness(led_cdev, brightness);
>> }
>> -EXPORT_SYMBOL(led_brightness_set);
>> +EXPORT_SYMBOL(led_set_brightness);
>> diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c
>> index f8b14dd..57721f2 100644
>> --- a/drivers/leds/led-triggers.c
>> +++ b/drivers/leds/led-triggers.c
>> @@ -112,7 +112,7 @@ void led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trig)
>> if (led_cdev->trigger->deactivate)
>> led_cdev->trigger->deactivate(led_cdev);
>> led_cdev->trigger = NULL;
>> - led_brightness_set(led_cdev, LED_OFF);
>> + led_set_brightness(led_cdev, LED_OFF);
>> }
>> if (trig) {
>> write_lock_irqsave(&trig->leddev_list_lock, flags);
>> diff --git a/drivers/leds/ledtrig-oneshot.c b/drivers/leds/ledtrig-oneshot.c
>> index 5cbab41..2c029aa 100644
>> --- a/drivers/leds/ledtrig-oneshot.c
>> +++ b/drivers/leds/ledtrig-oneshot.c
>> @@ -177,7 +177,7 @@ static void oneshot_trig_deactivate(struct led_classdev *led_cdev)
>> }
>>
>> /* Stop blinking */
>> - led_brightness_set(led_cdev, LED_OFF);
>> + led_set_brightness(led_cdev, LED_OFF);
>> }
>>
>> static struct led_trigger oneshot_led_trigger = {
>> diff --git a/drivers/leds/ledtrig-timer.c b/drivers/leds/ledtrig-timer.c
>> index 9010f7a..f774d05 100644
>> --- a/drivers/leds/ledtrig-timer.c
>> +++ b/drivers/leds/ledtrig-timer.c
>> @@ -104,7 +104,7 @@ static void timer_trig_deactivate(struct led_classdev *led_cdev)
>> }
>>
>> /* Stop blinking */
>> - led_brightness_set(led_cdev, LED_OFF);
>> + led_set_brightness(led_cdev, LED_OFF);
>> }
>>
>> static struct led_trigger timer_led_trigger = {
>> diff --git a/include/linux/leds.h b/include/linux/leds.h
>> index dd93a22..3aade1d 100644
>> --- a/include/linux/leds.h
>> +++ b/include/linux/leds.h
>> @@ -124,7 +124,7 @@ extern void led_blink_set_oneshot(struct led_classdev *led_cdev,
>> unsigned long *delay_off,
>> int invert);
>> /**
>> - * led_brightness_set - set LED brightness
>> + * led_set_brightness - set LED brightness
>> * @led_cdev: the LED to set
>> * @brightness: the brightness to set it to
>> *
>> @@ -132,7 +132,7 @@ extern void led_blink_set_oneshot(struct led_classdev *led_cdev,
>> * software blink timer that implements blinking when the
>> * hardware doesn't.
>> */
>> -extern void led_brightness_set(struct led_classdev *led_cdev,
>> +extern void led_set_brightness(struct led_classdev *led_cdev,
>> enum led_brightness brightness);
>>
>> /*
>> diff --git a/net/mac80211/led.c b/net/mac80211/led.c
>> index 1bf7903..bcffa69 100644
>> --- a/net/mac80211/led.c
>> +++ b/net/mac80211/led.c
>> @@ -276,7 +276,7 @@ static void ieee80211_stop_tpt_led_trig(struct ieee80211_local *local)
>>
>> read_lock(&tpt_trig->trig.leddev_list_lock);
>> list_for_each_entry(led_cdev, &tpt_trig->trig.led_cdevs, trig_list)
>> - led_brightness_set(led_cdev, LED_OFF);
>> + led_set_brightness(led_cdev, LED_OFF);
>> read_unlock(&tpt_trig->trig.leddev_list_lock);
>> }
>>
>
>
--
Bryan Wu <bryan.wu@canonical.com>
Kernel Developer +86.186-168-78255 Mobile
Canonical Ltd. www.canonical.com
Ubuntu - Linux for human beings | www.ubuntu.com
^ permalink raw reply
* Re: [PATCH 05/10] netfilter: merge tcpv[4,6]_net_init into tcp_net_init
From: Gao feng @ 2012-06-15 12:30 UTC (permalink / raw)
To: Pablo Neira Ayuso; +Cc: netdev, netfilter-devel
In-Reply-To: <20120615114425.GA14449@1984>
于 2012年06月15日 19:44, Pablo Neira Ayuso 写道:
> On Thu, Jun 14, 2012 at 06:07:20PM +0800, Gao feng wrote:
>> merge tcpv4_net_init and tcpv6_net_init into tcp_net_init to
>> reduce the redundancy codes.
>>
>> and use nf_proto_net.users to identify if it's the first time
>> we use the nf_proto_net. when it's the first time,we will
>> initialized it.
>>
>> Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
>> ---
>> net/netfilter/nf_conntrack_proto_tcp.c | 57 ++++++++------------------------
>> 1 files changed, 14 insertions(+), 43 deletions(-)
>>
>> diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c
>> index 6db9d3c..e3d5427 100644
>> --- a/net/netfilter/nf_conntrack_proto_tcp.c
>> +++ b/net/netfilter/nf_conntrack_proto_tcp.c
>> @@ -1593,18 +1593,14 @@ static int tcp_kmemdup_compat_sysctl_table(struct nf_proto_net *pn)
>> return 0;
>> }
>>
>> -static int tcpv4_init_net(struct net *net, u_int16_t proto)
>> +static int tcp_init_net(struct net *net, u_int16_t proto)
>> {
>> - int i;
>> int ret = 0;
>> struct nf_tcp_net *tn = tcp_pernet(net);
>> struct nf_proto_net *pn = (struct nf_proto_net *)tn;
>
> while at it, it would be fine if you use &tn->pn instead. I know this
> cast is making the trick, but what I propose is better practise.
>
OK, I will change it.
>> -#ifdef CONFIG_SYSCTL
>> - if (!pn->ctl_table) {
>> -#else
>> - if (!pn->users++) {
>> -#endif
>> + if (!pn->users) {
>> + int i = 0;
>> for (i = 0; i < TCP_CONNTRACK_TIMEOUT_MAX; i++)
>> tn->timeouts[i] = tcp_timeouts[i];
>>
>> @@ -1613,45 +1609,20 @@ static int tcpv4_init_net(struct net *net, u_int16_t proto)
>> tn->tcp_max_retrans = nf_ct_tcp_max_retrans;
>> }
>>
>> - ret = tcp_kmemdup_compat_sysctl_table(pn);
>> + if (proto == AF_INET) {
>> + ret = tcp_kmemdup_compat_sysctl_table(pn);
>> + if (ret < 0)
>> + return ret;
>>
>> - if (ret < 0)
>> - return ret;
>> + ret = tcp_kmemdup_sysctl_table(pn);
>
> One thing I noticed: This kmemdup will happen twice, once for IPv4 and
> once for IPv6. I think this should happen only once, as both TCP
> tracker for IPv4 and IPv6 are sharing the same nf_proto_net.
>
> So it should happen inside the if (!pn->users) thing.
>
> AFAICS, then this should look like the following:
>
> if (pn->users)
> return 0;
maybe we register IPv6's l4proto first, it will only kmemdup the sysctl table.
if we return here, when we register Ipv4's l4proto,the compat sysctl table will
not be allocated, so the netfilter will have no compat sysctl entries.
>
> /*
> * here comes all per-net initialization
> */
>
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Dear Friend
From: Western.Union.Compensation @ 2012-06-15 12:51 UTC (permalink / raw)
Dear Friend,
The first $10,000.00 was sent today. My working partner has helped me to send the first $10,000.00 to you through western union. So contact our Western Union claims Agent to pick up this $10,000 now: .contact : wumt.office78@yahoo.com Tel: +2348154274617 Ask him to give you the MTCN, Sender Name to pick the $10,000.00. I told him to keep sending you $10,000.00 daily until the payment of $5.000,000.00 is completed. Again forward him your Full Name, Telephone number and address so that he will be sure..
^ permalink raw reply
* (unknown),
From: Mrs. Helen Wong @ 2012-06-15 13:03 UTC (permalink / raw)
Greetings to you,
I am Mrs.Helen Wong, from Shanghai Banking Corporation Limited. (China) I have a business proposal of USD$30,000,000 (Thirty Million United States Dollars Only) for you to transact with me
Contact me via my email address: helen_wong606@yahoo.co.jp
Mrs. Helen Wong
^ permalink raw reply
* [PATCH 02.5] mm: sl[au]b: first remove PFMEMALLOC flag then SLAB flag
From: Sebastian Andrzej Siewior @ 2012-06-15 15:54 UTC (permalink / raw)
To: Mel Gorman
Cc: Andrew Morton, Linux-MM, Linux-Netdev, LKML, David Miller,
Neil Brown, Peter Zijlstra, Mike Christie, Eric B Munson
In-Reply-To: <1337266231-8031-3-git-send-email-mgorman@suse.de>
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
If we first remove the SLAB flag followed by the PFMEMALLOC flag then the
removal of the latter will trigger the VM_BUG_ON() as it can be seen in
| kernel BUG at include/linux/page-flags.h:474!
| invalid opcode: 0000 [#1] PREEMPT SMP
| Call Trace:
| [<c10e2d77>] slab_destroy+0x27/0x70
| [<c10e3285>] drain_freelist+0x55/0x90
| [<c10e344e>] __cache_shrink+0x6e/0x90
| [<c14e3211>] ? acpi_sleep_init+0xcf/0xcf
| [<c10e349d>] kmem_cache_shrink+0x2d/0x40
because the SLAB flag is gone. This patch simply changes the order.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
mm/slab.c | 2 +-
mm/slub.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/slab.c b/mm/slab.c
index 00c601b..b1a39f7 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2007,8 +2007,8 @@ static void kmem_freepages(struct kmem_cache *cachep, void *addr)
NR_SLAB_UNRECLAIMABLE, nr_freed);
while (i--) {
BUG_ON(!PageSlab(page));
- __ClearPageSlab(page);
__ClearPageSlabPfmemalloc(page);
+ __ClearPageSlab(page);
page++;
}
if (current->reclaim_state)
diff --git a/mm/slub.c b/mm/slub.c
index f8cbec4..d753146 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1417,8 +1417,8 @@ static void __free_slab(struct kmem_cache *s, struct page *page)
NR_SLAB_RECLAIMABLE : NR_SLAB_UNRECLAIMABLE,
-pages);
- __ClearPageSlab(page);
__ClearPageSlabPfmemalloc(page);
+ __ClearPageSlab(page);
reset_page_mapcount(page);
if (current->reclaim_state)
current->reclaim_state->reclaimed_slab += pages;
--
1.7.10
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related
* Re: [net-next.git 1/4 (v5)] phy: add the EEE support and the way to access to the MMD registers.
From: Ben Hutchings @ 2012-06-15 16:37 UTC (permalink / raw)
To: Giuseppe CAVALLARO; +Cc: netdev, eric.dumazet, rayagond, davem, yuvalmin
In-Reply-To: <4FDAD0C8.6000307@st.com>
On Fri, 2012-06-15 at 08:06 +0200, Giuseppe CAVALLARO wrote:
> Hello Ben
>
> On 6/14/2012 1:28 AM, Ben Hutchings wrote:
[...]
> > But you also use this condition to decide whether to enable TX LPI, so
> > it's important that it does match the specification (§78.3) for whether
> > EEE is supported - but it doesn't. You need to work out what mode was
> > autonegotiated, then check that the relevant bit is set in both our EEE
> > advertising (*not* supported) and the LP EEE advertising masks.
>
> I've some doubts and, before resending the patch, I kindly ask you some
> further details just on this point.
>
> In the code, I check if the EEE is supported and on GMII, MII and RGMII
> and duplex mode; in case of success the Ethernet driver can enable the
> TX LPI.
> Indeed, I am only using the 3.20 and 7.61 registers w/o looking at the
> 7.60. So this should be fixed, shouldn't it?
> Am I missing anything else?
> What do you mean when say that it doesn't match the specification
> (§78.3)? I'm pointing to the '78.3 Capabilities Negotiation' chapter of
> the IEEE802-3az, is it ok?
Yes that's what I mean. As I read it, you need to check which link mode
was autonegotiated, then the corresponding bit in 7.60 and 7.61. If
they're both set then EEE is supported on the current link. (But, let
me repeat, I have not done any work on implementing EEE, so it's
entirely possible that I have misunderstood some things.)
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* Re: [net-next patch 9/12] bnx2x: Add support for ethtool -L
From: Ben Hutchings @ 2012-06-15 17:03 UTC (permalink / raw)
To: Merav Sicron; +Cc: eilong, davem, netdev
In-Reply-To: <1339591464-10554-10-git-send-email-meravs@broadcom.com>
On Wed, 2012-06-13 at 15:44 +0300, Merav Sicron wrote:
> Add support for ethtool -L/-l for setting and getting the number of RSS queues.
> The 'combined' field is used as we don't support separate IRQ for Rx and Tx.
[...]
> --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
> +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
> @@ -2809,6 +2809,85 @@ static int bnx2x_set_rxfh_indir(struct net_device *dev, const u32 *indir)
> return bnx2x_config_rss_eth(bp, false);
> }
>
> +/**
> + * bnx2x_get_channels - gets the number of RSS queues.
> + *
> + * @dev: net device
> + * @channels: returns the number of max / current queues
> + */
> +static void bnx2x_get_channels(struct net_device *dev,
> + struct ethtool_channels *channels)
> +{
> + struct bnx2x *bp = netdev_priv(dev);
> +
> + channels->max_rx = channels->max_tx = channels->max_other = 0;
> + channels->max_combined = BNX2X_MAX_RSS_COUNT(bp);
> + channels->rx_count = channels->tx_count = channels->other_count = 0;
> + channels->combined_count = BNX2X_NUM_ETH_QUEUES(bp);
Don't bother setting fields to 0; you can assume the ethtool core does
that for you.
> +}
> +
> +/**
> + * bnx2x_change_num_queues - change the number of RSS queues.
> + *
> + * @bp: bnx2x private structure
> + *
> + * Re-configure interrupt mode to get the new number of MSI-X
> + * vectors and re-add NAPI objects.
> + */
> +static void bnx2x_change_num_queues(struct bnx2x *bp, int num_rss)
> +{
> + bnx2x_del_all_napi(bp);
> + bnx2x_disable_msi(bp);
> + BNX2X_NUM_QUEUES(bp) = num_rss + NON_ETH_CONTEXT_USE;
The NON_ETH_CONTEXT_USE queues could possibly be counted as 'other'.
Depends on how closely they are associated with the net device.
> + bnx2x_set_int_mode(bp);
> + bnx2x_add_all_napi(bp);
> +}
> +
> +/**
> + * bnx2x_set_channels - sets the number of RSS queues.
> + *
> + * @dev: net device
> + * @channels: includes the number of queues requested
> + */
> +static int bnx2x_set_channels(struct net_device *dev,
> + struct ethtool_channels *channels)
> +{
> + struct bnx2x *bp = netdev_priv(dev);
> +
> +
> + DP(BNX2X_MSG_ETHTOOL,
> + "set-channels command parameters: rx = %d, tx = %d, other = %d, combined = %d\n",
> + channels->rx_count, channels->tx_count, channels->other_count,
> + channels->combined_count);
> +
> + /* We don't support separate rx / tx channels.
> + * We don't allow setting 'other' channels.
> + */
> + if (channels->rx_count || channels->tx_count || channels->other_count
> + || (channels->combined_count > BNX2X_MAX_RSS_COUNT(bp))) {
Missing a check for combined_count == 0.
Ben.
> + DP(BNX2X_MSG_ETHTOOL, "command parameters not supported\n");
> + return -EINVAL;
> + }
> +
> + /* Check if there was a change in the active parameters */
> + if (channels->combined_count == BNX2X_NUM_ETH_QUEUES(bp)) {
> + DP(BNX2X_MSG_ETHTOOL, "No change in active parameters\n");
> + return 0;
> + }
> +
> + /* Set the requested number of queues in bp context.
> + * Note that the actual number of queues created during load may be
> + * less than requested if memory is low.
> + */
> + if (unlikely(!netif_running(dev))) {
> + bnx2x_change_num_queues(bp, channels->combined_count);
> + return 0;
> + }
> + bnx2x_nic_unload(bp, UNLOAD_NORMAL);
> + bnx2x_change_num_queues(bp, channels->combined_count);
> + return bnx2x_nic_load(bp, LOAD_NORMAL);
> +}
[...]
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* [PATCH] ipv6: Handle PMTU in ICMP error handlers.
From: David Miller @ 2012-06-15 22:00 UTC (permalink / raw)
To: netdev
One tricky issue on the ipv6 side vs. ipv4 is that the ICMP callouts
to handle the error pass the 32-bit info cookie in network byte order
whereas ipv4 passes it around in host byte order.
Like the ipv4 side, we have two helper functions. One for when we
have a socket context and one for when we do not.
ip6ip6 tunnels are not handled here, because they handle PMTU events
by essentially relaying another ICMP packet-too-big message back to
the original sender.
This patch allows us to get rid of rt6_do_pmtu_disc(). It handles all
kinds of situations that simply cannot happen when we do the PMTU
update directly using a fully resolved route.
In fact, the "plen == 128" check in ip6_rt_update_pmtu() can very
likely be removed or changed into a BUG_ON() check. We should never
have a prefixed ipv6 route when we get there.
Another piece of strange history here is that TCP and DCCP, unlike in
ipv4, never invoke the update_pmtu() method from their ICMP error
handlers. This is incredibly astonishing since this is the context
where we have the most accurate context in which to make a PMTU
update, namely we have a fully connected socket and associated cached
socket route.
Signed-off-by: David S. Miller <davem@davemloft.net>
---
include/net/ip6_route.h | 8 +--
net/dccp/ipv6.c | 2 +
net/ipv6/ah6.c | 3 +-
net/ipv6/esp6.c | 2 +
net/ipv6/icmp.c | 6 +-
net/ipv6/ipcomp6.c | 2 +
net/ipv6/raw.c | 5 +-
net/ipv6/route.c | 143 +++++++++++------------------------------------
net/ipv6/tcp_ipv6.c | 2 +
net/ipv6/udp.c | 3 +
10 files changed, 54 insertions(+), 122 deletions(-)
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index a2cda24..58cb3fc 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -140,10 +140,10 @@ extern void rt6_redirect(const struct in6_addr *dest,
u8 *lladdr,
int on_link);
-extern void rt6_pmtu_discovery(const struct in6_addr *daddr,
- const struct in6_addr *saddr,
- struct net_device *dev,
- u32 pmtu);
+extern void ip6_update_pmtu(struct sk_buff *skb, struct net *net, __be32 mtu,
+ int oif, u32 mark);
+extern void ip6_sk_update_pmtu(struct sk_buff *skb, struct sock *sk,
+ __be32 mtu);
struct netlink_callback;
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index fa9512d..9991be0 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -165,6 +165,8 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
} else
dst_hold(dst);
+ dst->ops->update_pmtu(dst, ntohl(info));
+
if (inet_csk(sk)->icsk_pmtu_cookie > dst_mtu(dst)) {
dccp_sync_mss(sk, dst_mtu(dst));
} /* else let the usual retransmit timer handle it */
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c
index f1a4a2c..49d4d26 100644
--- a/net/ipv6/ah6.c
+++ b/net/ipv6/ah6.c
@@ -35,6 +35,7 @@
#include <linux/pfkeyv2.h>
#include <linux/string.h>
#include <linux/scatterlist.h>
+#include <net/ip6_route.h>
#include <net/icmp.h>
#include <net/ipv6.h>
#include <net/protocol.h>
@@ -621,7 +622,7 @@ static void ah6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
NETDEBUG(KERN_DEBUG "pmtu discovery on SA AH/%08x/%pI6\n",
ntohl(ah->spi), &iph->daddr);
-
+ ip6_update_pmtu(skb, net, info, 0, 0);
xfrm_state_put(x);
}
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
index db1521f..89a615b 100644
--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.c
@@ -39,6 +39,7 @@
#include <linux/random.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
+#include <net/ip6_route.h>
#include <net/icmp.h>
#include <net/ipv6.h>
#include <net/protocol.h>
@@ -442,6 +443,7 @@ static void esp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
return;
pr_debug("pmtu discovery on SA ESP/%08x/%pI6\n",
ntohl(esph->spi), &iph->daddr);
+ ip6_update_pmtu(skb, net, info, 0, 0);
xfrm_state_put(x);
}
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index ed89bba..5247d5c 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -649,7 +649,6 @@ static int icmpv6_rcv(struct sk_buff *skb)
struct net_device *dev = skb->dev;
struct inet6_dev *idev = __in6_dev_get(dev);
const struct in6_addr *saddr, *daddr;
- const struct ipv6hdr *orig_hdr;
struct icmp6hdr *hdr;
u8 type;
@@ -661,7 +660,7 @@ static int icmpv6_rcv(struct sk_buff *skb)
XFRM_STATE_ICMP))
goto drop_no_count;
- if (!pskb_may_pull(skb, sizeof(*hdr) + sizeof(*orig_hdr)))
+ if (!pskb_may_pull(skb, sizeof(*hdr) + sizeof(struct ipv6hdr)))
goto drop_no_count;
nh = skb_network_offset(skb);
@@ -722,9 +721,6 @@ static int icmpv6_rcv(struct sk_buff *skb)
if (!pskb_may_pull(skb, sizeof(struct ipv6hdr)))
goto discard_it;
hdr = icmp6_hdr(skb);
- orig_hdr = (struct ipv6hdr *) (hdr + 1);
- rt6_pmtu_discovery(&orig_hdr->daddr, &orig_hdr->saddr, dev,
- ntohl(hdr->icmp6_mtu));
/*
* Drop through to notify
diff --git a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c
index 5cb75bf..9283238 100644
--- a/net/ipv6/ipcomp6.c
+++ b/net/ipv6/ipcomp6.c
@@ -46,6 +46,7 @@
#include <linux/list.h>
#include <linux/vmalloc.h>
#include <linux/rtnetlink.h>
+#include <net/ip6_route.h>
#include <net/icmp.h>
#include <net/ipv6.h>
#include <net/protocol.h>
@@ -74,6 +75,7 @@ static void ipcomp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
pr_debug("pmtu discovery on SA IPCOMP/%08x/%pI6\n",
spi, &iph->daddr);
+ ip6_update_pmtu(skb, net, info, 0, 0);
xfrm_state_put(x);
}
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 93d6983..43b0042 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -328,9 +328,10 @@ static void rawv6_err(struct sock *sk, struct sk_buff *skb,
return;
harderr = icmpv6_err_convert(type, code, &err);
- if (type == ICMPV6_PKT_TOOBIG)
+ if (type == ICMPV6_PKT_TOOBIG) {
+ ip6_sk_update_pmtu(skb, sk, info);
harderr = (np->pmtudisc == IPV6_PMTUDISC_DO);
-
+ }
if (np->recverr) {
u8 *payload = skb->data;
if (!inet->hdrincl)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 58a3ec2..0d41f68 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1049,7 +1049,10 @@ static void ip6_rt_update_pmtu(struct dst_entry *dst, u32 mtu)
{
struct rt6_info *rt6 = (struct rt6_info*)dst;
+ dst_confirm(dst);
if (mtu < dst_mtu(dst) && rt6->rt6i_dst.plen == 128) {
+ struct net *net = dev_net(dst->dev);
+
rt6->rt6i_flags |= RTF_MODIFIED;
if (mtu < IPV6_MIN_MTU) {
u32 features = dst_metric(dst, RTAX_FEATURES);
@@ -1058,9 +1061,39 @@ static void ip6_rt_update_pmtu(struct dst_entry *dst, u32 mtu)
dst_metric_set(dst, RTAX_FEATURES, features);
}
dst_metric_set(dst, RTAX_MTU, mtu);
+ rt6_update_expires(rt6, net->ipv6.sysctl.ip6_rt_mtu_expires);
}
}
+void ip6_update_pmtu(struct sk_buff *skb, struct net *net, u32 mtu,
+ int oif, __be32 mark)
+{
+ const struct ipv6hdr *iph = (struct ipv6hdr *) skb->data;
+ struct dst_entry *dst;
+ struct flowi6 fl6;
+
+ memset(&fl6, 0, sizeof(fl6));
+ fl6.flowi6_oif = oif;
+ fl6.flowi6_mark = mark;
+ fl6.flowi6_flags = FLOWI_FLAG_PRECOW_METRICS;
+ fl6.daddr = iph->daddr;
+ fl6.saddr = iph->saddr;
+ fl6.flowlabel = (*(__be32 *) iph) & IPV6_FLOWINFO_MASK;
+
+ dst = ip6_route_output(net, NULL, &fl6);
+ if (!dst->error)
+ ip6_rt_update_pmtu(dst, ntohl(mtu));
+ dst_release(dst);
+}
+EXPORT_SYMBOL_GPL(ip6_update_pmtu);
+
+void ip6_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, __be32 mtu)
+{
+ ip6_update_pmtu(skb, sock_net(sk), mtu,
+ sk->sk_bound_dev_if, sk->sk_mark);
+}
+EXPORT_SYMBOL_GPL(ip6_sk_update_pmtu);
+
static unsigned int ip6_default_advmss(const struct dst_entry *dst)
{
struct net_device *dev = dst->dev;
@@ -1704,116 +1737,6 @@ out:
}
/*
- * Handle ICMP "packet too big" messages
- * i.e. Path MTU discovery
- */
-
-static void rt6_do_pmtu_disc(const struct in6_addr *daddr, const struct in6_addr *saddr,
- struct net *net, u32 pmtu, int ifindex)
-{
- struct rt6_info *rt, *nrt;
- int allfrag = 0;
-again:
- rt = rt6_lookup(net, daddr, saddr, ifindex, 0);
- if (!rt)
- return;
-
- if (rt6_check_expired(rt)) {
- ip6_del_rt(rt);
- goto again;
- }
-
- if (pmtu >= dst_mtu(&rt->dst))
- goto out;
-
- if (pmtu < IPV6_MIN_MTU) {
- /*
- * According to RFC2460, PMTU is set to the IPv6 Minimum Link
- * MTU (1280) and a fragment header should always be included
- * after a node receiving Too Big message reporting PMTU is
- * less than the IPv6 Minimum Link MTU.
- */
- pmtu = IPV6_MIN_MTU;
- allfrag = 1;
- }
-
- /* New mtu received -> path was valid.
- They are sent only in response to data packets,
- so that this nexthop apparently is reachable. --ANK
- */
- dst_confirm(&rt->dst);
-
- /* Host route. If it is static, it would be better
- not to override it, but add new one, so that
- when cache entry will expire old pmtu
- would return automatically.
- */
- if (rt->rt6i_flags & RTF_CACHE) {
- dst_metric_set(&rt->dst, RTAX_MTU, pmtu);
- if (allfrag) {
- u32 features = dst_metric(&rt->dst, RTAX_FEATURES);
- features |= RTAX_FEATURE_ALLFRAG;
- dst_metric_set(&rt->dst, RTAX_FEATURES, features);
- }
- rt6_update_expires(rt, net->ipv6.sysctl.ip6_rt_mtu_expires);
- rt->rt6i_flags |= RTF_MODIFIED;
- goto out;
- }
-
- /* Network route.
- Two cases are possible:
- 1. It is connected route. Action: COW
- 2. It is gatewayed route or NONEXTHOP route. Action: clone it.
- */
- if (!dst_get_neighbour_noref_raw(&rt->dst) && !(rt->rt6i_flags & RTF_NONEXTHOP))
- nrt = rt6_alloc_cow(rt, daddr, saddr);
- else
- nrt = rt6_alloc_clone(rt, daddr);
-
- if (nrt) {
- dst_metric_set(&nrt->dst, RTAX_MTU, pmtu);
- if (allfrag) {
- u32 features = dst_metric(&nrt->dst, RTAX_FEATURES);
- features |= RTAX_FEATURE_ALLFRAG;
- dst_metric_set(&nrt->dst, RTAX_FEATURES, features);
- }
-
- /* According to RFC 1981, detecting PMTU increase shouldn't be
- * happened within 5 mins, the recommended timer is 10 mins.
- * Here this route expiration time is set to ip6_rt_mtu_expires
- * which is 10 mins. After 10 mins the decreased pmtu is expired
- * and detecting PMTU increase will be automatically happened.
- */
- rt6_update_expires(nrt, net->ipv6.sysctl.ip6_rt_mtu_expires);
- nrt->rt6i_flags |= RTF_DYNAMIC;
- ip6_ins_rt(nrt);
- }
-out:
- dst_release(&rt->dst);
-}
-
-void rt6_pmtu_discovery(const struct in6_addr *daddr, const struct in6_addr *saddr,
- struct net_device *dev, u32 pmtu)
-{
- struct net *net = dev_net(dev);
-
- /*
- * RFC 1981 states that a node "MUST reduce the size of the packets it
- * is sending along the path" that caused the Packet Too Big message.
- * Since it's not possible in the general case to determine which
- * interface was used to send the original packet, we update the MTU
- * on the interface that will be used to send future packets. We also
- * update the MTU on the interface that received the Packet Too Big in
- * case the original packet was forced out that interface with
- * SO_BINDTODEVICE or similar. This is the next best thing to the
- * correct behaviour, which would be to update the MTU on all
- * interfaces.
- */
- rt6_do_pmtu_disc(daddr, saddr, net, pmtu, 0);
- rt6_do_pmtu_disc(daddr, saddr, net, pmtu, dev->ifindex);
-}
-
-/*
* Misc support functions
*/
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index f91b0bf..26a8862 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -415,6 +415,8 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
} else
dst_hold(dst);
+ dst->ops->update_pmtu(dst, ntohl(info));
+
if (inet_csk(sk)->icsk_pmtu_cookie > dst_mtu(dst)) {
tcp_sync_mss(sk, dst_mtu(dst));
tcp_simple_retransmit(sk);
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index f05099f..051ad48 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -479,6 +479,9 @@ void __udp6_lib_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
if (sk == NULL)
return;
+ if (type == ICMPV6_PKT_TOOBIG)
+ ip6_sk_update_pmtu(skb, sk, info);
+
np = inet6_sk(sk);
if (!icmpv6_err_convert(type, code, &err) && !np->recverr)
--
1.7.10
^ permalink raw reply related
* Re: [PATCH] can: c_can: precedence error in c_can_chip_config()
From: David Miller @ 2012-06-15 22:26 UTC (permalink / raw)
To: mkl; +Cc: netdev, linux-can, dan.carpenter
In-Reply-To: <1339755644-6686-2-git-send-email-mkl@pengutronix.de>
From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: Fri, 15 Jun 2012 12:20:44 +0200
> From: Dan Carpenter <dan.carpenter@oracle.com>
>
> (CAN_CTRLMODE_LISTENONLY & CAN_CTRLMODE_LOOPBACK) is (0x02 & 0x01) which
> is zero so the condition is never true. The intent here was to test
> that both flags were set.
>
> Cc: <stable@kernel.org> # 2.6.39+
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Applied.
^ permalink raw reply
* Re: pull-request: can: 2012-06-15
From: David Miller @ 2012-06-15 22:26 UTC (permalink / raw)
To: mkl; +Cc: netdev, linux-can
In-Reply-To: <1339755644-6686-1-git-send-email-mkl@pengutronix.de>
From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: Fri, 15 Jun 2012 12:20:43 +0200
> Hello David,
>
> here is a patch intended for v3.5, targeting net/master.
>
> Dan Carpenter found a precedence error in c_can_chip_config() function
> in the c_can driver, preventing that listen only + loop back mode can be
> activated.
It's not a pull request if you don't give me a GIT url to pull from.
:-)
^ permalink raw reply
* Re: [PATCH] bnx2x: fix panic when TX ring is full
From: David Miller @ 2012-06-15 22:30 UTC (permalink / raw)
To: eric.dumazet
Cc: netdev, therbert, evansr, eilong, meravs, yanivr, willemb, thruby
In-Reply-To: <1339616716.22704.661.camel@edumazet-glaptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 13 Jun 2012 21:45:16 +0200
> From: Eric Dumazet <edumazet@google.com>
>
> There is a off by one error in the minimal number of BD in
> bnx2x_start_xmit() and bnx2x_tx_int() before stopping/resuming tx queue.
>
> A full size GSO packet, with data included in skb->head really needs
> (MAX_SKB_FRAGS + 4) BDs, because of bnx2x_tx_split()
>
> This error triggers if BQL is disabled and heavy TCP transmit traffic
> occurs.
>
> bnx2x_tx_split() definitely can be called, remove a wrong comment.
>
> Reported-by: Tomas Hruby <thruby@google.com>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
I got tired of waiting for the Broadcom "maintainers" to review this,
so I just applied it to 'net', thanks Eric.
^ permalink raw reply
* Re: [PATCH] net: remove skb_orphan_try()
From: David Miller @ 2012-06-15 22:31 UTC (permalink / raw)
To: eric.dumazet; +Cc: jhautbois, netdev
In-Reply-To: <1339692164.7491.64.camel@edumazet-glaptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 14 Jun 2012 18:42:44 +0200
> [PATCH] net: remove skb_orphan_try()
>
> Orphaning skb in dev_hard_start_xmit() makes bonding behavior
> unfriendly for applications sending big UDP bursts : Once packets
> pass the bonding device and come to real device, they might hit a full
> qdisc and be dropped. Without orphaning, the sender is automatically
> throttled because sk->sk_wmemalloc reaches sk->sk_sndbuf (assuming
> sk_sndbuf is not too big)
>
> We could try to defer the orphaning adding another test in
> dev_hard_start_xmit(), but all this seems of little gain,
> now that BQL tends to make packets more likely to be parked
> in Qdisc queues instead of NIC TX ring, in cases where performance
> matters.
>
> Reverts commits :
> fc6055a5ba31 net: Introduce skb_orphan_try()
> 87fd308cfc6b net: skb_tx_hash() fix relative to skb_orphan_try()
> and removes SKBTX_DRV_NEEDS_SK_REF flag
>
> Reported-and-bisected-by: Jean-Michel Hautbois <jhautbois@gmail.com>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Applied, thanks Eric.
^ permalink raw reply
* Re: [patch] qlcnic: off by one in qlcnic_init_pci_info()
From: David Miller @ 2012-06-15 22:31 UTC (permalink / raw)
To: anirban.chakraborty
Cc: dan.carpenter, sony.chacko, Linux-Driver, netdev, kernel-janitors
In-Reply-To: <CC000197.32F56%anirban.chakraborty@qlogic.com>
From: Anirban Chakraborty <anirban.chakraborty@qlogic.com>
Date: Thu, 14 Jun 2012 21:03:14 -0700
>
>
> On 6/14/12 11:34 AM, "Dan Carpenter" <dan.carpenter@oracle.com> wrote:
>
>>The adapter->npars[] array has QLCNIC_MAX_PCI_FUNC elements. We
>>allocate it that way a few lines earlier in the function. So this test
>>is off by one.
>>
>>Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
...
> Acked-by: Anirban Chakraborty <anirban.chakraborty@qlogic.com>
Applied.
^ permalink raw reply
* Re: [PATCH] ipv6: Prevent access to uninitialized fib_table_hash via /proc/net/ipv6_route
From: David Miller @ 2012-06-15 22:32 UTC (permalink / raw)
To: nhorman; +Cc: tgraf, netdev
In-Reply-To: <20120615105655.GA22945@hmsreliant.think-freely.org>
From: Neil Horman <nhorman@tuxdriver.com>
Date: Fri, 15 Jun 2012 06:56:55 -0400
> On Fri, Jun 15, 2012 at 11:00:17AM +0200, Thomas Graf wrote:
>> /proc/net/ipv6_route reflects the contents of fib_table_hash. The proc
>> handler is installed in ip6_route_net_init() whereas fib_table_hash is
>> allocated in fib6_net_init() _after_ the proc handler has been installed.
>>
>> This opens up a short time frame to access fib_table_hash with its pants
>> down.
>>
>> fib6_init() as a whole can't be moved to an earlier position as it also
>> registers the rtnetlink message handlers which should be registered at
>> the end. Therefore split it into fib6_init() which is run early and
>> fib6_init_late() to register the rtnetlink message handlers.
>>
>> Signed-off-by: Thomas Graf <tgraf@suug.ch>
> Reviewed-by: Neil Horman <nhorman@tuxdriver.com>
Applied.
Since you're snooping around in here, you might notice that on network
namespace shutdown, we leak all user configured ipv6 FIB rules.
^ permalink raw reply
* Re: [net-next 0/6][pull request] Intel Wired LAN Driver Updates
From: David Miller @ 2012-06-15 22:38 UTC (permalink / raw)
To: jeffrey.t.kirsher; +Cc: netdev, gospo, sassmann
In-Reply-To: <1339669089-27955-1-git-send-email-jeffrey.t.kirsher@intel.com>
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Thu, 14 Jun 2012 03:18:03 -0700
> This series contains updates to e1000 and ixgbe.
>
> The following are changes since commit 0450243096de90ff51c3a6c605410c5e28d79f8d:
> bonding: drop_monitor aware
> and are available in the git repository at:
> git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-next master
Pulled, thanks Jeff.
^ permalink raw reply
* Re: [PATCH wireless-next 00/20] Use pr_<level>
From: Ted Ts'o @ 2012-06-15 22:50 UTC (permalink / raw)
To: Joe Perches
Cc: Johannes Berg, linux-wireless, b43-dev, libertas-dev, netdev,
linux-kernel
In-Reply-To: <1339757319.24527.21.camel@joe2Laptop>
On Fri, Jun 15, 2012 at 03:48:39AM -0700, Joe Perches wrote:
> To tee up conversions of:
> pr_<level>("%s: ...", ([truct netdevice *]foo)->name, ...)
> to
> netdev_<level>(foo, "...", ...)
If the goal is to do the latter, why introduce needless patch churn
now just to get to pr_<level>? Having a standardized netdev_<label>()
adds real benefit that can be weighed against the cost of code churn.
Why not just wait until the netdev_<level> infrastructure can be
introduced? It will save effort on everybody's part.
- Ted
^ permalink raw reply
* Re: [PATCH wireless-next 00/20] Use pr_<level>
From: Joe Perches @ 2012-06-15 23:37 UTC (permalink / raw)
To: Ted Ts'o
Cc: Johannes Berg, linux-wireless-u79uwXL29TY76Z2rM5mHXA,
b43-dev-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
libertas-dev-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
netdev-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20120615225057.GD7363-AKGzg7BKzIDYtjvyW6yDsg@public.gmane.org>
On Fri, 2012-06-15 at 18:50 -0400, Ted Ts'o wrote:
> On Fri, Jun 15, 2012 at 03:48:39AM -0700, Joe Perches wrote:
> > To tee up conversions of:
> > pr_<level>("%s: ...", ([truct netdevice *]foo)->name, ...)
> > to
> > netdev_<level>(foo, "...", ...)
>
> If the goal is to do the latter, why introduce needless patch churn
> now just to get to pr_<level>? Having a standardized netdev_<label>()
> adds real benefit that can be weighed against the cost of code churn.
> Why not just wait until the netdev_<level> infrastructure can be
> introduced? It will save effort on everybody's part.
Not really. This standardizes prefixes as is.
The newlines and such will still occur.
The git blame noise etc too.
The standardization via spatch will be
significantly easier this way. It's also
a far easier pattern to verify.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [net-next PATCH 02/02] net/ipv4: VTI support new module for ip_vti.
From: Saurabh Mohan @ 2012-06-16 1:12 UTC (permalink / raw)
To: Steffen Klassert; +Cc: netdev
In-Reply-To: <20120615053707.GV27795@secunet.com>
----- Original Message -----
> On Thu, Jun 14, 2012 at 07:43:59PM -0700, Saurabh Mohan wrote:
> > > +
> > > + iph->version = 4;
> > > + iph->protocol = IPPROTO_ESP;
> >
> > Why IPPROTO_ESP? What's with the other IPsec protocols?
> > Shouldn't this be IPPROTO_IPIP?
> >
> > @SM: VTI will work only with ESP not with AH (at least I have never
> > heard of any one using it with AH). Plus I wanted to keep this
> > module separate from IPIP (ip-in-ip tunnels).
> >
>
> VTI should be independent of the IPsec protocol.
> Our IPsec implementation supports AH (and IPCOMP)
> so VTI should support these protocols too.
>
>
That is not the intent of this feature. It is only meant to support ESP-tunnel mode. I don't know what your implementation is.
There are many ways to skin a cat. This is just one way and that is why this feature has been implemented as a module. Thus making it optional for use.
If your objection is that I called it VTI, then I can call it "ip_esp" or something similar.
A few ppl have expressed interest in this implementation and have asked for more details and enhancements. Clearly they and our customers find it useful.
I'll resubmit with the code fixes you had mentioned.
-Saurabh
^ permalink raw reply
* Re: [PATCH] ipv6: Handle PMTU in ICMP error handlers.
From: Neal Cardwell @ 2012-06-16 2:42 UTC (permalink / raw)
To: David Miller; +Cc: netdev
In-Reply-To: <20120615.150052.774388947489484043.davem@davemloft.net>
On Fri, Jun 15, 2012 at 6:00 PM, David Miller <davem@davemloft.net> wrote:
> +++ b/include/net/ip6_route.h
> +extern void ip6_update_pmtu(struct sk_buff *skb, struct net *net, __be32 mtu,
> + int oif, u32 mark);
...
> +++ b/net/ipv6/route.c
> +void ip6_update_pmtu(struct sk_buff *skb, struct net *net, u32 mtu,
> + int oif, __be32 mark)
The .h and .c files disagree on the types of mtu and mark for
ip6_update_pmtu(). Looks like the mtu should be __be32 in both. I'm
guessing mark should also be __be32 in both, though I'm not yet
familiar with that area of the code.
Otherwise looks great to me.
neal
^ permalink raw reply
* Re: [PATCH] ipv6: Handle PMTU in ICMP error handlers.
From: David Miller @ 2012-06-16 3:02 UTC (permalink / raw)
To: ncardwell; +Cc: netdev
In-Reply-To: <CADVnQyn+t8VjgqqACDvSDR3yMN-q8xntGwVwWNxB4TFLxUYU8g@mail.gmail.com>
From: Neal Cardwell <ncardwell@google.com>
Date: Fri, 15 Jun 2012 22:42:25 -0400
> On Fri, Jun 15, 2012 at 6:00 PM, David Miller <davem@davemloft.net> wrote:
>> +++ b/include/net/ip6_route.h
>> +extern void ip6_update_pmtu(struct sk_buff *skb, struct net *net, __be32 mtu,
>> + int oif, u32 mark);
> ...
>> +++ b/net/ipv6/route.c
>> +void ip6_update_pmtu(struct sk_buff *skb, struct net *net, u32 mtu,
>> + int oif, __be32 mark)
>
> The .h and .c files disagree on the types of mtu and mark for
> ip6_update_pmtu(). Looks like the mtu should be __be32 in both. I'm
> guessing mark should also be __be32 in both, though I'm not yet
> familiar with that area of the code.
>
> Otherwise looks great to me.
Thanks Neal, I've fixed it up as follows:
--------------------
[PATCH] ipv6: Fix types of ip6_update_pmtu().
The mtu should be a __be32, not the mark.
Reported-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
net/ipv6/route.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index c7ccc36..1c279fe 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1065,8 +1065,8 @@ static void ip6_rt_update_pmtu(struct dst_entry *dst, u32 mtu)
}
}
-void ip6_update_pmtu(struct sk_buff *skb, struct net *net, u32 mtu,
- int oif, __be32 mark)
+void ip6_update_pmtu(struct sk_buff *skb, struct net *net, __be32 mtu,
+ int oif, u32 mark)
{
const struct ipv6hdr *iph = (struct ipv6hdr *) skb->data;
struct dst_entry *dst;
--
1.7.10.2
^ permalink raw reply related
* [PATCH net-next v2 02/12] netfilter: add parameter proto for l4proto.init_net
From: Gao feng @ 2012-06-16 3:41 UTC (permalink / raw)
To: pablo; +Cc: netdev, netfilter-devel, Gao feng
In-Reply-To: <1339818083-31356-1-git-send-email-gaofeng@cn.fujitsu.com>
there are redundancy codes in l4proto's init_net functions.
we can use one init_net function and l3proto to impletment
the same thing.
So we should add l3proto as a parameter for init_net function.
Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
---
include/net/netfilter/nf_conntrack_l4proto.h | 2 +-
net/ipv4/netfilter/nf_conntrack_proto_icmp.c | 2 +-
net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c | 2 +-
net/netfilter/nf_conntrack_proto.c | 5 +++--
net/netfilter/nf_conntrack_proto_dccp.c | 2 +-
net/netfilter/nf_conntrack_proto_generic.c | 2 +-
net/netfilter/nf_conntrack_proto_gre.c | 2 +-
net/netfilter/nf_conntrack_proto_sctp.c | 4 ++--
net/netfilter/nf_conntrack_proto_tcp.c | 4 ++--
net/netfilter/nf_conntrack_proto_udp.c | 4 ++--
net/netfilter/nf_conntrack_proto_udplite.c | 2 +-
11 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h
index 81c52b5..5dd60f2 100644
--- a/include/net/netfilter/nf_conntrack_l4proto.h
+++ b/include/net/netfilter/nf_conntrack_l4proto.h
@@ -97,7 +97,7 @@ struct nf_conntrack_l4proto {
#endif
int *net_id;
/* Init l4proto pernet data */
- int (*init_net)(struct net *net);
+ int (*init_net)(struct net *net, u_int16_t proto);
/* Protocol name */
const char *name;
diff --git a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c
index 041923c..76f7a2f 100644
--- a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c
+++ b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c
@@ -337,7 +337,7 @@ static struct ctl_table icmp_compat_sysctl_table[] = {
#endif /* CONFIG_NF_CONNTRACK_PROC_COMPAT */
#endif /* CONFIG_SYSCTL */
-static int icmp_init_net(struct net *net)
+static int icmp_init_net(struct net *net, u_int16_t proto)
{
struct nf_icmp_net *in = icmp_pernet(net);
struct nf_proto_net *pn = (struct nf_proto_net *)in;
diff --git a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
index 63ed012..807ae09 100644
--- a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
@@ -333,7 +333,7 @@ static struct ctl_table icmpv6_sysctl_table[] = {
};
#endif /* CONFIG_SYSCTL */
-static int icmpv6_init_net(struct net *net)
+static int icmpv6_init_net(struct net *net, u_int16_t proto)
{
struct nf_icmp_net *in = icmpv6_pernet(net);
struct nf_proto_net *pn = (struct nf_proto_net *)in;
diff --git a/net/netfilter/nf_conntrack_proto.c b/net/netfilter/nf_conntrack_proto.c
index a434dd7..5ea2d71 100644
--- a/net/netfilter/nf_conntrack_proto.c
+++ b/net/netfilter/nf_conntrack_proto.c
@@ -460,7 +460,7 @@ int nf_conntrack_l4proto_register(struct net *net,
{
int ret = 0;
if (l4proto->init_net) {
- ret = l4proto->init_net(net);
+ ret = l4proto->init_net(net, l4proto->l3proto);
if (ret < 0)
return ret;
}
@@ -514,7 +514,8 @@ int nf_conntrack_proto_init(struct net *net)
{
unsigned int i;
int err;
- err = nf_conntrack_l4proto_generic.init_net(net);
+ err = nf_conntrack_l4proto_generic.init_net(net,
+ nf_conntrack_l4proto_generic.l3proto);
if (err < 0)
return err;
err = nf_ct_l4proto_register_sysctl(net,
diff --git a/net/netfilter/nf_conntrack_proto_dccp.c b/net/netfilter/nf_conntrack_proto_dccp.c
index c33f76a..52da8f0 100644
--- a/net/netfilter/nf_conntrack_proto_dccp.c
+++ b/net/netfilter/nf_conntrack_proto_dccp.c
@@ -815,7 +815,7 @@ static struct ctl_table dccp_sysctl_table[] = {
};
#endif /* CONFIG_SYSCTL */
-static int dccp_init_net(struct net *net)
+static int dccp_init_net(struct net *net, u_int16_t proto)
{
struct dccp_net *dn = dccp_pernet(net);
struct nf_proto_net *pn = (struct nf_proto_net *)dn;
diff --git a/net/netfilter/nf_conntrack_proto_generic.c b/net/netfilter/nf_conntrack_proto_generic.c
index bb0e74f..d1ed7b4 100644
--- a/net/netfilter/nf_conntrack_proto_generic.c
+++ b/net/netfilter/nf_conntrack_proto_generic.c
@@ -135,7 +135,7 @@ static struct ctl_table generic_compat_sysctl_table[] = {
#endif /* CONFIG_NF_CONNTRACK_PROC_COMPAT */
#endif /* CONFIG_SYSCTL */
-static int generic_init_net(struct net *net)
+static int generic_init_net(struct net *net, u_int16_t proto)
{
struct nf_generic_net *gn = generic_pernet(net);
struct nf_proto_net *pn = (struct nf_proto_net *)gn;
diff --git a/net/netfilter/nf_conntrack_proto_gre.c b/net/netfilter/nf_conntrack_proto_gre.c
index 25ba5a2..851b93b 100644
--- a/net/netfilter/nf_conntrack_proto_gre.c
+++ b/net/netfilter/nf_conntrack_proto_gre.c
@@ -348,7 +348,7 @@ gre_timeout_nla_policy[CTA_TIMEOUT_GRE_MAX+1] = {
};
#endif /* CONFIG_NF_CT_NETLINK_TIMEOUT */
-static int gre_init_net(struct net *net)
+static int gre_init_net(struct net *net, u_int16_t proto)
{
struct netns_proto_gre *net_gre = gre_pernet(net);
int i;
diff --git a/net/netfilter/nf_conntrack_proto_sctp.c b/net/netfilter/nf_conntrack_proto_sctp.c
index 8fb0582..1e7836c 100644
--- a/net/netfilter/nf_conntrack_proto_sctp.c
+++ b/net/netfilter/nf_conntrack_proto_sctp.c
@@ -767,7 +767,7 @@ static int sctp_kmemdup_compat_sysctl_table(struct nf_proto_net *pn)
return 0;
}
-static int sctpv4_init_net(struct net *net)
+static int sctpv4_init_net(struct net *net, u_int16_t proto)
{
int ret;
struct sctp_net *sn = sctp_pernet(net);
@@ -793,7 +793,7 @@ static int sctpv4_init_net(struct net *net)
return ret;
}
-static int sctpv6_init_net(struct net *net)
+static int sctpv6_init_net(struct net *net, u_int16_t proto)
{
struct sctp_net *sn = sctp_pernet(net);
struct nf_proto_net *pn = (struct nf_proto_net *)sn;
diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c
index 99caa13..6db9d3c 100644
--- a/net/netfilter/nf_conntrack_proto_tcp.c
+++ b/net/netfilter/nf_conntrack_proto_tcp.c
@@ -1593,7 +1593,7 @@ static int tcp_kmemdup_compat_sysctl_table(struct nf_proto_net *pn)
return 0;
}
-static int tcpv4_init_net(struct net *net)
+static int tcpv4_init_net(struct net *net, u_int16_t proto)
{
int i;
int ret = 0;
@@ -1631,7 +1631,7 @@ static int tcpv4_init_net(struct net *net)
return ret;
}
-static int tcpv6_init_net(struct net *net)
+static int tcpv6_init_net(struct net *net, u_int16_t proto)
{
int i;
struct nf_tcp_net *tn = tcp_pernet(net);
diff --git a/net/netfilter/nf_conntrack_proto_udp.c b/net/netfilter/nf_conntrack_proto_udp.c
index a83cf93..2b978e6 100644
--- a/net/netfilter/nf_conntrack_proto_udp.c
+++ b/net/netfilter/nf_conntrack_proto_udp.c
@@ -283,7 +283,7 @@ static void udp_init_net_data(struct nf_udp_net *un)
}
}
-static int udpv4_init_net(struct net *net)
+static int udpv4_init_net(struct net *net, u_int16_t proto)
{
int ret;
struct nf_udp_net *un = udp_pernet(net);
@@ -307,7 +307,7 @@ static int udpv4_init_net(struct net *net)
return ret;
}
-static int udpv6_init_net(struct net *net)
+static int udpv6_init_net(struct net *net, u_int16_t proto)
{
struct nf_udp_net *un = udp_pernet(net);
struct nf_proto_net *pn = (struct nf_proto_net *)un;
diff --git a/net/netfilter/nf_conntrack_proto_udplite.c b/net/netfilter/nf_conntrack_proto_udplite.c
index b32e700..d33e511 100644
--- a/net/netfilter/nf_conntrack_proto_udplite.c
+++ b/net/netfilter/nf_conntrack_proto_udplite.c
@@ -234,7 +234,7 @@ static struct ctl_table udplite_sysctl_table[] = {
};
#endif /* CONFIG_SYSCTL */
-static int udplite_init_net(struct net *net)
+static int udplite_init_net(struct net *net, u_int16_t proto)
{
int i;
struct udplite_net *un = udplite_pernet(net);
--
1.7.7.6
^ permalink raw reply related
* [PATCH net-next v2 09/12] netfilter: nf_conntrack_l4proto_generic cleanup
From: Gao feng @ 2012-06-16 3:41 UTC (permalink / raw)
To: pablo; +Cc: netdev, netfilter-devel, Gao feng
In-Reply-To: <1339818083-31356-1-git-send-email-gaofeng@cn.fujitsu.com>
some cleanup of nf_conntrack_l4proto_generic,
split the code to make it more clearer.
Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
---
net/netfilter/nf_conntrack_proto_generic.c | 41 ++++++++++++++++++++++-----
1 files changed, 33 insertions(+), 8 deletions(-)
diff --git a/net/netfilter/nf_conntrack_proto_generic.c b/net/netfilter/nf_conntrack_proto_generic.c
index d1ed7b4..c8487d1 100644
--- a/net/netfilter/nf_conntrack_proto_generic.c
+++ b/net/netfilter/nf_conntrack_proto_generic.c
@@ -135,34 +135,59 @@ static struct ctl_table generic_compat_sysctl_table[] = {
#endif /* CONFIG_NF_CONNTRACK_PROC_COMPAT */
#endif /* CONFIG_SYSCTL */
-static int generic_init_net(struct net *net, u_int16_t proto)
+static int generic_kmemdup_sysctl_table(struct nf_proto_net *pn)
{
- struct nf_generic_net *gn = generic_pernet(net);
- struct nf_proto_net *pn = (struct nf_proto_net *)gn;
- gn->timeout = nf_ct_generic_timeout;
#ifdef CONFIG_SYSCTL
+ struct nf_generic_net *gn = (struct nf_generic_net *)pn;
+
pn->ctl_table = kmemdup(generic_sysctl_table,
sizeof(generic_sysctl_table),
GFP_KERNEL);
if (!pn->ctl_table)
return -ENOMEM;
+
pn->ctl_table[0].data = &gn->timeout;
+#endif
+ return 0;
+}
+static int generic_kmemdup_compat_sysctl_table(struct nf_proto_net *pn)
+{
+#ifdef CONFIG_SYSCTL
#ifdef CONFIG_NF_CONNTRACK_PROC_COMPAT
+ struct nf_generic_net *gn = (struct nf_generic_net *)pn;
+
pn->ctl_compat_table = kmemdup(generic_compat_sysctl_table,
sizeof(generic_compat_sysctl_table),
GFP_KERNEL);
- if (!pn->ctl_compat_table) {
- kfree(pn->ctl_table);
- pn->ctl_table = NULL;
+ if (!pn->ctl_compat_table)
return -ENOMEM;
- }
+
pn->ctl_compat_table[0].data = &gn->timeout;
#endif
#endif
return 0;
}
+static int generic_init_net(struct net *net, u_int16_t proto)
+{
+ int ret;
+ struct nf_generic_net *gn = generic_pernet(net);
+ struct nf_proto_net *pn = &gn->pn;
+
+ gn->timeout = nf_ct_generic_timeout;
+
+ ret = generic_kmemdup_compat_sysctl_table(pn);
+ if (ret < 0)
+ return ret;
+
+ ret = generic_kmemdup_sysctl_table(pn);
+ if (ret < 0)
+ nf_ct_kfree_compat_sysctl_table(pn);
+
+ return ret;
+}
+
struct nf_conntrack_l4proto nf_conntrack_l4proto_generic __read_mostly =
{
.l3proto = PF_UNSPEC,
--
1.7.7.6
^ permalink raw reply related
* [PATCH net-next v2 06/12] netfilter: merge udpv[4,6]_net_init into udp_net_init
From: Gao feng @ 2012-06-16 3:41 UTC (permalink / raw)
To: pablo; +Cc: netdev, netfilter-devel, Gao feng
In-Reply-To: <1339818083-31356-1-git-send-email-gaofeng@cn.fujitsu.com>
merge udpv4_net_init and udpv6_net_init into udp_net_init to
reduce the redundancy codes.
and use nf_proto_net.users to identify if it's the first time
we use the nf_proto_net. when it's the first time,we will
initialized it.
Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
---
net/netfilter/nf_conntrack_proto_udp.c | 56 ++++++++++---------------------
1 files changed, 18 insertions(+), 38 deletions(-)
diff --git a/net/netfilter/nf_conntrack_proto_udp.c b/net/netfilter/nf_conntrack_proto_udp.c
index 2b978e6..61bca4f 100644
--- a/net/netfilter/nf_conntrack_proto_udp.c
+++ b/net/netfilter/nf_conntrack_proto_udp.c
@@ -270,52 +270,32 @@ static int udp_kmemdup_compat_sysctl_table(struct nf_proto_net *pn)
return 0;
}
-static void udp_init_net_data(struct nf_udp_net *un)
+static int udp_init_net(struct net *net, u_int16_t proto)
{
- int i;
-#ifdef CONFIG_SYSCTL
- if (!un->pn.ctl_table) {
-#else
- if (!un->pn.users++) {
-#endif
+ int ret;
+ struct nf_udp_net *un = udp_pernet(net);
+ struct nf_proto_net *pn = &un->pn;
+
+ if (!pn->users) {
+ int i;
for (i = 0; i < UDP_CT_MAX; i++)
un->timeouts[i] = udp_timeouts[i];
}
-}
-
-static int udpv4_init_net(struct net *net, u_int16_t proto)
-{
- int ret;
- struct nf_udp_net *un = udp_pernet(net);
- struct nf_proto_net *pn = (struct nf_proto_net *)un;
- udp_init_net_data(un);
+ if (proto == AF_INET) {
+ ret = udp_kmemdup_compat_sysctl_table(pn);
+ if (ret < 0)
+ return ret;
- ret = udp_kmemdup_compat_sysctl_table(pn);
- if (ret < 0)
- return ret;
+ ret = udp_kmemdup_sysctl_table(pn);
+ if (ret < 0)
+ nf_ct_kfree_compat_sysctl_table(pn);
+ } else
+ ret = udp_kmemdup_sysctl_table(pn);
- ret = udp_kmemdup_sysctl_table(pn);
-#ifdef CONFIG_SYSCTL
-#ifdef CONFIG_NF_CONNTRACK_PROC_COMPAT
- if (ret < 0) {
- kfree(pn->ctl_compat_table);
- pn->ctl_compat_table = NULL;
- }
-#endif
-#endif
return ret;
}
-static int udpv6_init_net(struct net *net, u_int16_t proto)
-{
- struct nf_udp_net *un = udp_pernet(net);
- struct nf_proto_net *pn = (struct nf_proto_net *)un;
-
- udp_init_net_data(un);
- return udp_kmemdup_sysctl_table(pn);
-}
-
struct nf_conntrack_l4proto nf_conntrack_l4proto_udp4 __read_mostly =
{
.l3proto = PF_INET,
@@ -343,7 +323,7 @@ struct nf_conntrack_l4proto nf_conntrack_l4proto_udp4 __read_mostly =
.nla_policy = udp_timeout_nla_policy,
},
#endif /* CONFIG_NF_CT_NETLINK_TIMEOUT */
- .init_net = udpv4_init_net,
+ .init_net = udp_init_net,
};
EXPORT_SYMBOL_GPL(nf_conntrack_l4proto_udp4);
@@ -374,6 +354,6 @@ struct nf_conntrack_l4proto nf_conntrack_l4proto_udp6 __read_mostly =
.nla_policy = udp_timeout_nla_policy,
},
#endif /* CONFIG_NF_CT_NETLINK_TIMEOUT */
- .init_net = udpv6_init_net,
+ .init_net = udp_init_net,
};
EXPORT_SYMBOL_GPL(nf_conntrack_l4proto_udp6);
--
1.7.7.6
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox