* [PATCH net-next 5/6] rxrpc: Use FIELD_SIZEOF() in af_rxrpc_init().
From: YOSHIFUJI Hideaki @ 2013-01-09 17:20 UTC (permalink / raw)
To: davem, netdev; +Cc: yoshfuji
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
---
net/rxrpc/af_rxrpc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c
index 05996d0..5b0fd29 100644
--- a/net/rxrpc/af_rxrpc.c
+++ b/net/rxrpc/af_rxrpc.c
@@ -10,6 +10,7 @@
*/
#include <linux/module.h>
+#include <linux/kernel.h>
#include <linux/net.h>
#include <linux/slab.h>
#include <linux/skbuff.h>
@@ -792,10 +793,9 @@ static const struct net_proto_family rxrpc_family_ops = {
*/
static int __init af_rxrpc_init(void)
{
- struct sk_buff *dummy_skb;
int ret = -1;
- BUILD_BUG_ON(sizeof(struct rxrpc_skb_priv) > sizeof(dummy_skb->cb));
+ BUILD_BUG_ON(sizeof(struct rxrpc_skb_priv) > FIELD_SIZEOF(struct sk_buff, cb));
rxrpc_epoch = htonl(get_seconds());
--
1.7.9.5
^ permalink raw reply related
* [PATCH net-next 6/6] unix: Use FIELD_SIZEOF() in af_unix_init().
From: YOSHIFUJI Hideaki @ 2013-01-09 17:20 UTC (permalink / raw)
To: davem, netdev; +Cc: yoshfuji
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
---
net/unix/af_unix.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 5b5c876..0c61236 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -2426,9 +2426,8 @@ static struct pernet_operations unix_net_ops = {
static int __init af_unix_init(void)
{
int rc = -1;
- struct sk_buff *dummy_skb;
- BUILD_BUG_ON(sizeof(struct unix_skb_parms) > sizeof(dummy_skb->cb));
+ BUILD_BUG_ON(sizeof(struct unix_skb_parms) > FIELD_SIZEOF(struct sk_buff, cb));
rc = proto_register(&unix_proto, 1);
if (rc != 0) {
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCH 10/14] bridge: Add the ability to pvid
From: Vlad Yasevich @ 2013-01-09 17:24 UTC (permalink / raw)
To: netdev; +Cc: davem, stephen, bridge, shmulik.ladkani, mst
In-Reply-To: <1357751882-8619-12-git-send-email-vyasevic@redhat.com>
On 01/09/2013 12:17 PM, Vlad Yasevich wrote:
> A user may designate a certain vlan as PVID. This means that
> any ingress frame that does not contain a vlan tag is assigned to
> this vlan and any forwarding decisions are made with this vlan in mind.
>
> Signed-off-by: Vlad Yasevich <vyasevic@redhat.com>
Sorry.. this one is a left-over that snuck in.... Disregard this
patch. The proper one is in the series already.
-vlad
> ---
> include/uapi/linux/if_bridge.h | 1 +
> net/bridge/br_if.c | 77 +++++++++++++++++++++++++++++++++++++--
> net/bridge/br_netlink.c | 9 +++--
> net/bridge/br_private.h | 5 ++-
> 4 files changed, 82 insertions(+), 10 deletions(-)
>
> diff --git a/include/uapi/linux/if_bridge.h b/include/uapi/linux/if_bridge.h
> index 1bc9216..e5ea4cb 100644
> --- a/include/uapi/linux/if_bridge.h
> +++ b/include/uapi/linux/if_bridge.h
> @@ -120,6 +120,7 @@ enum {
> #define IFLA_BRIDGE_MAX (__IFLA_BRIDGE_MAX - 1)
>
> #define BRIDGE_VLAN_INFO_MASTER (1<<0) /* Operate on Bridge device as well */
> +#define BRIDGE_VLAN_INFO_PVID (1<<1) /* VLAN is PVID, ingress untagged */
>
> struct bridge_vlan_info {
> u16 flags;
> diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
> index 7377113..0698581 100644
> --- a/net/bridge/br_if.c
> +++ b/net/bridge/br_if.c
> @@ -182,6 +182,56 @@ static void br_vlan_flush(struct net_bridge *br)
> }
> }
>
> +static int nbp_vlan_add_pvid(struct net_port_vlans *v,
> + struct net_bridge_vlan *vlan)
> +{
> + struct net_bridge_vlan *pvlan = rtnl_dereference(v->pvlan);
> +
> + if (pvlan == vlan)
> + return 0;
> + else if (pvlan) {
> + /* PVID is already set. Drop the ref
> + * to the old one since we'll be replace it.
> + */
> + br_vlan_put(pvlan);
> + } else if (v->port_idx) {
> + struct net_device *dev = vlans_to_port(v)->dev;
> +
> + /* Add vid 0 to filter if filter is available. */
> + if (!vlan_hw_buggy(dev)) {
> + int err = vlan_vid_add_hw(dev, 0);
> + if (err)
> + return err;
> + }
> + }
> +
> + br_vlan_hold(vlan);
> + rcu_assign_pointer(v->pvlan, vlan);
> + return 0;
> +}
> +
> +static void nbp_vlan_delete_pvid(struct net_port_vlans *v,
> + struct net_bridge_vlan *vlan)
> +{
> + struct net_bridge_vlan *pvlan = rtnl_dereference(v->pvlan);
> +
> + if (pvlan != vlan)
> + return;
> +
> + if (v->port_idx &&
> + vlan_vid_del_hw(vlans_to_port(v)->dev, 0)) {
> + pr_warn("failed to kill vid 0 for device %s\n",
> + vlans_to_port(v)->dev->name);
> + }
> +
> + /* If this VLAN is currently functioning as pvlan, clear it.
> + * It's safe to drop the refcount, since the vlan is still held
> + * by the pve->vlan pointer.
> + */
> + br_vlan_put(vlan);
> + rcu_assign_pointer(v->pvlan, NULL);
> +}
> +
> struct net_port_vlan *nbp_vlan_find(const struct net_port_vlans *v, u16 vid)
> {
> struct net_port_vlan *pve;
> @@ -198,9 +248,9 @@ struct net_port_vlan *nbp_vlan_find(const struct net_port_vlans *v, u16 vid)
> }
>
> /* Must be protected by RTNL */
> -int nbp_vlan_add(struct net_port_vlans *v, u16 vid)
> +int nbp_vlan_add(struct net_port_vlans *v, u16 vid, u16 flags)
> {
> - struct net_port_vlan *pve;
> + struct net_port_vlan *pve = NULL;
> struct net_bridge_vlan *vlan;
> struct net_bridge *br = vlans_to_bridge(v);
> struct net_bridge_port *p = vlans_to_port(v);
> @@ -247,26 +297,45 @@ int nbp_vlan_add(struct net_port_vlans *v, u16 vid)
> set_bit(v->port_idx, vlan->port_bitmap);
>
> list_add_tail_rcu(&pve->list, &v->vlan_list);
> +
> + if (flags & BRIDGE_VLAN_INFO_PVID) {
> + err = nbp_vlan_add_pvid(v, vlan);
> + if (err)
> + goto del_vlan;
> + }
> +
> return 0;
>
> clean_up:
> kfree(pve);
> br_vlan_del(vlan);
> return err;
> +del_vlan:
> + nbp_vlan_delete(v, vid, flags);
> + return err;
> }
>
> /* Must be protected by RTNL */
> -int nbp_vlan_delete(struct net_port_vlans *v, u16 vid)
> +int nbp_vlan_delete(struct net_port_vlans *v, u16 vid, u16 flags)
> {
> struct net_port_vlan *pve;
> struct net_bridge_vlan *vlan;
> + struct net_bridge *br;
>
> ASSERT_RTNL();
>
> + if (v->port_idx)
> + br = vlans_to_port(v)->br;
> + else
> + br = vlans_to_bridge(v);
> +
> pve = nbp_vlan_find(v, vid);
> if (!pve)
> return -ENOENT;
>
> + if (flags & BRIDGE_VLAN_INFO_PVID)
> + nbp_vlan_delete_pvid(v, pve->vlan);
> +
> if (v->port_idx) {
> /* A valid port index means this is a port.
> * Remove VLAN from the port device filter if it is supported.
> @@ -301,7 +370,7 @@ static void nbp_vlan_flush(struct net_port_vlans *vlans)
> ASSERT_RTNL();
>
> list_for_each_entry_safe(pve, tmp, &vlans->vlan_list, list)
> - nbp_vlan_delete(vlans, pve->vid);
> + nbp_vlan_delete(vlans, pve->vid, BRIDGE_VLAN_INFO_PVID);
> }
>
> static void release_nbp(struct kobject *kobj)
> diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
> index f365ac4..08692d1 100644
> --- a/net/bridge/br_netlink.c
> +++ b/net/bridge/br_netlink.c
> @@ -200,19 +200,20 @@ static int br_afspec(struct net_bridge *br,
>
> switch (cmd) {
> case RTM_SETLINK:
> - err = nbp_vlan_add(v, vinfo->vid);
> + err = nbp_vlan_add(v, vinfo->vid, vinfo->flags);
> if (err)
> break;
> if (p && (vinfo->flags & BRIDGE_VLAN_INFO_MASTER)) {
> err = nbp_vlan_add(&p->br->vlan_info,
> - vinfo->vid);
> + vinfo->vid, vinfo->flags);
> }
> break;
>
> case RTM_DELLINK:
> - nbp_vlan_delete(v, vinfo->vid);
> + nbp_vlan_delete(v, vinfo->vid, vinfo->flags);
> if (p && (vinfo->flags & BRIDGE_VLAN_INFO_MASTER))
> - nbp_vlan_delete(&p->br->vlan_info, vinfo->vid);
> + nbp_vlan_delete(&p->br->vlan_info, vinfo->vid,
> + vinfo->flags);
>
> break;
> }
> diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
> index 4c507a4..d39701a 100644
> --- a/net/bridge/br_private.h
> +++ b/net/bridge/br_private.h
> @@ -89,6 +89,7 @@ struct net_port_vlan {
> struct net_port_vlans {
> u16 port_idx;
> struct list_head vlan_list;
> + struct net_bridge_vlan __rcu *pvlan;
> };
>
> struct net_bridge_fdb_entry
> @@ -472,8 +473,8 @@ extern int br_min_mtu(const struct net_bridge *br);
> extern netdev_features_t br_features_recompute(struct net_bridge *br,
> netdev_features_t features);
> extern struct net_bridge_vlan *br_vlan_find(struct net_bridge *br, u16 vid);
> -extern int nbp_vlan_add(struct net_port_vlans *v, u16 vid);
> -extern int nbp_vlan_delete(struct net_port_vlans *v, u16 vid);
> +extern int nbp_vlan_add(struct net_port_vlans *v, u16 vid, u16 flags);
> +extern int nbp_vlan_delete(struct net_port_vlans *v, u16 vid, u16 flags);
> extern struct net_port_vlan *nbp_vlan_find(const struct net_port_vlans *v,
> u16 vid);
>
>
^ permalink raw reply
* [PATCH/RFC] ipv6: fib: Drop cached routes with dead neighbours on fib GC
From: Roland Dreier @ 2013-01-09 17:44 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, Roland Dreier
From: Roland Dreier <roland@purestorage.com>
This patch is as much bug report as it is a proposal to merge this
specific patch. The problem is definitely real; we hit it in a
situation where we have two systems connected back-to-back with two
bonded links between them, one system reboots, and the other system
gets NETDEV_CHANGEADDR. This patch definitely fixes that case for us,
but I'm not sure it's the right place to fix this, or if it covers all
the cases where this could happen. Anyway...
------------ 8< ------------
When a bonding interface changes slaves (or goes from no active slaves
to having a slave with link), the bonding driver generates a
NETDEV_CHANGEADDR notification. In this case, the ipv6 neighbour
discovery code calls neigh_changeaddr(), which basically just calls
neigh_flush_dev().
Now, neigh_flush_dev() just goes through the neighbour hash table and
tries to free every neighbour from the device being flushed. However,
if someone else has an additional reference on the neighbour, we hit
if (atomic_read(&n->refcnt) != 1) {
/* The most unpleasant situation.
We must destroy neighbour entry,
but someone still uses it.
The destroy will be delayed until
the last user releases us, but
we must kill timers etc. and move
it to safe state.
*/
skb_queue_purge(&n->arp_queue);
n->arp_queue_len_bytes = 0;
n->output = neigh_blackhole;
if (n->nud_state & NUD_VALID)
n->nud_state = NUD_NOARP;
else
n->nud_state = NUD_NONE;
NEIGH_PRINTK2("neigh %p is stray.\n", n);
}
which leaves the final freeing of the "stray" neighbour until the last
reference is dropped; in the meantime the output function is set to
neigh_blackhole, which does nothing but free the skb and return ENETDOWN.
All of this is fine, unless we have something like a TCP over IPv6 to
a system directly reachable via the bonding interface. In that case,
we'll have a cached route for the flow. The route will hold a
reference on a neighbour pointing to the destination, so the neighbour
will become "stray" and won't be freed. The TCP socket will hold a
reference on the route, so it won't be GCed after the aging interval.
Since every packet we send via the "stray" neighbour will be dropped,
a TCP connection can stay in the ESTABLISHED (or FIN-WAIT-1) state for
a *long* time before it finally gives up.
This leads to a situation where even new connections to or from that
destination fail, because we just drop every packet we try to send
(including things like neighbour discovery advertisements in response
to the remote system trying to find us). One symptom of having the
cached route with a "stray" neighbour around is that ping6 to the
unreachable system up will fail with:
# ping6 fe80::202:c903:f:185b%bond0
PING fe80::202:c903:f:185b%bond0(fe80::202:c903:f:185b) 56 data bytes
ping: sendmsg: Network is down
ping: sendmsg: Network is down
("sendmsg: Network is down" == ENETDOWN returned from neigh_blackhole())
A solution is much simpler than the problem's description: the ipv6
ndisc code calls fib6_run_gc() right after it calls neigh_changeaddr(),
and we can add one line to fib6_age() to drop cached routes with a
"stray" neighbour. This forcibly kills the routes that hold a reference
to the "stray" neighbour so it can be freed without waiting.
Signed-off-by: Roland Dreier <roland@purestorage.com>
---
net/ipv6/ip6_fib.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index 710cafd..5895b1c 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -1602,8 +1602,9 @@ static int fib6_age(struct rt6_info *rt, void *arg)
}
gc_args.more++;
} else if (rt->rt6i_flags & RTF_CACHE) {
- if (atomic_read(&rt->dst.__refcnt) == 0 &&
- time_after_eq(now, rt->dst.lastuse + gc_args.timeout)) {
+ if ((rt->n && rt->n->dead) ||
+ (atomic_read(&rt->dst.__refcnt) == 0 &&
+ time_after_eq(now, rt->dst.lastuse + gc_args.timeout))) {
RT6_TRACE("aging clone %p\n", rt);
return -1;
} else if (rt->rt6i_flags & RTF_GATEWAY) {
--
1.8.0
^ permalink raw reply related
* [PATCH net-next] cxgb4: Fix incorrect PFVF CMASK
From: Vipul Pandya @ 2013-01-09 17:42 UTC (permalink / raw)
To: netdev; +Cc: davem, divy, dm, abhishek, Vipul Pandya, Jay Hernandez
With Hard-Wired firmware configuration it was incorrectly provisioning the VFs
Channel Access Rights Mask.
Signed-off-by: Jay Hernandez <jay@chelsio.com>
Signed-off-by: Vipul Pandya <vipul@chelsio.com>
---
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
index aa63b66..424f8ed 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
@@ -4016,8 +4016,7 @@ static int adap_init0_no_config(struct adapter *adapter, int reset)
VFRES_NEQ, VFRES_NETHCTRL,
VFRES_NIQFLINT, VFRES_NIQ,
VFRES_TC, VFRES_NVI,
- FW_PFVF_CMD_CMASK_GET(
- FW_PFVF_CMD_CMASK_MASK),
+ FW_PFVF_CMD_CMASK_MASK,
pfvfres_pmask(
adapter, pf, vf),
VFRES_NEXACTF,
--
1.7.1
^ permalink raw reply related
* Re: [E1000-devel] [PATCH net-next] igbvf: fix setting addr_assign_type if PF is up
From: Stefan Assmann @ 2013-01-09 17:58 UTC (permalink / raw)
To: Williams, Mitch A
Cc: netdev@vger.kernel.org, e1000-devel@lists.sourceforge.net
In-Reply-To: <AAEA33E297BCAC4B9BB20A7C2DF0AB8D1F8B527A@FMSMSX107.amr.corp.intel.com>
On 09.01.2013 18:09, Williams, Mitch A wrote:
>> -----Original Message-----
>> From: Stefan Assmann [mailto:sassmann@kpanic.de]
>> Sent: Wednesday, January 09, 2013 1:59 AM
>> To: netdev@vger.kernel.org
>> Cc: e1000-devel@lists.sourceforge.net; sassmann@kpanic.de
>> Subject: [E1000-devel] [PATCH net-next] igbvf: fix setting
>> addr_assign_type if PF is up
>>
>> When the PF is up and igbvf is loaded the MAC address is not generated
>> using eth_hw_addr_random(). This results in addr_assign_type not to be
>> set.
>> Make sure it gets set.
>>
>
> NAK - In this case, the address may or may not be random. The user may
> have (and should have!) explicitly set this address from the host to
> ensure that the VF device receives the same address each time it boots.
Maybe you can give me some advice on this then. Why is there different
behaviour depending on the PF being up or down? The problem I'm facing
is that if the user did not set a MAC address for the VF manually and
the PF is up during igbvf_probe it will not be labelled as random
although it is.
What about checking IGB_VF_FLAG_PF_SET_MAC and only set NET_ADDR_RANDOM
if the flag is cleared?
Stefan
^ permalink raw reply
* [PATCH 0/4] l2tp: fix up network namespace use in l2tp_core
From: Tom Parkin @ 2013-01-09 18:36 UTC (permalink / raw)
To: netdev; +Cc: Tom Parkin
This patchset addresses network namespace issues in l2tp_core as previously
raised on netdev[1].
There is further work to be done to bring namespace support to the rest of
l2tp -- this will be addressed in a further patchset.
I've tested these changes using a stress script based around iproute2's netns
command. Test platforms include i386, x86_64, and armv6l, running on
single-core and SMP platforms, and with/without preemption enabled.
[1].
http://www.spinics.net/lists/netdev/msg214776.html
http://www.spinics.net/lists/netdev/msg212234.html
Tom Parkin (4):
l2tp: set netnsok flag for netlink messages
l2tp: prevent tunnel creation on netns mismatch
l2tp: don't pin network namespaces with tunnel sockets
l2tp: clear tunnel socket field as soon as we release it
net/l2tp/l2tp_core.c | 101 +++++++++++++++++++++++++++++++----------------
net/l2tp/l2tp_netlink.c | 1 +
2 files changed, 68 insertions(+), 34 deletions(-)
--
1.7.9.5
^ permalink raw reply
* [PATCH 1/4] l2tp: set netnsok flag for netlink messages
From: Tom Parkin @ 2013-01-09 18:36 UTC (permalink / raw)
To: netdev; +Cc: Tom Parkin, James Chapman
In-Reply-To: <1357756583-22535-1-git-send-email-tparkin@katalix.com>
The L2TP netlink code can run in namespaces. Set the netnsok flag in
genl_family to true to reflect that fact.
Signed-off-by: Tom Parkin <tparkin@katalix.com>
Signed-off-by: James Chapman <jchapman@katalix.com>
---
net/l2tp/l2tp_netlink.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/l2tp/l2tp_netlink.c b/net/l2tp/l2tp_netlink.c
index bbba3a1..c1bab22 100644
--- a/net/l2tp/l2tp_netlink.c
+++ b/net/l2tp/l2tp_netlink.c
@@ -37,6 +37,7 @@ static struct genl_family l2tp_nl_family = {
.version = L2TP_GENL_VERSION,
.hdrsize = 0,
.maxattr = L2TP_ATTR_MAX,
+ .netnsok = true,
};
/* Accessed under genl lock */
--
1.7.9.5
^ permalink raw reply related
* [PATCH 2/4] l2tp: prevent tunnel creation on netns mismatch
From: Tom Parkin @ 2013-01-09 18:36 UTC (permalink / raw)
To: netdev; +Cc: Tom Parkin, James Chapman
In-Reply-To: <1357756583-22535-1-git-send-email-tparkin@katalix.com>
l2tp_tunnel_create is passed a pointer to the network namespace for the
tunnel, along with an optional file descriptor for the tunnel which may
be passed in from userspace via. netlink.
In the case where the file descriptor is defined, ensure that the namespace
associated with that socket matches the namespace explicitly passed to
l2tp_tunnel_create.
Signed-off-by: Tom Parkin <tparkin@katalix.com>
Signed-off-by: James Chapman <jchapman@katalix.com>
---
net/l2tp/l2tp_core.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
index 1a9f372..75b347b 100644
--- a/net/l2tp/l2tp_core.c
+++ b/net/l2tp/l2tp_core.c
@@ -1521,11 +1521,18 @@ int l2tp_tunnel_create(struct net *net, int fd, int version, u32 tunnel_id, u32
if (err < 0)
goto err;
} else {
- err = -EBADF;
sock = sockfd_lookup(fd, &err);
if (!sock) {
- pr_err("tunl %hu: sockfd_lookup(fd=%d) returned %d\n",
+ pr_err("tunl %u: sockfd_lookup(fd=%d) returned %d\n",
tunnel_id, fd, err);
+ err = -EBADF;
+ goto err;
+ }
+
+ /* Reject namespace mismatches */
+ if (!net_eq(sock_net(sock->sk), net)) {
+ pr_err("tunl %u: netns mismatch\n", tunnel_id);
+ err = -EINVAL;
goto err;
}
}
--
1.7.9.5
^ permalink raw reply related
* [PATCH 4/4] l2tp: clear tunnel socket field as soon as we release it
From: Tom Parkin @ 2013-01-09 18:36 UTC (permalink / raw)
To: netdev; +Cc: Tom Parkin, James Chapman
In-Reply-To: <1357756583-22535-1-git-send-email-tparkin@katalix.com>
L2TP's struct l2tp_tunnel is freed and removed from the tunnel list
by the socket destructor, which may or may not run when we release our
reference to the socket in l2tp_tunnel_delete. To prevent any chance of
accidentally reusing the socket after it is released, clear out the field
in l2tp_tunnel_delete.
Signed-off-by: Tom Parkin <tparkin@katalix.com>
Signed-off-by: James Chapman <jchapman@katalix.com>
---
net/l2tp/l2tp_core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
index 5922eac..0cfc701 100644
--- a/net/l2tp/l2tp_core.c
+++ b/net/l2tp/l2tp_core.c
@@ -1668,6 +1668,7 @@ int l2tp_tunnel_delete(struct l2tp_tunnel *tunnel)
* sessions are removed via. the socket destructor.
*/
if (sock != NULL) {
+ tunnel->sock = NULL;
if (sock->file == NULL) {
kernel_sock_shutdown(sock, SHUT_RDWR);
sk_release_kernel(sock->sk);
--
1.7.9.5
^ permalink raw reply related
* [PATCH 3/4] l2tp: don't pin network namespaces with tunnel sockets
From: Tom Parkin @ 2013-01-09 18:36 UTC (permalink / raw)
To: netdev; +Cc: Tom Parkin, James Chapman
In-Reply-To: <1357756583-22535-1-git-send-email-tparkin@katalix.com>
L2TP supports two types of tunnel: managed and unmanaged. Managed tunnels are
dealt with by a userspace daemon, with the kernel providing user data
encapsulation and de-encapsulation for efficiency. Unmanaged tunnels provide
a simpler interface for configuring kernelspace data encap/de-encap only. In
the unmanaged tunnel case the kernel creates a tunnel socket which is not
exposed to userspace.
Unmanaged tunnels can be created using iproute2's "l2tp" command.
This patch prevents an unmanaged tunnel socket from keeping network namespaces
alive when they should otherwise be destroyed:
* Tunnel sockets are now created in the namespace passed to l2tp_tunnel_create.
To achieve this, l2tp_tunnel_sock_create now takes a struct net pointer rather
than using the namespace of the current process.
* Tunnel sockets should not hold a reference to the netns, as this
creates a reference loop which can prevent the netns correctly freeing. We
now drop the socket's netns reference using sk_change_net. To prevent
leaking sockets when the netns exits, we now implement a pernet exit hook
to free the tunnels and sessions in the netns before it is freed. This
clears up any unmanaged tunnels still alive when the netns exits.
Signed-off-by: Tom Parkin <tparkin@katalix.com>
Signed-off-by: James Chapman <jchapman@katalix.com>
---
net/l2tp/l2tp_core.c | 89 ++++++++++++++++++++++++++++++++------------------
1 file changed, 57 insertions(+), 32 deletions(-)
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
index 75b347b..5922eac 100644
--- a/net/l2tp/l2tp_core.c
+++ b/net/l2tp/l2tp_core.c
@@ -1356,29 +1356,37 @@ static void l2tp_tunnel_free(struct l2tp_tunnel *tunnel)
/* Create a socket for the tunnel, if one isn't set up by
* userspace. This is used for static tunnels where there is no
* managing L2TP daemon.
+ *
+ * Since we don't want these sockets to keep a namespace alive by
+ * themselves, we drop the socket's namespace refcount after creation.
+ * These sockets are freed when the namespace exits using the pernet
+ * exit hook.
*/
-static int l2tp_tunnel_sock_create(u32 tunnel_id, u32 peer_tunnel_id, struct l2tp_tunnel_cfg *cfg, struct socket **sockp)
+static int l2tp_tunnel_sock_create(struct net *net,
+ u32 tunnel_id,
+ u32 peer_tunnel_id,
+ struct l2tp_tunnel_cfg *cfg,
+ struct socket **sockp)
{
int err = -EINVAL;
- struct sockaddr_in udp_addr;
+ struct socket *sock = NULL;
+ struct sockaddr_in udp_addr = {0};
+ struct sockaddr_l2tpip ip_addr = {0};
#if IS_ENABLED(CONFIG_IPV6)
- struct sockaddr_in6 udp6_addr;
- struct sockaddr_l2tpip6 ip6_addr;
+ struct sockaddr_in6 udp6_addr = {0};
+ struct sockaddr_l2tpip6 ip6_addr = {0};
#endif
- struct sockaddr_l2tpip ip_addr;
- struct socket *sock = NULL;
switch (cfg->encap) {
case L2TP_ENCAPTYPE_UDP:
#if IS_ENABLED(CONFIG_IPV6)
if (cfg->local_ip6 && cfg->peer_ip6) {
- err = sock_create(AF_INET6, SOCK_DGRAM, 0, sockp);
+ err = sock_create_kern(AF_INET6, SOCK_DGRAM, 0, &sock);
if (err < 0)
goto out;
- sock = *sockp;
+ sk_change_net(sock->sk, net);
- memset(&udp6_addr, 0, sizeof(udp6_addr));
udp6_addr.sin6_family = AF_INET6;
memcpy(&udp6_addr.sin6_addr, cfg->local_ip6,
sizeof(udp6_addr.sin6_addr));
@@ -1400,13 +1408,12 @@ static int l2tp_tunnel_sock_create(u32 tunnel_id, u32 peer_tunnel_id, struct l2t
} else
#endif
{
- err = sock_create(AF_INET, SOCK_DGRAM, 0, sockp);
+ err = sock_create_kern(AF_INET, SOCK_DGRAM, 0, &sock);
if (err < 0)
goto out;
- sock = *sockp;
+ sk_change_net(sock->sk, net);
- memset(&udp_addr, 0, sizeof(udp_addr));
udp_addr.sin_family = AF_INET;
udp_addr.sin_addr = cfg->local_ip;
udp_addr.sin_port = htons(cfg->local_udp_port);
@@ -1433,14 +1440,13 @@ static int l2tp_tunnel_sock_create(u32 tunnel_id, u32 peer_tunnel_id, struct l2t
case L2TP_ENCAPTYPE_IP:
#if IS_ENABLED(CONFIG_IPV6)
if (cfg->local_ip6 && cfg->peer_ip6) {
- err = sock_create(AF_INET6, SOCK_DGRAM, IPPROTO_L2TP,
- sockp);
+ err = sock_create_kern(AF_INET6, SOCK_DGRAM,
+ IPPROTO_L2TP, &sock);
if (err < 0)
goto out;
- sock = *sockp;
+ sk_change_net(sock->sk, net);
- memset(&ip6_addr, 0, sizeof(ip6_addr));
ip6_addr.l2tp_family = AF_INET6;
memcpy(&ip6_addr.l2tp_addr, cfg->local_ip6,
sizeof(ip6_addr.l2tp_addr));
@@ -1462,14 +1468,13 @@ static int l2tp_tunnel_sock_create(u32 tunnel_id, u32 peer_tunnel_id, struct l2t
} else
#endif
{
- err = sock_create(AF_INET, SOCK_DGRAM, IPPROTO_L2TP,
- sockp);
+ err = sock_create_kern(AF_INET, SOCK_DGRAM,
+ IPPROTO_L2TP, &sock);
if (err < 0)
goto out;
- sock = *sockp;
+ sk_change_net(sock->sk, net);
- memset(&ip_addr, 0, sizeof(ip_addr));
ip_addr.l2tp_family = AF_INET;
ip_addr.l2tp_addr = cfg->local_ip;
ip_addr.l2tp_conn_id = tunnel_id;
@@ -1493,8 +1498,10 @@ static int l2tp_tunnel_sock_create(u32 tunnel_id, u32 peer_tunnel_id, struct l2t
}
out:
+ *sockp = sock;
if ((err < 0) && sock) {
- sock_release(sock);
+ kernel_sock_shutdown(sock, SHUT_RDWR);
+ sk_release_kernel(sock->sk);
*sockp = NULL;
}
@@ -1517,7 +1524,8 @@ int l2tp_tunnel_create(struct net *net, int fd, int version, u32 tunnel_id, u32
* kernel socket.
*/
if (fd < 0) {
- err = l2tp_tunnel_sock_create(tunnel_id, peer_tunnel_id, cfg, &sock);
+ err = l2tp_tunnel_sock_create(net, tunnel_id, peer_tunnel_id,
+ cfg, &sock);
if (err < 0)
goto err;
} else {
@@ -1631,6 +1639,7 @@ int l2tp_tunnel_create(struct net *net, int fd, int version, u32 tunnel_id, u32
spin_unlock_bh(&pn->l2tp_tunnel_list_lock);
err = 0;
+
err:
if (tunnelp)
*tunnelp = tunnel;
@@ -1652,19 +1661,20 @@ int l2tp_tunnel_delete(struct l2tp_tunnel *tunnel)
int err = 0;
struct socket *sock = tunnel->sock ? tunnel->sock->sk_socket : NULL;
- /* Force the tunnel socket to close. This will eventually
- * cause the tunnel to be deleted via the normal socket close
- * mechanisms when userspace closes the tunnel socket.
+ /* If the tunnel socket was created directly by the kernel, use the
+ * sk_* API to release the socket now. Otherwise go through the
+ * inet_* layer.
+ * In either case, when the socket goes away the tunnel and the
+ * sessions are removed via. the socket destructor.
*/
if (sock != NULL) {
- err = inet_shutdown(sock, 2);
-
- /* If the tunnel's socket was created by the kernel,
- * close the socket here since the socket was not
- * created by userspace.
- */
- if (sock->file == NULL)
+ if (sock->file == NULL) {
+ kernel_sock_shutdown(sock, SHUT_RDWR);
+ sk_release_kernel(sock->sk);
+ } else {
+ err = inet_shutdown(sock, 2);
err = inet_release(sock);
+ }
}
return err;
@@ -1851,8 +1861,23 @@ static __net_init int l2tp_init_net(struct net *net)
return 0;
}
+static __net_exit void l2tp_exit_net(struct net *net)
+{
+ struct l2tp_tunnel *tunnel = NULL;
+ struct l2tp_net *pn = l2tp_pernet(net);
+
+ rcu_read_lock_bh();
+ list_for_each_entry_rcu(tunnel, &pn->l2tp_tunnel_list, list) {
+ int err = l2tp_tunnel_delete(tunnel);
+ if (err)
+ pr_err("l2tp_tunnel_delete() returned %d\n", err);
+ }
+ rcu_read_unlock_bh();
+}
+
static struct pernet_operations l2tp_net_ops = {
.init = l2tp_init_net,
+ .exit = l2tp_exit_net,
.id = &l2tp_net_id,
.size = sizeof(struct l2tp_net),
};
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCH] ipv6: Netlink notify forwarding change
From: Saurabh Mohan @ 2013-01-09 18:55 UTC (permalink / raw)
To: nicolas dichtel; +Cc: netdev
In-Reply-To: <50ED9A88.1060308@6wind.com>
----- Original Message -----
> Le 09/01/2013 01:11, Saurabh Mohan a écrit :
> >
> >
> > If the interface is up and the forwarding attribute
> > (net.ipv6.conf.eth1.forwarding) is changed then a netlink message
> > is not
> > generated.
> >
> A rtnetlink message RTM_NEWNETCONF is sent (see
> inet6_netconf_notify_devconf()).
yes. The submitted patch is invalid with the
latest version. Thanks.
^ permalink raw reply
* RE: [E1000-devel] [PATCH net-next] igbvf: fix setting addr_assign_type if PF is up
From: Williams, Mitch A @ 2013-01-09 18:56 UTC (permalink / raw)
To: Stefan Assmann; +Cc: netdev@vger.kernel.org, e1000-devel@lists.sourceforge.net
In-Reply-To: <50EDAFC6.3070700@kpanic.de>
> >> When the PF is up and igbvf is loaded the MAC address is not
> >> generated using eth_hw_addr_random(). This results in
> >> addr_assign_type not to be set.
> >> Make sure it gets set.
> >>
> >
> > NAK - In this case, the address may or may not be random. The user may
> > have (and should have!) explicitly set this address from the host to
> > ensure that the VF device receives the same address each time it
> boots.
>
> Maybe you can give me some advice on this then. Why is there different
> behaviour depending on the PF being up or down? The problem I'm facing
> is that if the user did not set a MAC address for the VF manually and
> the PF is up during igbvf_probe it will not be labelled as random
> although it is.
> What about checking IGB_VF_FLAG_PF_SET_MAC and only set NET_ADDR_RANDOM
> if the flag is cleared?
>
The difference in behavior is because we cannot get any MAC address at all
if the PF is down. The interface won't operate at all in this case, but if
the PF comes up sometime later, we can start working. The other alternative
is to leave the MAC address as all zeros and forcing the user to assign
an address manually. We chose to use a random address to at least give it
a chance of working once the PF woke up.
Currently, the PF has no way to communicate to the VF whether or not the
MAC address is random or assigned. The VF cannot check the
IGB_VF_FLAG_PF_SET_MAC flag because that only exists in the PF driver. To
propagate this flag down to the VF driver would require changes to the
PF/VF communication protocol.
In any case, I'm not sure that's the correct thing to do. From a policy
viewpoint, we don't want the VF to know what's happening in the PF. It
should not know how or why the MAC address was assigned, just like it
should not know whether or not the PF has placed it on a VLAN. VF devices
are not to be trusted and should not be given more information about the
state of the PF and host OS than is absolutely necessary to operate.
What's your use case here, Stefan? Why is this flag important to you?
As far as I can tell, nothing in the kernel ever looks at this flag.
-Mitch
^ permalink raw reply
* pull request: wireless 2013-01-09
From: John W. Linville @ 2013-01-09 19:18 UTC (permalink / raw)
To: davem; +Cc: linux-wireless, netdev, linux-kernel
Dave,
Please pull this batch of fixes (and a new driver) for the 3.8 stream...
Included is a mac80211 pull, of which Johannes says the following:
'This includes a number of fixes for various pieces of mac80211. I've
also included Thomas's memory RMC hash table optimisation since it
saves so much memory.'
Also from Johannes is an iwlwifi pull:
'I have two fixes for iwlwifi: one to fix a lost return value that was
dropped in a previous patch and could cause "nobody cared" IRQ messages,
and one to work around a firmware issue.'
Amitkumar Karwar brings an mwifiex for a typo in an comparison.
Bing Zhao gives us an mwifiex fix to properly check the return value
from wait_event_interruptible and handle it properly.
Chen Gang provides a fix to make iwlegacy use strlcpy instead of
strncpy, avoiding a potential buffer underflow.
Julian Wollrath fixes a typo in an error message in rtlwifi.
Larry Finger brings a b43 fix for a firmware loading problem.
Nickolai Zeldovich avoids a use-after-free in the mwl8k driver.
Vladimir Kondratiev brings the last big piece, the new Qualcomm/Atheros
wil6210 802.11ad driver. Since it is for new hardware, I hope that
taking it for 3.8 is not a problem.
Please let me know if there are problems!
Thanks,
John
---
The following changes since commit c9be4a5c49cf51cc70a993f004c5bb30067a65ce:
net: prevent setting ttl=0 via IP_TTL (2013-01-08 17:57:10 -0800)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless.git for-davem
for you to fetch changes up to a9b8a894ad7d0b90b0464c9ac7e8e5c1687edcae:
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless into for-davem (2013-01-09 11:01:37 -0500)
----------------------------------------------------------------
Amitkumar Karwar (1):
mwifiex: fix typo in setting up ibss network parameters
Bing Zhao (1):
mwifiex: check wait_event_interruptible return value
Chaitanya (1):
mac80211: fix maximum MTU
Chen Gang (1):
drivers/net/wireless/iwlegacy: use strlcpy instead of strncpy
Emmanuel Grumbach (1):
iwlwifi: fix the reclaimed packet tracking upon flush queue
Felix Fietkau (1):
mac80211: flush AP_VLAN stations when tearing down the BSS AP
Johannes Berg (5):
mac80211: assign VLAN channel contexts
mac80211: fix station destruction in AP/mesh modes
mac80211: use del_timer_sync for final sta cleanup timer deletion
mac80211: fix dtim_period in hidden SSID AP association
iwlwifi: fix PCIe interrupt handle return value
John W. Linville (3):
Merge branch 'for-john' of git://git.kernel.org/.../jberg/mac80211
Merge branch 'for-john' of git://git.kernel.org/.../iwlwifi/iwlwifi-fixes
Merge branch 'master' of git://git.kernel.org/.../linville/wireless into for-davem
Julian Wollrath (1):
rtlwifi: Fix typo in debug output of rtl8192c and rtl8723ae
Larry Finger (1):
b43: Fix firmware loading when driver is built into the kernel
Nickolai Zeldovich (1):
drivers/net/wireless/mwl8k.c: avoid use-after-free
Stanislaw Gruszka (1):
mac80211: fix ibss scanning
Thomas Pedersen (1):
mac80211: RMC buckets are just list heads
Vladimir Kondratiev (1):
wireless: add new wil6210 802.11ad 60GHz driver
MAINTAINERS | 8 +
drivers/net/wireless/ath/Kconfig | 1 +
drivers/net/wireless/ath/Makefile | 1 +
drivers/net/wireless/ath/wil6210/Kconfig | 29 +
drivers/net/wireless/ath/wil6210/Makefile | 13 +
drivers/net/wireless/ath/wil6210/cfg80211.c | 573 ++++++++++
drivers/net/wireless/ath/wil6210/dbg_hexdump.h | 30 +
drivers/net/wireless/ath/wil6210/debugfs.c | 603 +++++++++++
drivers/net/wireless/ath/wil6210/interrupt.c | 471 +++++++++
drivers/net/wireless/ath/wil6210/main.c | 407 +++++++
drivers/net/wireless/ath/wil6210/netdev.c | 157 +++
drivers/net/wireless/ath/wil6210/pcie_bus.c | 223 ++++
drivers/net/wireless/ath/wil6210/txrx.c | 871 +++++++++++++++
drivers/net/wireless/ath/wil6210/txrx.h | 362 +++++++
drivers/net/wireless/ath/wil6210/wil6210.h | 363 +++++++
drivers/net/wireless/ath/wil6210/wmi.c | 975 +++++++++++++++++
drivers/net/wireless/ath/wil6210/wmi.h | 1116 ++++++++++++++++++++
drivers/net/wireless/b43/b43.h | 5 +
drivers/net/wireless/b43/main.c | 54 +-
drivers/net/wireless/b43/main.h | 5 +-
drivers/net/wireless/iwlegacy/3945-mac.c | 2 +-
drivers/net/wireless/iwlwifi/dvm/tx.c | 24 +-
drivers/net/wireless/iwlwifi/pcie/rx.c | 1 +
drivers/net/wireless/mwifiex/cfg80211.c | 2 +-
drivers/net/wireless/mwifiex/sta_ioctl.c | 21 +-
drivers/net/wireless/mwl8k.c | 4 +-
drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c | 2 +-
drivers/net/wireless/rtlwifi/rtl8723ae/phy.c | 2 +-
net/mac80211/cfg.c | 2 +
net/mac80211/chan.c | 38 +
net/mac80211/ibss.c | 9 +-
net/mac80211/ieee80211_i.h | 16 +-
net/mac80211/iface.c | 48 +-
net/mac80211/mesh.c | 8 +-
net/mac80211/mesh.h | 2 +-
net/mac80211/mlme.c | 75 +-
net/mac80211/scan.c | 46 +-
net/mac80211/sta_info.c | 46 +-
net/mac80211/sta_info.h | 3 +-
39 files changed, 6488 insertions(+), 130 deletions(-)
create mode 100644 drivers/net/wireless/ath/wil6210/Kconfig
create mode 100644 drivers/net/wireless/ath/wil6210/Makefile
create mode 100644 drivers/net/wireless/ath/wil6210/cfg80211.c
create mode 100644 drivers/net/wireless/ath/wil6210/dbg_hexdump.h
create mode 100644 drivers/net/wireless/ath/wil6210/debugfs.c
create mode 100644 drivers/net/wireless/ath/wil6210/interrupt.c
create mode 100644 drivers/net/wireless/ath/wil6210/main.c
create mode 100644 drivers/net/wireless/ath/wil6210/netdev.c
create mode 100644 drivers/net/wireless/ath/wil6210/pcie_bus.c
create mode 100644 drivers/net/wireless/ath/wil6210/txrx.c
create mode 100644 drivers/net/wireless/ath/wil6210/txrx.h
create mode 100644 drivers/net/wireless/ath/wil6210/wil6210.h
create mode 100644 drivers/net/wireless/ath/wil6210/wmi.c
create mode 100644 drivers/net/wireless/ath/wil6210/wmi.h
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
^ permalink raw reply
* Re: [PATCH net 1/2] net: dev_queue_xmit_nit: fix skb->vlan_tci field value
From: Ani Sinha @ 2013-01-09 19:27 UTC (permalink / raw)
To: Eric Dumazet, tcpdump-workers; +Cc: netdev, dborkman, Jiri Pirko, edumazet
In-Reply-To: <CAOxq_8P=yOYGhhJ2_YJT3ya32k7UNjX6d6Qpz+oVfD4d56sJfQ@mail.gmail.com>
>> Thats irrelevant. This only shows that user land was depending on a
>> prior undocumented behavior.
Why do you say that? The following patch from Pirko ensured that on
both RX and TX regardless whether the driver/hw supported vlan
acceleration, the outermost vlan tags will always be extracted out of
the packet and put in skb aux data :
commit bcc6d47903612c3861201cc3a866fb604f26b8b2
Author: Jiri Pirko <jpirko@redhat.com>
Date: Thu Apr 7 19:48:33 2011 +0000
net: vlan: make non-hw-accel rx path similar to hw-accel
Now this meant that the filter code should always look into the aux
data for vlan tagging, not in the packet, regardless of hw
acceleration availability. Your patch
b40863c667c16b7a73d4f034a8eab67029b5b15a broke this symmetric
semantics - now on TX on the network tap, we do not have the vlan tags
in the skb aux data.
In my opinion, for a given kernel, the filter code should either look
into the packet offset or in the packet aux data for vlan tags but not
both. Otherwise the filter code becomes incredibly complex since an
inline vlan tag in the packet changes offsets of all headers coming
afterwords and I don't even know if filter code can be correctly
generated in this case. tcpdump-workers folks are CC's here and they
clearly have more experience with libpcap filter code that I do. Hence
I leave it up to them to provide inputs here.
>> What's wrong instructing libpcap to extend the filter to be able to
>> get the correct result, vlan id being in skb->vlan_id (vlan accel on),
>> or in the packet itself (vlan accel off)
>>
>> This way, you could chose if you want to get only accelerated vlan,
>> or non accelerated vlan, or both. And you need no kernel hacking.
This is wrong. Accelerated or not, the kernel code was organized to
have the tags in the packet aux data. So I think this is how user land
should be coded as well.
ani
_______________________________________________
tcpdump-workers mailing list
tcpdump-workers@lists.tcpdump.org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers
^ permalink raw reply
* [iputils][patch 01-07] setuid/capabilities fixups
From: Yuriy Kaminskiy @ 2013-01-09 19:41 UTC (permalink / raw)
To: netdev
[-- Attachment #1: Type: text/plain, Size: 243 bytes --]
Run ping, look at /proc/`pidof ping`/status -> oops (capabilities are not
[permanently] dropped, some of uids are not dropped, etc). Fix assorted issues
with setuid and capabilities drop. Limited testing only, please review/check
carefully.
[-- Attachment #2: 0001-arping-ping-ping6-traceroute2-clockdiff-drop-fsuid-a.patch --]
[-- Type: text/x-diff, Size: 2800 bytes --]
>From bc01c19df465bec369ded83bf48b069c6ad462d2 Mon Sep 17 00:00:00 2001
From: "Yuriy M. Kaminskiy" <yumkam@gmail.com>
Date: Wed, 2 Jan 2013 01:43:01 +0400
Subject: [PATCH 1/7] arping, ping, ping6, traceroute2, clockdiff: drop fsuid
at start
Prevent ignoring netfilter -m owner checks. With this patch ping
correctly blocked by iptables rules, e.g.:
$ sudo iptables -I OUTPUT -m owner --uid-owner $UID -j DROP
$ ping www.google.com
---
arping.c | 9 +++++++++
clockdiff.c | 8 ++++++++
ping_common.c | 9 +++++++++
traceroute6.c | 8 ++++++++
4 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/arping.c b/arping.c
index 35408c1..bdf81e9 100644
--- a/arping.c
+++ b/arping.c
@@ -27,6 +27,9 @@
#include <sys/prctl.h>
#include <sys/capability.h>
#endif
+#ifdef __linux__
+#include <sys/fsuid.h>
+#endif
#include <netdb.h>
#include <unistd.h>
@@ -229,6 +232,12 @@ int modify_capability_raw(int on)
perror("arping: setuid");
return -1;
}
+#ifdef __linux__
+ if (on) {
+ /* FIXME: error handling? setfsuid() have weird return code */
+ setfsuid(getuid());
+ }
+#endif
#endif
return 0;
}
diff --git a/clockdiff.c b/clockdiff.c
index 7c1ea1b..f12da2d 100644
--- a/clockdiff.c
+++ b/clockdiff.c
@@ -3,6 +3,9 @@
#include <sys/param.h>
#include <stdio.h>
#include <unistd.h>
+#ifdef __linux__
+#include <sys/fsuid.h>
+#endif
#include <stdlib.h>
#include <math.h>
#include <string.h>
@@ -561,6 +564,11 @@ main(int argc, char *argv[])
usage();
}
+#ifdef __linux__
+ // FIXME: error handling? setfsuid() have weird return code
+ setfsuid(getuid());
+#endif
+
sock_raw = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);
s_errno = errno;
diff --git a/ping_common.c b/ping_common.c
index 7f82851..12c87a4 100644
--- a/ping_common.c
+++ b/ping_common.c
@@ -2,6 +2,9 @@
#include <ctype.h>
#include <sched.h>
#include <math.h>
+#ifdef __linux__
+#include <sys/fsuid.h>
+#endif
int options;
@@ -175,6 +178,12 @@ int modify_capability(int on)
perror("seteuid");
return -1;
}
+#ifdef __linux__
+ if (on) {
+ /* FIXME: error handling? setfsuid() have weird return code */
+ setfsuid(uid);
+ }
+#endif
return 0;
}
diff --git a/traceroute6.c b/traceroute6.c
index 0538d4b..a14ddb6 100644
--- a/traceroute6.c
+++ b/traceroute6.c
@@ -266,6 +266,9 @@ char copyright[] =
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#ifdef __linux__
+#include <sys/fsuid.h>
+#endif
#include "SNAPSHOT.h"
@@ -343,6 +346,11 @@ int main(int argc, char *argv[])
int ch, i, on, probe, seq, tos, ttl;
int socket_errno;
+#ifdef __linux__
+ // FIXME: error handling? setfsuid() have weird return code
+ setfsuid(getuid());
+#endif
+
icmp_sock = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6);
socket_errno = errno;
--
1.7.6.3
[-- Attachment #3: 0002-ping-permanently-drop-capabilities-before-entering-m.patch --]
[-- Type: text/x-diff, Size: 554 bytes --]
>From da09261219322ec5116f016a858f11f83902deb9 Mon Sep 17 00:00:00 2001
From: "Yuriy M. Kaminskiy" <yumkam@gmail.com>
Date: Wed, 2 Jan 2013 01:44:49 +0400
Subject: [PATCH 2/7] ping: permanently drop capabilities before entering main
loop
---
ping.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/ping.c b/ping.c
index c0366cd..7ac1217 100644
--- a/ping.c
+++ b/ping.c
@@ -587,6 +587,8 @@ main(int argc, char **argv)
setup(icmp_sock);
+ drop_capabilities();
+
main_loop(icmp_sock, packet, packlen);
}
--
1.7.6.3
[-- Attachment #4: 0003-arping-use-seteuid-for-temporal-uid-changes.patch --]
[-- Type: text/x-diff, Size: 609 bytes --]
>From c4b6600fe72e169c64e47f85a973484053f23861 Mon Sep 17 00:00:00 2001
From: "Yuriy M. Kaminskiy" <yumkam@gmail.com>
Date: Wed, 2 Jan 2013 01:46:44 +0400
Subject: [PATCH 3/7] arping: use seteuid for temporal uid changes
---
arping.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arping.c b/arping.c
index bdf81e9..a35fafd 100644
--- a/arping.c
+++ b/arping.c
@@ -228,7 +228,7 @@ int modify_capability_raw(int on)
cap_free(cap_p);
#else
- if (setuid(on ? euid : getuid())) {
+ if (seteuid(on ? euid : getuid())) {
perror("arping: setuid");
return -1;
}
--
1.7.6.3
[-- Attachment #5: 0004-arping-ping_common-reset-euid-before-permanent-drop.patch --]
[-- Type: text/x-diff, Size: 1025 bytes --]
>From d8f54230f344c92f2120230dc24ac9c5d6672da9 Mon Sep 17 00:00:00 2001
From: "Yuriy M. Kaminskiy" <yumkam@gmail.com>
Date: Wed, 2 Jan 2013 01:53:39 +0400
Subject: [PATCH 4/7] arping, ping_common: reset euid before permanent drop
setuid drop saved uid only if euid is 0
---
arping.c | 4 ++++
ping_common.c | 4 ++++
2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/arping.c b/arping.c
index a35fafd..0033f33 100644
--- a/arping.c
+++ b/arping.c
@@ -269,6 +269,10 @@ void drop_capabilities(void)
cap_free(cap_p);
#else
+ if (seteuid(euid)) {
+ perror("arping: setuid");
+ return -1;
+ }
if (setuid(getuid()) < 0) {
perror("arping: setuid");
exit(-1);
diff --git a/ping_common.c b/ping_common.c
index 12c87a4..39b2c74 100644
--- a/ping_common.c
+++ b/ping_common.c
@@ -199,6 +199,10 @@ void drop_capabilities(void)
}
cap_free(cap);
#else
+ if (seteuid(euid)) {
+ perror("seteuid");
+ exit(-1);
+ }
if (setuid(getuid())) {
perror("ping: setuid");
exit(-1);
--
1.7.6.3
[-- Attachment #6: 0005-ping-ping6-arping-clockdiff-Fix-CAP_SETUID-setuid-in.patch --]
[-- Type: text/x-diff, Size: 2783 bytes --]
>From 00f63e1afc9d07e9793574304ef34a5bb54629b7 Mon Sep 17 00:00:00 2001
From: "Yuriy M. Kaminskiy" <yumkam@gmail.com>
Date: Wed, 2 Jan 2013 01:56:07 +0400
Subject: [PATCH 5/7] ping, ping6, arping, clockdiff: Fix CAP_SETUID <->
setuid() interaction
setuid() only drops saved uid if process have CAP_SETUID.
Drop capabilities only after setuid().
---
arping.c | 30 +++++++++++++++---------------
clockdiff.c | 8 +++++---
ping_common.c | 30 +++++++++++++++---------------
3 files changed, 35 insertions(+), 33 deletions(-)
diff --git a/arping.c b/arping.c
index 0033f33..3c02abf 100644
--- a/arping.c
+++ b/arping.c
@@ -161,6 +161,21 @@ void limit_capabilities(void)
#ifdef CAPABILITIES
cap_t cap_p;
+ if (prctl(PR_SET_KEEPCAPS, 1) < 0) {
+ perror("arping: prctl");
+ exit(-1);
+ }
+
+ if (setuid(getuid()) < 0) {
+ perror("arping: setuid");
+ exit(-1);
+ }
+
+ if (prctl(PR_SET_KEEPCAPS, 0) < 0) {
+ perror("arping: prctl");
+ exit(-1);
+ }
+
cap_p = cap_get_proc();
if (!cap_p) {
perror("arping: cap_get_proc");
@@ -184,21 +199,6 @@ void limit_capabilities(void)
}
}
- if (prctl(PR_SET_KEEPCAPS, 1) < 0) {
- perror("arping: prctl");
- exit(-1);
- }
-
- if (setuid(getuid()) < 0) {
- perror("arping: setuid");
- exit(-1);
- }
-
- if (prctl(PR_SET_KEEPCAPS, 0) < 0) {
- perror("arping: prctl");
- exit(-1);
- }
-
cap_free(cap_p);
#else
euid = geteuid();
diff --git a/clockdiff.c b/clockdiff.c
index f12da2d..540366d 100644
--- a/clockdiff.c
+++ b/clockdiff.c
@@ -536,6 +536,11 @@ usage() {
}
void drop_rights(void) {
+ if (setuid(getuid())) {
+ perror("clockdiff: setuid");
+ exit(-1);
+ }
+ {
#ifdef CAPABILITIES
cap_t caps = cap_init();
if (cap_set_proc(caps)) {
@@ -544,9 +549,6 @@ void drop_rights(void) {
}
cap_free(caps);
#endif
- if (setuid(getuid())) {
- perror("clockdiff: setuid");
- exit(-1);
}
}
diff --git a/ping_common.c b/ping_common.c
index 39b2c74..08c8582 100644
--- a/ping_common.c
+++ b/ping_common.c
@@ -80,6 +80,21 @@ void limit_capabilities(void)
cap_t cap_p;
cap_flag_value_t cap_ok;
+ if (prctl(PR_SET_KEEPCAPS, 1) < 0) {
+ perror("ping: prctl");
+ exit(-1);
+ }
+
+ if (setuid(getuid()) < 0) {
+ perror("setuid");
+ exit(-1);
+ }
+
+ if (prctl(PR_SET_KEEPCAPS, 0) < 0) {
+ perror("ping: prctl");
+ exit(-1);
+ }
+
cap_cur_p = cap_get_proc();
if (!cap_cur_p) {
perror("ping: cap_get_proc");
@@ -109,21 +124,6 @@ void limit_capabilities(void)
exit(-1);
}
- if (prctl(PR_SET_KEEPCAPS, 1) < 0) {
- perror("ping: prctl");
- exit(-1);
- }
-
- if (setuid(getuid()) < 0) {
- perror("setuid");
- exit(-1);
- }
-
- if (prctl(PR_SET_KEEPCAPS, 0) < 0) {
- perror("ping: prctl");
- exit(-1);
- }
-
cap_free(cap_p);
cap_free(cap_cur_p);
#endif
--
1.7.6.3
[-- Attachment #7: 0006-ninfod-use-u-without-capabilities-too.patch --]
[-- Type: text/x-diff, Size: 662 bytes --]
>From 32ad925cba9aca3513561c7655c9f61642a341ca Mon Sep 17 00:00:00 2001
From: "Yuriy M. Kaminskiy" <yumkam@gmail.com>
Date: Wed, 2 Jan 2013 02:57:15 +0400
Subject: [PATCH 6/7] ninfod: use -u without capabilities too
---
ninfod/ninfod.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/ninfod/ninfod.c b/ninfod/ninfod.c
index d1b99d9..0f54da3 100644
--- a/ninfod/ninfod.c
+++ b/ninfod/ninfod.c
@@ -561,7 +561,7 @@ static void drop_capabilities(void)
cap_free(cap_p);
#else
- if (setuid(getuid()) < 0) {
+ if (setuid(opt_u ? opt_u : getuid()) < 0) {
DEBUG(LOG_ERR, "setuid: %s\n", strerror(errno));
exit(-1);
}
--
1.7.6.3
[-- Attachment #8: 0007-ninfod-fix-capabilities-setting.patch --]
[-- Type: text/x-diff, Size: 3169 bytes --]
>From ab1b55fd572c1e28f762ef4feff911053c5eb1fd Mon Sep 17 00:00:00 2001
From: "Yuriy M. Kaminskiy" <yumkam@gmail.com>
Date: Wed, 2 Jan 2013 03:08:30 +0400
Subject: [PATCH 7/7] ninfod: fix capabilities setting
1) -u option failed to change real uid too (likely leaving it as root);
2) it failed to drop saved uid;
---
ninfod/ninfod.c | 58 +++++++++++++++++-------------------------------------
1 files changed, 18 insertions(+), 40 deletions(-)
diff --git a/ninfod/ninfod.c b/ninfod/ninfod.c
index 0f54da3..3e24c18 100644
--- a/ninfod/ninfod.c
+++ b/ninfod/ninfod.c
@@ -469,16 +469,28 @@ static void do_daemonize(void)
/* --------- */
#ifdef HAVE_LIBCAP
static const cap_value_t cap_net_raw = CAP_NET_RAW;
-static const cap_value_t cap_setuid = CAP_SETUID;
-static cap_flag_value_t cap_ok;
-#else
-static uid_t euid;
#endif
static void limit_capabilities(void)
{
#ifdef HAVE_LIBCAP
cap_t cap_p, cap_cur_p;
+ cap_flag_value_t cap_ok;
+
+ if (prctl(PR_SET_KEEPCAPS, 1) < 0) {
+ DEBUG(LOG_ERR, "prctl: %s\n", strerror(errno));
+ exit(-1);
+ }
+
+ if (setuid(opt_u ? opt_u : getuid()) < 0) {
+ DEBUG(LOG_ERR, "setuid: %s\n", strerror(errno));
+ exit(-1);
+ }
+
+ if (prctl(PR_SET_KEEPCAPS, 0) < 0) {
+ DEBUG(LOG_ERR, "prctl: %s\n", strerror(errno));
+ exit(-1);
+ }
cap_p = cap_init();
if (!cap_p) {
@@ -492,32 +504,20 @@ static void limit_capabilities(void)
exit(-1);
}
- /* net_raw + setuid / net_raw */
cap_get_flag(cap_cur_p, CAP_NET_RAW, CAP_PERMITTED, &cap_ok);
if (cap_ok != CAP_CLEAR) {
cap_set_flag(cap_p, CAP_PERMITTED, 1, &cap_net_raw, CAP_SET);
cap_set_flag(cap_p, CAP_EFFECTIVE, 1, &cap_net_raw, CAP_SET);
}
- cap_get_flag(cap_cur_p, CAP_SETUID, CAP_PERMITTED, &cap_ok);
- if (cap_ok != CAP_CLEAR)
- cap_set_flag(cap_p, CAP_PERMITTED, 1, &cap_setuid, CAP_SET);
-
if (cap_set_proc(cap_p) < 0) {
DEBUG(LOG_ERR, "cap_set_proc: %s\n", strerror(errno));
if (errno != EPERM)
exit(-1);
}
- if (prctl(PR_SET_KEEPCAPS, 1) < 0) {
- DEBUG(LOG_ERR, "prctl: %s\n", strerror(errno));
- exit(-1);
- }
-
cap_free(cap_cur_p);
cap_free(cap_p);
-#else
- euid = geteuid();
#endif
}
@@ -532,28 +532,6 @@ static void drop_capabilities(void)
exit(-1);
}
- /* setuid / setuid */
- if (cap_ok != CAP_CLEAR) {
- cap_set_flag(cap_p, CAP_PERMITTED, 1, &cap_setuid, CAP_SET);
- cap_set_flag(cap_p, CAP_EFFECTIVE, 1, &cap_setuid, CAP_SET);
-
- if (cap_set_proc(cap_p) < 0) {
- DEBUG(LOG_ERR, "cap_set_proc: %s\n", strerror(errno));
- exit(-1);
- }
- }
-
- if (seteuid(opt_u ? opt_u : getuid()) < 0) {
- DEBUG(LOG_ERR, "setuid: %s\n", strerror(errno));
- exit(-1);
- }
-
- if (prctl(PR_SET_KEEPCAPS, 0) < 0) {
- DEBUG(LOG_ERR, "prctl: %s\n", strerror(errno));
- exit(-1);
- }
-
- cap_clear(cap_p);
if (cap_set_proc(cap_p) < 0) {
DEBUG(LOG_ERR, "cap_set_proc: %s\n", strerror(errno));
exit(-1);
@@ -637,14 +615,14 @@ int main (int argc, char **argv)
appname = argv[0];
+ parse_args(argc, argv);
+
limit_capabilities();
sock = open_sock();
if (sock < 0)
sock_errno = errno;
- parse_args(argc, argv);
-
drop_capabilities();
if (opt_h || opt_v)
--
1.7.6.3
^ permalink raw reply related
* Re: [PATCH net 1/2] net: dev_queue_xmit_nit: fix skb->vlan_tci field value
From: Eric Dumazet @ 2013-01-09 19:51 UTC (permalink / raw)
To: Ani Sinha
Cc: tcpdump-workers, Paul Pearce, netdev, dborkman, edumazet,
Jiri Pirko
In-Reply-To: <CAOxq_8P4PLKXn9FOAWyq4zYH5+Yt7DT1mrU2OSQujGCOjBJZYg@mail.gmail.com>
On Wed, 2013-01-09 at 11:27 -0800, Ani Sinha wrote:
> This is wrong. Accelerated or not, the kernel code was organized to
> have the tags in the packet aux data. So I think this is how user land
> should be coded as well.
You have your opinion, thats good.
My opinion as a kernel developer is that the network tap is here to have
a copy of the exact frame given to the _device_.
Because in the end, users will complain to netdev, giving us tcpdump
traces. And if these traces have nothing to do with what is given to the
device, they are almost useless.
If you want other taps, and catch frames before/after various netfilter
hooks, segmentations, vlan accel, tunnels, or before GRO layer, thats a
totally different request.
A packet can be modified by a lot of layers in the kernel.
And yes, BPF filters can be incredibly complex, but it appears kernel is
not a piece of cake.
^ permalink raw reply
* Re: [E1000-devel] [PATCH net-next] igbvf: fix setting addr_assign_type if PF is up
From: Stefan Assmann @ 2013-01-09 19:53 UTC (permalink / raw)
To: Williams, Mitch A
Cc: netdev@vger.kernel.org, e1000-devel@lists.sourceforge.net
In-Reply-To: <AAEA33E297BCAC4B9BB20A7C2DF0AB8D1F8B539A@FMSMSX107.amr.corp.intel.com>
On 09.01.2013 19:56, Williams, Mitch A wrote:
>>>> When the PF is up and igbvf is loaded the MAC address is not
>>>> generated using eth_hw_addr_random(). This results in
>>>> addr_assign_type not to be set.
>>>> Make sure it gets set.
>>>>
>>>
>>> NAK - In this case, the address may or may not be random. The user may
>>> have (and should have!) explicitly set this address from the host to
>>> ensure that the VF device receives the same address each time it
>> boots.
>>
>> Maybe you can give me some advice on this then. Why is there different
>> behaviour depending on the PF being up or down? The problem I'm facing
>> is that if the user did not set a MAC address for the VF manually and
>> the PF is up during igbvf_probe it will not be labelled as random
>> although it is.
>> What about checking IGB_VF_FLAG_PF_SET_MAC and only set NET_ADDR_RANDOM
>> if the flag is cleared?
>>
>
> The difference in behavior is because we cannot get any MAC address at all
> if the PF is down. The interface won't operate at all in this case, but if
> the PF comes up sometime later, we can start working. The other alternative
> is to leave the MAC address as all zeros and forcing the user to assign
> an address manually. We chose to use a random address to at least give it
> a chance of working once the PF woke up.
>
> Currently, the PF has no way to communicate to the VF whether or not the
> MAC address is random or assigned. The VF cannot check the
> IGB_VF_FLAG_PF_SET_MAC flag because that only exists in the PF driver. To
> propagate this flag down to the VF driver would require changes to the
> PF/VF communication protocol.
>
> In any case, I'm not sure that's the correct thing to do. From a policy
> viewpoint, we don't want the VF to know what's happening in the PF. It
> should not know how or why the MAC address was assigned, just like it
> should not know whether or not the PF has placed it on a VLAN. VF devices
> are not to be trusted and should not be given more information about the
> state of the PF and host OS than is absolutely necessary to operate.
>
> What's your use case here, Stefan? Why is this flag important to you?
> As far as I can tell, nothing in the kernel ever looks at this flag.
It's about persistent device names.
You're right nothing in the kernel looks at the flag but udev uses it to
decide if the device should be identified by MAC address or PCI bus
topology.
If NET_ADDR_RANDOM is set udev will use the PCI bus information to
identify the device (instead of a changing MAC address, which would lead
to a new device name every reboot).
Stefan
^ permalink raw reply
* Re: [PATCH] 8139cp: Prevent dev_close/cp_interrupt race on MTU change
From: John Greene @ 2013-01-09 19:58 UTC (permalink / raw)
To: John Greene; +Cc: netdev, David S. Miller, David Woodhouse
In-Reply-To: <1355946468-3290-1-git-send-email-jogreene@redhat.com>
On 12/19/2012 02:47 PM, John Greene wrote:
> commit: cb64edb6b89491edfdbae52ba7db9a8b8391d339 upstream
>
> Above commit may introduce a race between cp_interrupt and dev_close
> / change MTU / dev_open up state. Changes cp_interrupt to tolerate
> this. Change spin_locking in cp_interrupt to avoid possible
> but unobserved race.
>
> Reported-by: "Francois Romieu" <romieu@fr.zoreil.com>
>
> Tested on virtual hardware, Tx MTU size up to 4096, max tx payload
> was ping -s 4068 for MTU of 4096. No real hardware, need test
> assist.
>
> Signed-off-by: "John Greene" <jogreene@redhat.com>
> CC: "David S. Miller" <davem@davemloft.net>
> CC: "David Woodhouse" <David.Woodhouse@intel.com>
> ---
> drivers/net/ethernet/realtek/8139cp.c | 18 +++++++++++-------
> 1 file changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c
> index 0da3f5e..585c35c 100644
> --- a/drivers/net/ethernet/realtek/8139cp.c
> +++ b/drivers/net/ethernet/realtek/8139cp.c
> @@ -577,28 +577,30 @@ static irqreturn_t cp_interrupt (int irq, void *dev_instance)
> {
> struct net_device *dev = dev_instance;
> struct cp_private *cp;
> + int handled = 0;
> u16 status;
>
> if (unlikely(dev == NULL))
> return IRQ_NONE;
> cp = netdev_priv(dev);
>
> + spin_lock(&cp->lock);
> +
> status = cpr16(IntrStatus);
> if (!status || (status == 0xFFFF))
> - return IRQ_NONE;
> + goto out_unlock;
> +
> + handled = 1;
>
> netif_dbg(cp, intr, dev, "intr, status %04x cmd %02x cpcmd %04x\n",
> status, cpr8(Cmd), cpr16(CpCmd));
>
> cpw16(IntrStatus, status & ~cp_rx_intr_mask);
>
> - spin_lock(&cp->lock);
> -
> /* close possible race's with dev_close */
> if (unlikely(!netif_running(dev))) {
> cpw16(IntrMask, 0);
> - spin_unlock(&cp->lock);
> - return IRQ_HANDLED;
> + goto out_unlock;
> }
>
> if (status & (RxOK | RxErr | RxEmpty | RxFIFOOvr))
> @@ -612,7 +614,6 @@ static irqreturn_t cp_interrupt (int irq, void *dev_instance)
> if (status & LinkChg)
> mii_check_media(&cp->mii_if, netif_msg_link(cp), false);
>
> - spin_unlock(&cp->lock);
>
> if (status & PciErr) {
> u16 pci_status;
> @@ -625,7 +626,10 @@ static irqreturn_t cp_interrupt (int irq, void *dev_instance)
> /* TODO: reset hardware */
> }
>
> - return IRQ_HANDLED;
> +out_unlock:
> + spin_unlock(&cp->lock);
> +
> + return IRQ_RETVAL(handled);
> }
>
> #ifdef CONFIG_NET_POLL_CONTROLLER
>
Can I get a quick update on this? Seems to have fallen thru the cracks.
Thanks.
--
John Greene
^ permalink raw reply
* Re: pull request: wireless 2013-01-09
From: John W. Linville @ 2013-01-09 19:53 UTC (permalink / raw)
To: davem; +Cc: linux-wireless, netdev, linux-kernel
In-Reply-To: <20130109191817.GA17321@tuxdriver.com>
[-- Attachment #1: Type: text/plain, Size: 7845 bytes --]
Ooops! Forgot to sign it...
On Wed, Jan 09, 2013 at 02:18:18PM -0500, John W. Linville wrote:
> Dave,
>
> Please pull this batch of fixes (and a new driver) for the 3.8 stream...
>
> Included is a mac80211 pull, of which Johannes says the following:
>
> 'This includes a number of fixes for various pieces of mac80211. I've
> also included Thomas's memory RMC hash table optimisation since it
> saves so much memory.'
>
> Also from Johannes is an iwlwifi pull:
>
> 'I have two fixes for iwlwifi: one to fix a lost return value that was
> dropped in a previous patch and could cause "nobody cared" IRQ messages,
> and one to work around a firmware issue.'
>
> Amitkumar Karwar brings an mwifiex for a typo in an comparison.
>
> Bing Zhao gives us an mwifiex fix to properly check the return value
> from wait_event_interruptible and handle it properly.
>
> Chen Gang provides a fix to make iwlegacy use strlcpy instead of
> strncpy, avoiding a potential buffer underflow.
>
> Julian Wollrath fixes a typo in an error message in rtlwifi.
>
> Larry Finger brings a b43 fix for a firmware loading problem.
>
> Nickolai Zeldovich avoids a use-after-free in the mwl8k driver.
>
> Vladimir Kondratiev brings the last big piece, the new Qualcomm/Atheros
> wil6210 802.11ad driver. Since it is for new hardware, I hope that
> taking it for 3.8 is not a problem.
>
> Please let me know if there are problems!
>
> Thanks,
>
> John
>
> ---
>
> The following changes since commit c9be4a5c49cf51cc70a993f004c5bb30067a65ce:
>
> net: prevent setting ttl=0 via IP_TTL (2013-01-08 17:57:10 -0800)
>
> are available in the git repository at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless.git for-davem
>
> for you to fetch changes up to a9b8a894ad7d0b90b0464c9ac7e8e5c1687edcae:
>
> Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless into for-davem (2013-01-09 11:01:37 -0500)
>
> ----------------------------------------------------------------
>
> Amitkumar Karwar (1):
> mwifiex: fix typo in setting up ibss network parameters
>
> Bing Zhao (1):
> mwifiex: check wait_event_interruptible return value
>
> Chaitanya (1):
> mac80211: fix maximum MTU
>
> Chen Gang (1):
> drivers/net/wireless/iwlegacy: use strlcpy instead of strncpy
>
> Emmanuel Grumbach (1):
> iwlwifi: fix the reclaimed packet tracking upon flush queue
>
> Felix Fietkau (1):
> mac80211: flush AP_VLAN stations when tearing down the BSS AP
>
> Johannes Berg (5):
> mac80211: assign VLAN channel contexts
> mac80211: fix station destruction in AP/mesh modes
> mac80211: use del_timer_sync for final sta cleanup timer deletion
> mac80211: fix dtim_period in hidden SSID AP association
> iwlwifi: fix PCIe interrupt handle return value
>
> John W. Linville (3):
> Merge branch 'for-john' of git://git.kernel.org/.../jberg/mac80211
> Merge branch 'for-john' of git://git.kernel.org/.../iwlwifi/iwlwifi-fixes
> Merge branch 'master' of git://git.kernel.org/.../linville/wireless into for-davem
>
> Julian Wollrath (1):
> rtlwifi: Fix typo in debug output of rtl8192c and rtl8723ae
>
> Larry Finger (1):
> b43: Fix firmware loading when driver is built into the kernel
>
> Nickolai Zeldovich (1):
> drivers/net/wireless/mwl8k.c: avoid use-after-free
>
> Stanislaw Gruszka (1):
> mac80211: fix ibss scanning
>
> Thomas Pedersen (1):
> mac80211: RMC buckets are just list heads
>
> Vladimir Kondratiev (1):
> wireless: add new wil6210 802.11ad 60GHz driver
>
> MAINTAINERS | 8 +
> drivers/net/wireless/ath/Kconfig | 1 +
> drivers/net/wireless/ath/Makefile | 1 +
> drivers/net/wireless/ath/wil6210/Kconfig | 29 +
> drivers/net/wireless/ath/wil6210/Makefile | 13 +
> drivers/net/wireless/ath/wil6210/cfg80211.c | 573 ++++++++++
> drivers/net/wireless/ath/wil6210/dbg_hexdump.h | 30 +
> drivers/net/wireless/ath/wil6210/debugfs.c | 603 +++++++++++
> drivers/net/wireless/ath/wil6210/interrupt.c | 471 +++++++++
> drivers/net/wireless/ath/wil6210/main.c | 407 +++++++
> drivers/net/wireless/ath/wil6210/netdev.c | 157 +++
> drivers/net/wireless/ath/wil6210/pcie_bus.c | 223 ++++
> drivers/net/wireless/ath/wil6210/txrx.c | 871 +++++++++++++++
> drivers/net/wireless/ath/wil6210/txrx.h | 362 +++++++
> drivers/net/wireless/ath/wil6210/wil6210.h | 363 +++++++
> drivers/net/wireless/ath/wil6210/wmi.c | 975 +++++++++++++++++
> drivers/net/wireless/ath/wil6210/wmi.h | 1116 ++++++++++++++++++++
> drivers/net/wireless/b43/b43.h | 5 +
> drivers/net/wireless/b43/main.c | 54 +-
> drivers/net/wireless/b43/main.h | 5 +-
> drivers/net/wireless/iwlegacy/3945-mac.c | 2 +-
> drivers/net/wireless/iwlwifi/dvm/tx.c | 24 +-
> drivers/net/wireless/iwlwifi/pcie/rx.c | 1 +
> drivers/net/wireless/mwifiex/cfg80211.c | 2 +-
> drivers/net/wireless/mwifiex/sta_ioctl.c | 21 +-
> drivers/net/wireless/mwl8k.c | 4 +-
> drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c | 2 +-
> drivers/net/wireless/rtlwifi/rtl8723ae/phy.c | 2 +-
> net/mac80211/cfg.c | 2 +
> net/mac80211/chan.c | 38 +
> net/mac80211/ibss.c | 9 +-
> net/mac80211/ieee80211_i.h | 16 +-
> net/mac80211/iface.c | 48 +-
> net/mac80211/mesh.c | 8 +-
> net/mac80211/mesh.h | 2 +-
> net/mac80211/mlme.c | 75 +-
> net/mac80211/scan.c | 46 +-
> net/mac80211/sta_info.c | 46 +-
> net/mac80211/sta_info.h | 3 +-
> 39 files changed, 6488 insertions(+), 130 deletions(-)
> create mode 100644 drivers/net/wireless/ath/wil6210/Kconfig
> create mode 100644 drivers/net/wireless/ath/wil6210/Makefile
> create mode 100644 drivers/net/wireless/ath/wil6210/cfg80211.c
> create mode 100644 drivers/net/wireless/ath/wil6210/dbg_hexdump.h
> create mode 100644 drivers/net/wireless/ath/wil6210/debugfs.c
> create mode 100644 drivers/net/wireless/ath/wil6210/interrupt.c
> create mode 100644 drivers/net/wireless/ath/wil6210/main.c
> create mode 100644 drivers/net/wireless/ath/wil6210/netdev.c
> create mode 100644 drivers/net/wireless/ath/wil6210/pcie_bus.c
> create mode 100644 drivers/net/wireless/ath/wil6210/txrx.c
> create mode 100644 drivers/net/wireless/ath/wil6210/txrx.h
> create mode 100644 drivers/net/wireless/ath/wil6210/wil6210.h
> create mode 100644 drivers/net/wireless/ath/wil6210/wmi.c
> create mode 100644 drivers/net/wireless/ath/wil6210/wmi.h
> --
> John W. Linville Someday the world will need a hero, and you
> linville@tuxdriver.com might be all we have. Be ready.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* Re: [PATCH net 1/2] net: dev_queue_xmit_nit: fix skb->vlan_tci field value
From: Ani Sinha @ 2013-01-09 20:01 UTC (permalink / raw)
To: Eric Dumazet
Cc: tcpdump-workers, Paul Pearce, netdev, dborkman, edumazet,
Jiri Pirko
In-Reply-To: <1357761063.27446.60.camel@edumazet-glaptop>
On Wed, Jan 9, 2013 at 11:51 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Wed, 2013-01-09 at 11:27 -0800, Ani Sinha wrote:
>
>> This is wrong. Accelerated or not, the kernel code was organized to
>> have the tags in the packet aux data. So I think this is how user land
>> should be coded as well.
>
> You have your opinion, thats good.
>
> My opinion as a kernel developer is that the network tap is here to have
> a copy of the exact frame given to the _device_.
>
It is fine by me if that is how you see it. In that case. the
behaviour can me made symmetric on both TX and RX. Tap processing in
__netif_receive_skb() can be done before vlan_untag() so that taps see
the exact frame received from the _device_ as you put it.
ani
^ permalink raw reply
* Re: [PATCH net 1/2] net: dev_queue_xmit_nit: fix skb->vlan_tci field value
From: Ani Sinha @ 2013-01-09 20:06 UTC (permalink / raw)
To: Eric Dumazet
Cc: tcpdump-workers, Paul Pearce, netdev, dborkman, edumazet,
Jiri Pirko
In-Reply-To: <CAOxq_8OsumXX92odrVcREqsLkeUkcS_0uQvbdaTmtyr1HtuTOw@mail.gmail.com>
On Wed, Jan 9, 2013 at 12:01 PM, Ani Sinha <ani@aristanetworks.com> wrote:
> On Wed, Jan 9, 2013 at 11:51 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>> On Wed, 2013-01-09 at 11:27 -0800, Ani Sinha wrote:
>>
>>> This is wrong. Accelerated or not, the kernel code was organized to
>>> have the tags in the packet aux data. So I think this is how user land
>>> should be coded as well.
>>
>> You have your opinion, thats good.
>>
>> My opinion as a kernel developer is that the network tap is here to have
>> a copy of the exact frame given to the _device_.
>>
>
> It is fine by me if that is how you see it. In that case. the
> behaviour can me made symmetric on both TX and RX. Tap processing in
> __netif_receive_skb() can be done before vlan_untag() so that taps see
> the exact frame received from the _device_ as you put it.
Although for accelerated vlan tags, it will be in the meta data
anyways. All I am asking is, let's have the same behaviour on both TX
and RX. If the tag in the packet let's have it that way in both ways
in what the tap sees.
^ permalink raw reply
* [patch 3.8-rc2] drivers/net/phy/micrel.c
From: Choi, David @ 2013-01-09 20:09 UTC (permalink / raw)
To: davem@davemloft.net; +Cc: netdev@vger.kernel.org, Choi, David, Doong, Ping
From: David J. Choi <david.choi@micrel.com>
Summary of changes:
This patch is primarily intended to cover more Ethernet phys from Micrel Inc. Additionally it
.supports ksz8081/91, ksz8061, ksz9051 device.
.changes KSxxx to KSZxxx for unified naming convention. For example, change KS8737 to KSZ8737.
.changes 9021 to 90x1 for commonly used names between 9021 and 9031 device, as this patch includes
KSZ9031 which belongs to same family as 9021.
2 files(include/linux/micrel_phy.h, drivers/net/phy/micrel.c) are changed.
Signed-off-by: David J. Choi <david.choi@micrel.com>
---
--- linux-3.8-rc2/include/linux/micrel_phy.h.orig 2013-01-03 12:37:30.176895530 -0800
+++ linux-3.8-rc2/include/linux/micrel_phy.h 2013-01-09 11:32:10.361384007 -0800
@@ -17,12 +17,17 @@
#define PHY_ID_KSZ8873MLL 0x000e7237
#define PHY_ID_KSZ9021 0x00221610
-#define PHY_ID_KS8737 0x00221720
+#define PHY_ID_KSZ8737 0x00221720
+/* same id: KS8021, KS8031 */
#define PHY_ID_KSZ8021 0x00221555
#define PHY_ID_KSZ8041 0x00221510
#define PHY_ID_KSZ8051 0x00221550
-/* both for ks8001 Rev. A/B, and for ks8721 Rev 3. */
+/* same id: ks8001 Rev. A/B, and ks8721 Rev 3. */
#define PHY_ID_KSZ8001 0x0022161A
+/* same id: KS8081, KS8091 */
+#define PHY_ID_KSZ8081 0x00221560
+#define PHY_ID_KSZ8061 0x00221570
+#define PHY_ID_KSZ9031 0x00221620
/* struct phy_device dev_flags definitions */
#define MICREL_PHY_50MHZ_CLK 0x00000001
--- linux-3.8-rc2/drivers/net/phy/micrel.c.orig 2013-01-03 10:12:26.961502521 -0800
+++ linux-3.8-rc2/drivers/net/phy/micrel.c 2013-01-09 11:24:03.119235092 -0800
@@ -12,8 +12,12 @@
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
- * Support : ksz9021 1000/100/10 phy from Micrel
- * ks8001, ks8737, ks8721, ks8041, ks8051 100/10 phy
+ * Support : Micrel Phys/switches:
+ * Giga phys: ksz9021, ksz9031
+ * 100/10 Phys: ksz8001, ksz8021, ksz8031, ksz8041, ksz8051,
+ * ksz8061, ksz8081, ksz8091,
+ * ksz8721, ksz8737,
+ * Switches: ksz8873
*/
#include <linux/kernel.h>
@@ -44,8 +48,8 @@
#define MII_KSZPHY_CTRL 0x1F
/* bitmap of PHY register to set interrupt mode */
#define KSZPHY_CTRL_INT_ACTIVE_HIGH (1 << 9)
-#define KSZ9021_CTRL_INT_ACTIVE_HIGH (1 << 14)
-#define KS8737_CTRL_INT_ACTIVE_HIGH (1 << 14)
+#define KSZ90X1_CTRL_INT_ACTIVE_HIGH (1 << 14)
+#define KSZ8737_CTRL_INT_ACTIVE_HIGH (1 << 14)
#define KSZ8051_RMII_50MHZ_CLK (1 << 7)
static int kszphy_ack_interrupt(struct phy_device *phydev)
@@ -78,25 +82,25 @@ static int kszphy_config_intr(struct phy
return rc < 0 ? rc : 0;
}
-static int ksz9021_config_intr(struct phy_device *phydev)
+static int ksz90x1_config_intr(struct phy_device *phydev)
{
int temp, rc;
/* set the interrupt pin active low */
temp = phy_read(phydev, MII_KSZPHY_CTRL);
- temp &= ~KSZ9021_CTRL_INT_ACTIVE_HIGH;
+ temp &= ~KSZ90X1_CTRL_INT_ACTIVE_HIGH;
phy_write(phydev, MII_KSZPHY_CTRL, temp);
rc = kszphy_set_interrupt(phydev);
return rc < 0 ? rc : 0;
}
-static int ks8737_config_intr(struct phy_device *phydev)
+static int ksz8737_config_intr(struct phy_device *phydev)
{
int temp, rc;
/* set the interrupt pin active low */
temp = phy_read(phydev, MII_KSZPHY_CTRL);
- temp &= ~KS8737_CTRL_INT_ACTIVE_HIGH;
+ temp &= ~KSZ8737_CTRL_INT_ACTIVE_HIGH;
phy_write(phydev, MII_KSZPHY_CTRL, temp);
rc = kszphy_set_interrupt(phydev);
return rc < 0 ? rc : 0;
@@ -162,21 +166,21 @@ static int ksz8873mll_config_aneg(struct
static struct phy_driver ksphy_driver[] = {
{
- .phy_id = PHY_ID_KS8737,
+ .phy_id = PHY_ID_KSZ8737,
.phy_id_mask = 0x00fffff0,
- .name = "Micrel KS8737",
+ .name = "Micrel KSZ8737",
.features = (PHY_BASIC_FEATURES | SUPPORTED_Pause),
.flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
.config_init = kszphy_config_init,
.config_aneg = genphy_config_aneg,
.read_status = genphy_read_status,
.ack_interrupt = kszphy_ack_interrupt,
- .config_intr = ks8737_config_intr,
+ .config_intr = ksz8737_config_intr,
.driver = { .owner = THIS_MODULE,},
}, {
.phy_id = PHY_ID_KSZ8021,
.phy_id_mask = 0x00ffffff,
- .name = "Micrel KSZ8021",
+ .name = "Micrel KSZ8021 or KSZ8031",
.features = (PHY_BASIC_FEATURES | SUPPORTED_Pause |
SUPPORTED_Asym_Pause),
.flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
@@ -214,7 +218,7 @@ static struct phy_driver ksphy_driver[]
.driver = { .owner = THIS_MODULE,},
}, {
.phy_id = PHY_ID_KSZ8001,
- .name = "Micrel KSZ8001 or KS8721",
+ .name = "Micrel KSZ8001 or KSZ8721",
.phy_id_mask = 0x00ffffff,
.features = (PHY_BASIC_FEATURES | SUPPORTED_Pause),
.flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
@@ -225,8 +229,32 @@ static struct phy_driver ksphy_driver[]
.config_intr = kszphy_config_intr,
.driver = { .owner = THIS_MODULE,},
}, {
+ .phy_id = PHY_ID_KSZ8081,
+ .name = "Micrel KSZ8081 or KSZ8091",
+ .phy_id_mask = 0x00fffff0,
+ .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause),
+ .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
+ .config_init = kszphy_config_init,
+ .config_aneg = genphy_config_aneg,
+ .read_status = genphy_read_status,
+ .ack_interrupt = kszphy_ack_interrupt,
+ .config_intr = kszphy_config_intr,
+ .driver = { .owner = THIS_MODULE,},
+}, {
+ .phy_id = PHY_ID_KSZ8061,
+ .name = "Micrel KSZ8061",
+ .phy_id_mask = 0x00fffff0,
+ .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause),
+ .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
+ .config_init = kszphy_config_init,
+ .config_aneg = genphy_config_aneg,
+ .read_status = genphy_read_status,
+ .ack_interrupt = kszphy_ack_interrupt,
+ .config_intr = kszphy_config_intr,
+ .driver = { .owner = THIS_MODULE,},
+}, {
.phy_id = PHY_ID_KSZ9021,
- .phy_id_mask = 0x000ffffe,
+ .phy_id_mask = 0x00fffffe,
.name = "Micrel KSZ9021 Gigabit PHY",
.features = (PHY_GBIT_FEATURES | SUPPORTED_Pause
| SUPPORTED_Asym_Pause),
@@ -235,7 +263,20 @@ static struct phy_driver ksphy_driver[]
.config_aneg = genphy_config_aneg,
.read_status = genphy_read_status,
.ack_interrupt = kszphy_ack_interrupt,
- .config_intr = ksz9021_config_intr,
+ .config_intr = ksz90x1_config_intr,
+ .driver = { .owner = THIS_MODULE, },
+}, {
+ .phy_id = PHY_ID_KSZ9031,
+ .phy_id_mask = 0x00fffff0,
+ .name = "Micrel KSZ9031 Gigabit PHY",
+ .features = (PHY_GBIT_FEATURES | SUPPORTED_Pause
+ | SUPPORTED_Asym_Pause),
+ .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
+ .config_init = kszphy_config_init,
+ .config_aneg = genphy_config_aneg,
+ .read_status = genphy_read_status,
+ .ack_interrupt = kszphy_ack_interrupt,
+ .config_intr = ksz90x1_config_intr,
.driver = { .owner = THIS_MODULE, },
}, {
.phy_id = PHY_ID_KSZ8873MLL,
@@ -269,12 +310,15 @@ MODULE_AUTHOR("David J. Choi");
MODULE_LICENSE("GPL");
static struct mdio_device_id __maybe_unused micrel_tbl[] = {
- { PHY_ID_KSZ9021, 0x000ffffe },
+ { PHY_ID_KSZ9021, 0x00fffffe },
+ { PHY_ID_KSZ9031, 0x00fffff0 },
{ PHY_ID_KSZ8001, 0x00ffffff },
- { PHY_ID_KS8737, 0x00fffff0 },
+ { PHY_ID_KSZ8737, 0x00fffff0 },
{ PHY_ID_KSZ8021, 0x00ffffff },
{ PHY_ID_KSZ8041, 0x00fffff0 },
{ PHY_ID_KSZ8051, 0x00fffff0 },
+ { PHY_ID_KSZ8061, 0x00fffff0 },
+ { PHY_ID_KSZ8081, 0x00fffff0 },
{ PHY_ID_KSZ8873MLL, 0x00fffff0 },
{ }
};
---
^ permalink raw reply
* [patch 3.8-rc2] drivers/net/ethernet/micrel/ks8851_mll
From: Choi, David @ 2013-01-09 20:17 UTC (permalink / raw)
To: davem@davemloft.net; +Cc: netdev@vger.kernel.org, Choi, David, Doong, Ping
From: David J. Choi <david.choi@micrel.com>
Summary of changes:
.add codes to collect statistical information(for example rx/tx packets/bytes, error packets)
about Ethernet packets.
Signed-off-by: David J. Choi <david.choi@micrel.com>
---
--- linux-3.8-rc2/drivers/net/ethernet/micrel/ks8851_mll.c.orig 2013-01-03 09:45:57.830447923 -0800
+++ linux-3.8-rc2/drivers/net/ethernet/micrel/ks8851_mll.c 2013-01-03 10:05:57.675756568 -0800
@@ -801,7 +801,14 @@ static void ks_rcv(struct ks_net *ks, st
skb_put(skb, frame_hdr->len);
skb->protocol = eth_type_trans(skb, netdev);
netif_rx(skb);
+ netdev->stats.rx_packets++;
+ netdev->stats.rx_bytes += (frame_hdr->len - 4);
} else {
+ netdev->stats.rx_dropped++;
+ if ((frame_hdr->len >= RX_BUF_SIZE) || (frame_hdr->len == 0))
+ netdev->stats.rx_length_errors++;
+ if (frame_hdr->sts & RXFSHR_RXFV)
+ netdev->stats.rx_frame_errors++;
pr_err("%s: err:skb alloc\n", __func__);
ks_wrreg16(ks, KS_RXQCR, (ks->rc_rxqcr | RXQCR_RRXEF));
if (skb)
@@ -876,6 +883,8 @@ static irqreturn_t ks_irq(int irq, void
pmecr &= ~PMECR_WKEVT_MASK;
ks_wrreg16(ks, KS_PMECR, pmecr | PMECR_WKEVT_LINK);
}
+ if (unlikely(status & IRQ_RXOI))
+ ks->netdev->stats.rx_over_errors++;
/* this should be the last in IRQ handler*/
ks_restore_cmd_reg(ks);
@@ -1015,6 +1024,8 @@ static int ks_start_xmit(struct sk_buff
if (likely(ks_tx_fifo_space(ks) >= skb->len + 12)) {
ks_write_qmu(ks, skb->data, skb->len);
+ netdev->stats.tx_bytes += skb->len;
+ netdev->stats.tx_packets++;
dev_kfree_skb(skb);
} else
retv = NETDEV_TX_BUSY;
---
^ permalink raw reply
* [ 57/80] batman-adv: fix random jitter calculation
From: Greg Kroah-Hartman @ 2013-01-09 20:35 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Greg Kroah-Hartman, alan, Akinobu Mita, Antonio Quartulli,
Marek Lindner, Simon Wunderlich, David S. Miller, b.a.t.m.a.n,
netdev
In-Reply-To: <20130109201500.410171651@linuxfoundation.org>
3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Akinobu Mita <akinobu.mita@gmail.com>
[ Upstream commit 143cdd8f33909ff5a153e3f02048738c5964ba26 ]
batadv_iv_ogm_emit_send_time() attempts to calculates a random integer
in the range of 'orig_interval +- BATADV_JITTER' by the below lines.
msecs = atomic_read(&bat_priv->orig_interval) - BATADV_JITTER;
msecs += (random32() % 2 * BATADV_JITTER);
But it actually gets 'orig_interval' or 'orig_interval - BATADV_JITTER'
because '%' and '*' have same precedence and associativity is
left-to-right.
This adds the parentheses at the appropriate position so that it matches
original intension.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Antonio Quartulli <ordex@autistici.org>
Cc: Marek Lindner <lindner_marek@yahoo.de>
Cc: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Cc: Antonio Quartulli <ordex@autistici.org>
Cc: b.a.t.m.a.n@lists.open-mesh.org
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/batman-adv/bat_iv_ogm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -72,7 +72,7 @@ static unsigned long bat_iv_ogm_emit_sen
{
return jiffies + msecs_to_jiffies(
atomic_read(&bat_priv->orig_interval) -
- JITTER + (random32() % 2*JITTER));
+ JITTER + (random32() % (2*JITTER)));
}
/* when do we schedule a ogm packet to be sent */
^ permalink raw reply
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