* [RFC] [patch 5/6] [Network namespace] ipv4 isolation
From: dlezcano @ 2006-06-09 21:02 UTC (permalink / raw)
To: linux-kernel, netdev; +Cc: serue, haveblue, clg, dlezcano
In-Reply-To: <20060609210202.215291000@localhost.localdomain>
[-- Attachment #1: inet_isolation.patch --]
[-- Type: text/plain, Size: 15639 bytes --]
This patch partially isolates ipv4 by adding the network namespace
structure in the structure sock, bind bucket and skbuf. When a socket
is created, the pointer to the network namespace is stored in the
struct sock and the socket belongs to the namespace by this way. That
allows to identify sockets related to a namespace for lookup and
procfs.
The lookup is extended with a network namespace pointer, in
order to identify listen points binded to the same port. That allows
to have several applications binded to INADDR_ANY:port in different
network namespace without conflicting. The bind is checked against
port and network namespace.
When an outgoing packet has the loopback destination addres, the
skbuff is filled with the network namespace. So the loopback packets
never go outside the namespace. This approach facilitate the migration
of loopback because identification is done by network namespace and
not by address. The loopback has been benchmarked by tbench and the
overhead is roughly 1.5 %
Replace-Subject: [Network namespace] ipv4 isolation
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
--
include/linux/skbuff.h | 2 ++
include/net/inet_hashtables.h | 34 ++++++++++++++++++++++++----------
include/net/inet_timewait_sock.h | 1 +
include/net/sock.h | 4 ++++
net/dccp/ipv4.c | 7 ++++---
net/ipv4/af_inet.c | 2 ++
net/ipv4/inet_connection_sock.c | 3 ++-
net/ipv4/inet_diag.c | 3 ++-
net/ipv4/inet_hashtables.c | 6 +++++-
net/ipv4/inet_timewait_sock.c | 1 +
net/ipv4/ip_output.c | 4 ++++
net/ipv4/tcp_ipv4.c | 25 ++++++++++++++++---------
net/ipv4/udp.c | 7 +++++--
13 files changed, 72 insertions(+), 27 deletions(-)
Index: 2.6-mm/include/linux/skbuff.h
===================================================================
--- 2.6-mm.orig/include/linux/skbuff.h
+++ 2.6-mm/include/linux/skbuff.h
@@ -27,6 +27,7 @@
#include <linux/poll.h>
#include <linux/net.h>
#include <linux/textsearch.h>
+#include <linux/net_ns.h>
#include <net/checksum.h>
#include <linux/dmaengine.h>
@@ -301,6 +302,7 @@
*data,
*tail,
*end;
+ struct net_namespace *net_ns;
};
#ifdef __KERNEL__
Index: 2.6-mm/include/net/inet_hashtables.h
===================================================================
--- 2.6-mm.orig/include/net/inet_hashtables.h
+++ 2.6-mm/include/net/inet_hashtables.h
@@ -23,6 +23,8 @@
#include <linux/spinlock.h>
#include <linux/types.h>
#include <linux/wait.h>
+#include <linux/in.h>
+#include <linux/net_ns.h>
#include <net/inet_connection_sock.h>
#include <net/inet_sock.h>
@@ -78,6 +80,7 @@
signed short fastreuse;
struct hlist_node node;
struct hlist_head owners;
+ struct net_namespace *net_ns;
};
#define inet_bind_bucket_for_each(tb, node, head) \
@@ -274,13 +277,15 @@
extern struct sock *__inet_lookup_listener(const struct hlist_head *head,
const u32 daddr,
const unsigned short hnum,
- const int dif);
+ const int dif,
+ const struct net_namespace *net_ns);
/* Optimize the common listener case. */
static inline struct sock *
inet_lookup_listener(struct inet_hashinfo *hashinfo,
const u32 daddr,
- const unsigned short hnum, const int dif)
+ const unsigned short hnum, const int dif,
+ const struct net_namespace *net_ns)
{
struct sock *sk = NULL;
const struct hlist_head *head;
@@ -294,8 +299,9 @@
(!inet->rcv_saddr || inet->rcv_saddr == daddr) &&
(sk->sk_family == PF_INET || !ipv6_only_sock(sk)) &&
!sk->sk_bound_dev_if)
- goto sherry_cache;
- sk = __inet_lookup_listener(head, daddr, hnum, dif);
+ if (sk->sk_net_ns == net_ns && LOOPBACK(daddr))
+ goto sherry_cache;
+ sk = __inet_lookup_listener(head, daddr, hnum, dif, net_ns);
}
if (sk) {
sherry_cache:
@@ -358,7 +364,8 @@
__inet_lookup_established(struct inet_hashinfo *hashinfo,
const u32 saddr, const u16 sport,
const u32 daddr, const u16 hnum,
- const int dif)
+ const int dif,
+ const struct net_namespace *net_ns)
{
INET_ADDR_COOKIE(acookie, saddr, daddr)
const __u32 ports = INET_COMBINED_PORTS(sport, hnum);
@@ -373,12 +380,16 @@
prefetch(head->chain.first);
read_lock(&head->lock);
sk_for_each(sk, node, &head->chain) {
+ if (sk->sk_net_ns != net_ns && LOOPBACK(daddr))
+ continue;
if (INET_MATCH(sk, hash, acookie, saddr, daddr, ports, dif))
goto hit; /* You sunk my battleship! */
}
/* Must check for a TIME_WAIT'er before going to listener hash. */
sk_for_each(sk, node, &(head + hashinfo->ehash_size)->chain) {
+ if (sk->sk_net_ns != net_ns && LOOPBACK(daddr))
+ continue;
if (INET_TW_MATCH(sk, hash, acookie, saddr, daddr, ports, dif))
goto hit;
}
@@ -394,22 +405,25 @@
static inline struct sock *__inet_lookup(struct inet_hashinfo *hashinfo,
const u32 saddr, const u16 sport,
const u32 daddr, const u16 hnum,
- const int dif)
+ const int dif,
+ const struct net_namespace *net_ns)
{
struct sock *sk = __inet_lookup_established(hashinfo, saddr, sport, daddr,
- hnum, dif);
- return sk ? : inet_lookup_listener(hashinfo, daddr, hnum, dif);
+ hnum, dif, net_ns);
+ return sk ? : inet_lookup_listener(hashinfo, daddr, hnum, dif, net_ns);
}
static inline struct sock *inet_lookup(struct inet_hashinfo *hashinfo,
const u32 saddr, const u16 sport,
const u32 daddr, const u16 dport,
- const int dif)
+ const int dif,
+ const struct net_namespace *net_ns)
{
struct sock *sk;
local_bh_disable();
- sk = __inet_lookup(hashinfo, saddr, sport, daddr, ntohs(dport), dif);
+ sk = __inet_lookup(hashinfo, saddr, sport, daddr, ntohs(dport),
+ dif, net_ns);
local_bh_enable();
return sk;
Index: 2.6-mm/include/net/inet_timewait_sock.h
===================================================================
--- 2.6-mm.orig/include/net/inet_timewait_sock.h
+++ 2.6-mm/include/net/inet_timewait_sock.h
@@ -115,6 +115,7 @@
#define tw_refcnt __tw_common.skc_refcnt
#define tw_hash __tw_common.skc_hash
#define tw_prot __tw_common.skc_prot
+#define tw_net_ns __tw_common.skc_net_ns
volatile unsigned char tw_substate;
/* 3 bits hole, try to pack */
unsigned char tw_rcv_wscale;
Index: 2.6-mm/include/net/sock.h
===================================================================
--- 2.6-mm.orig/include/net/sock.h
+++ 2.6-mm/include/net/sock.h
@@ -47,6 +47,7 @@
#include <linux/netdevice.h>
#include <linux/skbuff.h> /* struct sk_buff */
#include <linux/security.h>
+#include <linux/net_ns.h>
#include <linux/filter.h>
@@ -94,6 +95,7 @@
* @skc_refcnt: reference count
* @skc_hash: hash value used with various protocol lookup tables
* @skc_prot: protocol handlers inside a network family
+ * @skc_net_ns: network namespace owning the socket
*
* This is the minimal network layer representation of sockets, the header
* for struct sock and struct inet_timewait_sock.
@@ -108,6 +110,7 @@
atomic_t skc_refcnt;
unsigned int skc_hash;
struct proto *skc_prot;
+ struct net_namespace *skc_net_ns;
};
/**
@@ -183,6 +186,7 @@
#define sk_refcnt __sk_common.skc_refcnt
#define sk_hash __sk_common.skc_hash
#define sk_prot __sk_common.skc_prot
+#define sk_net_ns __sk_common.skc_net_ns
unsigned char sk_shutdown : 2,
sk_no_check : 2,
sk_userlocks : 4;
Index: 2.6-mm/net/dccp/ipv4.c
===================================================================
--- 2.6-mm.orig/net/dccp/ipv4.c
+++ 2.6-mm/net/dccp/ipv4.c
@@ -308,7 +308,8 @@
}
sk = inet_lookup(&dccp_hashinfo, iph->daddr, dh->dccph_dport,
- iph->saddr, dh->dccph_sport, inet_iif(skb));
+ iph->saddr, dh->dccph_sport, inet_iif(skb),
+ skb->net_ns);
if (sk == NULL) {
ICMP_INC_STATS_BH(ICMP_MIB_INERRORS);
return;
@@ -610,7 +611,7 @@
nsk = __inet_lookup_established(&dccp_hashinfo,
iph->saddr, dh->dccph_sport,
iph->daddr, ntohs(dh->dccph_dport),
- inet_iif(skb));
+ inet_iif(skb), skb->net_ns);
if (nsk != NULL) {
if (nsk->sk_state != DCCP_TIME_WAIT) {
bh_lock_sock(nsk);
@@ -924,7 +925,7 @@
sk = __inet_lookup(&dccp_hashinfo,
skb->nh.iph->saddr, dh->dccph_sport,
skb->nh.iph->daddr, ntohs(dh->dccph_dport),
- inet_iif(skb));
+ inet_iif(skb), skb->net_ns);
/*
* Step 2:
Index: 2.6-mm/net/ipv4/af_inet.c
===================================================================
--- 2.6-mm.orig/net/ipv4/af_inet.c
+++ 2.6-mm/net/ipv4/af_inet.c
@@ -325,6 +325,7 @@
sk->sk_family = PF_INET;
sk->sk_protocol = protocol;
sk->sk_backlog_rcv = sk->sk_prot->backlog_rcv;
+ sk->sk_net_ns = net_ns();
inet->uc_ttl = -1;
inet->mc_loop = 1;
@@ -616,6 +617,7 @@
sock_graft(sk2, newsock);
+ sk2->sk_net_ns = net_ns();
newsock->state = SS_CONNECTED;
err = 0;
release_sock(sk2);
Index: 2.6-mm/net/ipv4/inet_connection_sock.c
===================================================================
--- 2.6-mm.orig/net/ipv4/inet_connection_sock.c
+++ 2.6-mm/net/ipv4/inet_connection_sock.c
@@ -116,7 +116,7 @@
head = &hashinfo->bhash[inet_bhashfn(snum, hashinfo->bhash_size)];
spin_lock(&head->lock);
inet_bind_bucket_for_each(tb, node, &head->chain)
- if (tb->port == snum)
+ if (tb->port == snum && tb->net_ns == net_ns())
goto tb_found;
}
tb = NULL;
@@ -146,6 +146,7 @@
} else if (tb->fastreuse &&
(!sk->sk_reuse || sk->sk_state == TCP_LISTEN))
tb->fastreuse = 0;
+ tb->net_ns = net_ns();
success:
if (!inet_csk(sk)->icsk_bind_hash)
inet_bind_hash(sk, tb, snum);
Index: 2.6-mm/net/ipv4/inet_diag.c
===================================================================
--- 2.6-mm.orig/net/ipv4/inet_diag.c
+++ 2.6-mm/net/ipv4/inet_diag.c
@@ -241,7 +241,8 @@
if (req->idiag_family == AF_INET) {
sk = inet_lookup(hashinfo, req->id.idiag_dst[0],
req->id.idiag_dport, req->id.idiag_src[0],
- req->id.idiag_sport, req->id.idiag_if);
+ req->id.idiag_sport, req->id.idiag_if,
+ in_skb->net_ns);
}
#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
else if (req->idiag_family == AF_INET6) {
Index: 2.6-mm/net/ipv4/inet_hashtables.c
===================================================================
--- 2.6-mm.orig/net/ipv4/inet_hashtables.c
+++ 2.6-mm/net/ipv4/inet_hashtables.c
@@ -126,7 +126,8 @@
* wildcarded during the search since they can never be otherwise.
*/
struct sock *__inet_lookup_listener(const struct hlist_head *head, const u32 daddr,
- const unsigned short hnum, const int dif)
+ const unsigned short hnum, const int dif,
+ const struct net_namespace *net_ns)
{
struct sock *result = NULL, *sk;
const struct hlist_node *node;
@@ -139,6 +140,9 @@
const __u32 rcv_saddr = inet->rcv_saddr;
int score = sk->sk_family == PF_INET ? 1 : 0;
+ if (sk->sk_net_ns != net_ns && LOOPBACK(daddr))
+ continue;
+
if (rcv_saddr) {
if (rcv_saddr != daddr)
continue;
Index: 2.6-mm/net/ipv4/inet_timewait_sock.c
===================================================================
--- 2.6-mm.orig/net/ipv4/inet_timewait_sock.c
+++ 2.6-mm/net/ipv4/inet_timewait_sock.c
@@ -110,6 +110,7 @@
tw->tw_hash = sk->sk_hash;
tw->tw_ipv6only = 0;
tw->tw_prot = sk->sk_prot_creator;
+ tw->tw_net_ns = sk->sk_net_ns;
atomic_set(&tw->tw_refcnt, 1);
inet_twsk_dead_node_init(tw);
__module_get(tw->tw_prot->owner);
Index: 2.6-mm/net/ipv4/ip_output.c
===================================================================
--- 2.6-mm.orig/net/ipv4/ip_output.c
+++ 2.6-mm/net/ipv4/ip_output.c
@@ -284,6 +284,10 @@
skb->dev = dev;
skb->protocol = htons(ETH_P_IP);
+ if ((skb->nh.iph->protocol == IPPROTO_TCP ||
+ skb->nh.iph->protocol == IPPROTO_UDP) &&
+ LOOPBACK(skb->nh.iph->daddr))
+ skb->net_ns = skb->sk->sk_net_ns;
return NF_HOOK_COND(PF_INET, NF_IP_POST_ROUTING, skb, NULL, dev,
ip_finish_output,
Index: 2.6-mm/net/ipv4/tcp_ipv4.c
===================================================================
--- 2.6-mm.orig/net/ipv4/tcp_ipv4.c
+++ 2.6-mm/net/ipv4/tcp_ipv4.c
@@ -349,7 +349,7 @@
}
sk = inet_lookup(&tcp_hashinfo, iph->daddr, th->dest, iph->saddr,
- th->source, inet_iif(skb));
+ th->source, inet_iif(skb), skb->net_ns);
if (!sk) {
ICMP_INC_STATS_BH(ICMP_MIB_INERRORS);
return;
@@ -933,7 +933,8 @@
nsk = __inet_lookup_established(&tcp_hashinfo, skb->nh.iph->saddr,
th->source, skb->nh.iph->daddr,
- ntohs(th->dest), inet_iif(skb));
+ ntohs(th->dest), inet_iif(skb),
+ skb->net_ns);
if (nsk) {
if (nsk->sk_state != TCP_TIME_WAIT) {
@@ -1071,7 +1072,7 @@
sk = __inet_lookup(&tcp_hashinfo, skb->nh.iph->saddr, th->source,
skb->nh.iph->daddr, ntohs(th->dest),
- inet_iif(skb));
+ inet_iif(skb), skb->net_ns);
if (!sk)
goto no_tcp_socket;
@@ -1149,7 +1150,8 @@
struct sock *sk2 = inet_lookup_listener(&tcp_hashinfo,
skb->nh.iph->daddr,
ntohs(th->dest),
- inet_iif(skb));
+ inet_iif(skb),
+ skb->net_ns);
if (sk2) {
inet_twsk_deschedule((struct inet_timewait_sock *)sk,
&tcp_death_row);
@@ -1395,7 +1397,8 @@
}
get_sk:
sk_for_each_from(sk, node) {
- if (sk->sk_family == st->family) {
+ if (sk->sk_family == st->family &&
+ sk->sk_net_ns == net_ns()) {
cur = sk;
goto out;
}
@@ -1446,7 +1449,8 @@
read_lock(&tcp_hashinfo.ehash[st->bucket].lock);
sk_for_each(sk, node, &tcp_hashinfo.ehash[st->bucket].chain) {
- if (sk->sk_family != st->family) {
+ if (sk->sk_family != st->family ||
+ sk->sk_net_ns != net_ns()) {
continue;
}
rc = sk;
@@ -1455,7 +1459,8 @@
st->state = TCP_SEQ_STATE_TIME_WAIT;
inet_twsk_for_each(tw, node,
&tcp_hashinfo.ehash[st->bucket + tcp_hashinfo.ehash_size].chain) {
- if (tw->tw_family != st->family) {
+ if (tw->tw_family != st->family ||
+ tw->tw_net_ns != net_ns()) {
continue;
}
rc = tw;
@@ -1481,7 +1486,8 @@
tw = cur;
tw = tw_next(tw);
get_tw:
- while (tw && tw->tw_family != st->family) {
+ while (tw && (tw->tw_family != st->family ||
+ tw->tw_net_ns != net_ns())) {
tw = tw_next(tw);
}
if (tw) {
@@ -1505,7 +1511,8 @@
sk = sk_next(sk);
sk_for_each_from(sk, node) {
- if (sk->sk_family == st->family)
+ if (sk->sk_family == st->family &&
+ sk->sk_net_ns == net_ns())
goto found;
}
Index: 2.6-mm/net/ipv4/udp.c
===================================================================
--- 2.6-mm.orig/net/ipv4/udp.c
+++ 2.6-mm/net/ipv4/udp.c
@@ -184,6 +184,7 @@
(!inet2->rcv_saddr ||
!inet->rcv_saddr ||
inet2->rcv_saddr == inet->rcv_saddr) &&
+ sk2->sk_net_ns == sk->sk_net_ns &&
(!sk2->sk_reuse || !sk->sk_reuse))
goto fail;
}
@@ -1404,7 +1405,8 @@
for (state->bucket = 0; state->bucket < UDP_HTABLE_SIZE; ++state->bucket) {
struct hlist_node *node;
sk_for_each(sk, node, &udp_hash[state->bucket]) {
- if (sk->sk_family == state->family)
+ if (sk->sk_family == state->family &&
+ sk->sk_net_ns == net_ns())
goto found;
}
}
@@ -1421,7 +1423,8 @@
sk = sk_next(sk);
try_again:
;
- } while (sk && sk->sk_family != state->family);
+ } while (sk && (sk->sk_family != state->family ||
+ sk->sk_net_ns != net_ns()));
if (!sk && ++state->bucket < UDP_HTABLE_SIZE) {
sk = sk_head(&udp_hash[state->bucket]);
--
^ permalink raw reply
* [RFC] [patch 4/6] [Network namespace] Network inet devices isolation
From: dlezcano @ 2006-06-09 21:02 UTC (permalink / raw)
To: linux-kernel, netdev; +Cc: serue, haveblue, clg, dlezcano
In-Reply-To: <20060609210202.215291000@localhost.localdomain>
[-- Attachment #1: inetdev_isolation.patch --]
[-- Type: text/plain, Size: 4457 bytes --]
The network isolation relies on the fact that an application can not
use IP addresses not belonging to the container in which it's
running. This patch isolates the inet device level by adding a
structure namespace pointer in the structure in_ifaddr. When an ip
address is set inside a network namespace, the structure in_ifaddr is
filled with the current namespace pointer. There is a special case
with loopback address which belongs to all the namespaces and its
particularity is to have the network namespace pointer set to NULL.
This patch isolates the ifconfig, ip addr commands, so when an IP
address is set, this one it is not visible by another network
namespaces.
Replace-Subject: [Network namespace] Network inet devices isolation
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
--
include/linux/inetdevice.h | 1 +
net/ipv4/devinet.c | 28 +++++++++++++++++++++++++++-
2 files changed, 28 insertions(+), 1 deletion(-)
Index: 2.6-mm/include/linux/inetdevice.h
===================================================================
--- 2.6-mm.orig/include/linux/inetdevice.h
+++ 2.6-mm/include/linux/inetdevice.h
@@ -99,6 +99,7 @@
unsigned char ifa_flags;
unsigned char ifa_prefixlen;
char ifa_label[IFNAMSIZ];
+ struct net_namespace *ifa_net_ns;
};
extern int register_inetaddr_notifier(struct notifier_block *nb);
Index: 2.6-mm/net/ipv4/devinet.c
===================================================================
--- 2.6-mm.orig/net/ipv4/devinet.c
+++ 2.6-mm/net/ipv4/devinet.c
@@ -54,6 +54,7 @@
#include <linux/notifier.h>
#include <linux/inetdevice.h>
#include <linux/igmp.h>
+#include <linux/net_ns.h>
#ifdef CONFIG_SYSCTL
#include <linux/sysctl.h>
#endif
@@ -257,6 +258,7 @@
if (!(ifa->ifa_flags & IFA_F_SECONDARY) ||
ifa1->ifa_mask != ifa->ifa_mask ||
+ ifa->ifa_net_ns != net_ns() ||
!inet_ifa_match(ifa1->ifa_address, ifa)) {
ifap1 = &ifa->ifa_next;
prev_prom = ifa;
@@ -317,6 +319,8 @@
if (destroy) {
inet_free_ifa(ifa1);
+ put_net_ns(ifa1->ifa_net_ns);
+
if (!in_dev->ifa_list)
inetdev_destroy(in_dev);
}
@@ -343,6 +347,7 @@
ifa->ifa_scope <= ifa1->ifa_scope)
last_primary = &ifa1->ifa_next;
if (ifa1->ifa_mask == ifa->ifa_mask &&
+ ifa1->ifa_net_ns == ifa->ifa_net_ns &&
inet_ifa_match(ifa1->ifa_address, ifa)) {
if (ifa1->ifa_local == ifa->ifa_local) {
inet_free_ifa(ifa);
@@ -437,6 +442,8 @@
for (ifap = &in_dev->ifa_list; (ifa = *ifap) != NULL;
ifap = &ifa->ifa_next) {
+ if (ifa->ifa_net_ns != net_ns())
+ continue;
if ((rta[IFA_LOCAL - 1] &&
memcmp(RTA_DATA(rta[IFA_LOCAL - 1]),
&ifa->ifa_local, 4)) ||
@@ -497,6 +504,9 @@
ifa->ifa_scope = ifm->ifa_scope;
in_dev_hold(in_dev);
ifa->ifa_dev = in_dev;
+ ifa->ifa_net_ns = net_ns();
+ get_net_ns(net_ns());
+
if (rta[IFA_LABEL - 1])
rtattr_strlcpy(ifa->ifa_label, rta[IFA_LABEL - 1], IFNAMSIZ);
else
@@ -631,10 +641,15 @@
for (ifap = &in_dev->ifa_list; (ifa = *ifap) != NULL;
ifap = &ifa->ifa_next)
if (!strcmp(ifr.ifr_name, ifa->ifa_label))
- break;
+ if (!ifa->ifa_net_ns ||
+ ifa->ifa_net_ns == net_ns())
+ break;
}
}
+ if (ifa && ifa->ifa_net_ns && ifa->ifa_net_ns != net_ns())
+ goto done;
+
ret = -EADDRNOTAVAIL;
if (!ifa && cmd != SIOCSIFADDR && cmd != SIOCSIFFLAGS)
goto done;
@@ -678,6 +693,12 @@
ret = -ENOBUFS;
if ((ifa = inet_alloc_ifa()) == NULL)
break;
+ if (!LOOPBACK(sin->sin_addr.s_addr)) {
+ ifa->ifa_net_ns = net_ns();
+ get_net_ns(net_ns());
+ } else
+ ifa->ifa_net_ns = NULL;
+
if (colon)
memcpy(ifa->ifa_label, ifr.ifr_name, IFNAMSIZ);
else
@@ -782,6 +803,8 @@
goto out;
for (; ifa; ifa = ifa->ifa_next) {
+ if (ifa->ifa_net_ns && ifa->ifa_net_ns != net_ns())
+ continue;
if (!buf) {
done += sizeof(ifr);
continue;
@@ -1012,6 +1035,7 @@
ifa->ifa_address = htonl(INADDR_LOOPBACK);
ifa->ifa_prefixlen = 8;
ifa->ifa_mask = inet_make_mask(8);
+ ifa->ifa_net_ns = NULL;
in_dev_hold(in_dev);
ifa->ifa_dev = in_dev;
ifa->ifa_scope = RT_SCOPE_HOST;
@@ -1110,6 +1134,8 @@
for (ifa = in_dev->ifa_list, ip_idx = 0; ifa;
ifa = ifa->ifa_next, ip_idx++) {
+ if (ifa->ifa_net_ns && ifa->ifa_net_ns != net_ns())
+ continue;
if (ip_idx < s_ip_idx)
continue;
if (inet_fill_ifaddr(skb, ifa, NETLINK_CB(cb->skb).pid,
--
^ permalink raw reply
* [RFC] [patch 3/6] [Network namespace] Network devices isolation
From: dlezcano @ 2006-06-09 21:02 UTC (permalink / raw)
To: linux-kernel, netdev; +Cc: serue, haveblue, clg, dlezcano
In-Reply-To: <20060609210202.215291000@localhost.localdomain>
[-- Attachment #1: netdev_isolation.patch --]
[-- Type: text/plain, Size: 9453 bytes --]
The dev list view is filled and used from here. The dev_base_list has
been replaced to the dev list view and devices can be accessed only if
the view has the device in its list. All calls from the userspace,
ioctls, netlinks and procfs, will use the network devices view instead
of the global network device list.
Replace-Subject: [Network namespace] Network devices isolation
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
--
net/core/dev.c | 147 ++++++++++++++++++++++++++++++++++++++-------------
net/core/rtnetlink.c | 21 +++++--
2 files changed, 126 insertions(+), 42 deletions(-)
Index: 2.6-mm/net/core/dev.c
===================================================================
--- 2.6-mm.orig/net/core/dev.c
+++ 2.6-mm/net/core/dev.c
@@ -115,6 +115,7 @@
#include <net/iw_handler.h>
#include <asm/current.h>
#include <linux/audit.h>
+#include <linux/net_ns.h>
#include <linux/dmaengine.h>
/*
@@ -474,13 +475,16 @@
struct net_device *__dev_get_by_name(const char *name)
{
- struct hlist_node *p;
+ struct net_ns_dev_list *dev_list = &(net_ns()->dev_list);
+ struct list_head *l, *list = &dev_list->list;
+ struct net_ns_dev *db;
+ struct net_device *dev;
- hlist_for_each(p, dev_name_hash(name)) {
- struct net_device *dev
- = hlist_entry(p, struct net_device, name_hlist);
+ list_for_each(l, list) {
+ db = list_entry(l, struct net_ns_dev, list);
+ dev = db->dev;
if (!strncmp(dev->name, name, IFNAMSIZ))
- return dev;
+ return dev;
}
return NULL;
}
@@ -498,13 +502,14 @@
struct net_device *dev_get_by_name(const char *name)
{
+ struct net_ns_dev_list *dev_list = &(net_ns()->dev_list);
struct net_device *dev;
- read_lock(&dev_base_lock);
+ read_lock(&dev_list->lock);
dev = __dev_get_by_name(name);
if (dev)
dev_hold(dev);
- read_unlock(&dev_base_lock);
+ read_unlock(&dev_list->lock);
return dev;
}
@@ -521,11 +526,14 @@
struct net_device *__dev_get_by_index(int ifindex)
{
- struct hlist_node *p;
+ struct net_ns_dev_list *dev_list = &(net_ns()->dev_list);
+ struct list_head *l, *list = &dev_list->list;
+ struct net_ns_dev *db;
+ struct net_device *dev;
- hlist_for_each(p, dev_index_hash(ifindex)) {
- struct net_device *dev
- = hlist_entry(p, struct net_device, index_hlist);
+ list_for_each(l, list) {
+ db = list_entry(l, struct net_ns_dev, list);
+ dev = db->dev;
if (dev->ifindex == ifindex)
return dev;
}
@@ -545,13 +553,14 @@
struct net_device *dev_get_by_index(int ifindex)
{
+ struct net_ns_dev_list *dev_list = &(net_ns()->dev_list);
struct net_device *dev;
- read_lock(&dev_base_lock);
+ read_lock(&dev_list->lock);
dev = __dev_get_by_index(ifindex);
if (dev)
dev_hold(dev);
- read_unlock(&dev_base_lock);
+ read_unlock(&dev_list->lock);
return dev;
}
@@ -571,14 +580,24 @@
struct net_device *dev_getbyhwaddr(unsigned short type, char *ha)
{
- struct net_device *dev;
+ struct net_ns_dev_list *dev_list = &(net_ns()->dev_list);
+ struct list_head *l, *list = &dev_list->list;
+ struct net_ns_dev *db;
+ struct net_device *dev = NULL;
ASSERT_RTNL();
- for (dev = dev_base; dev; dev = dev->next)
+ read_lock(&dev_list->lock);
+ list_for_each(l, list) {
+ db = list_entry(l, struct net_ns_dev, list);
+ dev = db->dev;
if (dev->type == type &&
!memcmp(dev->dev_addr, ha, dev->addr_len))
- break;
+ goto out;
+ }
+ dev = NULL;
+out:
+ read_unlock(&dev_list->lock);
return dev;
}
@@ -586,15 +605,25 @@
struct net_device *dev_getfirstbyhwtype(unsigned short type)
{
+ struct net_ns_dev_list *dev_list = &(net_ns()->dev_list);
+ struct list_head *l, *list = &dev_list->list;
+ struct net_ns_dev *db;
struct net_device *dev;
rtnl_lock();
- for (dev = dev_base; dev; dev = dev->next) {
+
+ read_lock(&dev_list->lock);
+ list_for_each(l, list) {
+ db = list_entry(l, struct net_ns_dev, list);
+ dev = db->dev;
if (dev->type == type) {
dev_hold(dev);
- break;
+ goto out;
}
}
+ dev = NULL;
+out:
+ read_unlock(&dev_list->lock);
rtnl_unlock();
return dev;
}
@@ -614,16 +643,23 @@
struct net_device * dev_get_by_flags(unsigned short if_flags, unsigned short mask)
{
+ struct net_ns_dev_list *dev_list = &(net_ns()->dev_list);
+ struct list_head *l, *list = &dev_list->list;
+ struct net_ns_dev *db;
struct net_device *dev;
- read_lock(&dev_base_lock);
- for (dev = dev_base; dev != NULL; dev = dev->next) {
+ read_lock(&dev_list->lock);
+ list_for_each(l, list) {
+ db = list_entry(l, struct net_ns_dev, list);
+ dev = db->dev;
if (((dev->flags ^ if_flags) & mask) == 0) {
dev_hold(dev);
- break;
+ goto out;
}
}
- read_unlock(&dev_base_lock);
+ dev = NULL;
+out:
+ read_unlock(&dev_list->lock);
return dev;
}
@@ -1942,6 +1978,9 @@
static int dev_ifconf(char __user *arg)
{
struct ifconf ifc;
+ struct net_ns_dev_list *dev_list = &(net_ns()->dev_list);
+ struct list_head *l, *list = &dev_list->list;
+ struct net_ns_dev *db;
struct net_device *dev;
char __user *pos;
int len;
@@ -1963,8 +2002,14 @@
*/
total = 0;
- for (dev = dev_base; dev; dev = dev->next) {
+
+ list_for_each(l, list) {
+
+ db = list_entry(l, struct net_ns_dev, list);
+ dev = db->dev;
+
for (i = 0; i < NPROTO; i++) {
+
if (gifconf_list[i]) {
int done;
if (!pos)
@@ -1995,40 +2040,63 @@
* This is invoked by the /proc filesystem handler to display a device
* in detail.
*/
-static __inline__ struct net_device *dev_get_idx(loff_t pos)
+static __inline__ struct net_ns_dev *dev_get_idx(loff_t pos)
{
- struct net_device *dev;
- loff_t i;
-
- for (i = 0, dev = dev_base; dev && i < pos; ++i, dev = dev->next);
-
- return i == pos ? dev : NULL;
+ struct net_ns_dev_list *dev_list = &(net_ns()->dev_list);
+ struct list_head *l, *list = &dev_list->list;
+ struct net_ns_dev *db;
+
+ loff_t i = 0;
+
+ list_for_each(l, list) {
+ db = list_entry(l, struct net_ns_dev, list);
+ if (i == pos)
+ return db;
+ i++;
+ };
+ return NULL;
}
void *dev_seq_start(struct seq_file *seq, loff_t *pos)
{
- read_lock(&dev_base_lock);
+ struct net_ns_dev_list *dev_list = &(net_ns()->dev_list);
+
+ read_lock(&dev_list->lock);
return *pos ? dev_get_idx(*pos - 1) : SEQ_START_TOKEN;
}
void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{
+ struct net_ns_dev_list *dev_list = &(net_ns()->dev_list);
+ struct net_ns_dev *db = NULL;
+ struct list_head *next;
+
++*pos;
- return v == SEQ_START_TOKEN ? dev_base : ((struct net_device *)v)->next;
+
+ if (v == SEQ_START_TOKEN)
+ next = dev_list->list.next;
+ else
+ next = ((struct net_ns_dev*)v)->list.next;
+ if (next && next != &dev_list->list)
+ db = list_entry(next, struct net_ns_dev, list);
+ return db;
}
void dev_seq_stop(struct seq_file *seq, void *v)
{
- read_unlock(&dev_base_lock);
+ struct net_ns_dev_list *dev_list = &(net_ns()->dev_list);
+ read_unlock(&dev_list->lock);
}
-static void dev_seq_printf_stats(struct seq_file *seq, struct net_device *dev)
+static void dev_seq_printf_stats(struct seq_file *seq, struct net_ns_dev *db)
{
+ struct net_device *dev = db->dev;
+
if (dev->get_stats) {
struct net_device_stats *stats = dev->get_stats(dev);
seq_printf(seq, "%6s:%8lu %7lu %4lu %4lu %4lu %5lu %10lu %9lu "
- "%8lu %7lu %4lu %4lu %4lu %5lu %7lu %10lu\n",
+ "%8lu %7lu %4lu %4lu %4lu %5lu %7lu %10lu\n",
dev->name, stats->rx_bytes, stats->rx_packets,
stats->rx_errors,
stats->rx_dropped + stats->rx_missed_errors,
@@ -2402,7 +2470,7 @@
*/
static int dev_ifsioc(struct ifreq *ifr, unsigned int cmd)
{
- int err;
+ int err = 0;
struct net_device *dev = __dev_get_by_name(ifr->ifr_name);
if (!dev)
@@ -2509,7 +2577,6 @@
/*
* Unknown or private ioctl
*/
-
default:
if ((cmd >= SIOCDEVPRIVATE &&
cmd <= SIOCDEVPRIVATE + 15) ||
@@ -2847,6 +2914,10 @@
}
}
+ ret = net_ns_dev_register(dev, &(net_ns()->dev_list));
+ if (ret)
+ goto out_err;
+
/* Fix illegal SG+CSUM combinations. */
if ((dev->features & NETIF_F_SG) &&
!(dev->features & (NETIF_F_IP_CSUM |
@@ -3218,6 +3289,8 @@
return -ENODEV;
}
+ net_ns_dev_unregister(dev, &(net_ns()->dev_list));
+
dev->reg_state = NETREG_UNREGISTERING;
synchronize_net();
Index: 2.6-mm/net/core/rtnetlink.c
===================================================================
--- 2.6-mm.orig/net/core/rtnetlink.c
+++ 2.6-mm/net/core/rtnetlink.c
@@ -55,6 +55,7 @@
#include <linux/wireless.h>
#include <net/iw_handler.h>
#endif /* CONFIG_NET_WIRELESS_RTNETLINK */
+#include <linux/net_ns.h>
static DEFINE_MUTEX(rtnl_mutex);
@@ -315,21 +316,31 @@
static int rtnetlink_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
{
- int idx;
+ int idx = 0;
int s_idx = cb->args[0];
+
+ struct net_ns_dev_list *dev_list = &(net_ns()->dev_list);
+ struct list_head *l, *list = &dev_list->list;
+ struct net_ns_dev *db;
struct net_device *dev;
- read_lock(&dev_base_lock);
- for (dev=dev_base, idx=0; dev; dev = dev->next, idx++) {
- if (idx < s_idx)
+ read_lock(&dev_list->lock);
+ list_for_each(l, list) {
+
+ if (idx++ < s_idx)
continue;
+
+ db = list_entry(l, struct net_ns_dev, list);
+ dev = db->dev;
+
if (rtnetlink_fill_ifinfo(skb, dev, RTM_NEWLINK,
NETLINK_CB(cb->skb).pid,
cb->nlh->nlmsg_seq, 0,
NLM_F_MULTI) <= 0)
break;
}
- read_unlock(&dev_base_lock);
+ read_unlock(&dev_list->lock);
+
cb->args[0] = idx;
return skb->len;
--
^ permalink raw reply
* [RFC] [patch 2/6] [Network namespace] Network device sharing by view
From: dlezcano @ 2006-06-09 21:02 UTC (permalink / raw)
To: linux-kernel, netdev; +Cc: serue, haveblue, clg, dlezcano
In-Reply-To: <20060609210202.215291000@localhost.localdomain>
[-- Attachment #1: net_ns_dev.patch --]
[-- Type: text/plain, Size: 8458 bytes --]
Adds to the network namespace a device list view. This view is emptied
when the unshare is done. The view is filled/emptied by a set of
function which can be called by an external module.
Replace-Subject: [Network namespace] Network device sharing by view
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
--
include/linux/net_ns.h | 2
include/linux/net_ns_dev.h | 32 +++++++
init/version.c | 4
net/core/Makefile | 2
net/core/net_ns_dev.c | 205 +++++++++++++++++++++++++++++++++++++++++++++
net/net_ns.c | 6 +
6 files changed, 250 insertions(+), 1 deletion(-)
Index: 2.6-mm/include/linux/net_ns_dev.h
===================================================================
--- /dev/null
+++ 2.6-mm/include/linux/net_ns_dev.h
@@ -0,0 +1,32 @@
+#ifndef _LINUX_NET_NS_DEV_H
+#define _LINUX_NET_NS_DEV_H
+
+struct net_device;
+
+struct net_ns_dev {
+ struct list_head list;
+ struct net_device *dev;
+};
+
+struct net_ns_dev_list {
+ struct list_head list;
+ rwlock_t lock;
+};
+
+extern int net_ns_dev_unregister(struct net_device *dev,
+ struct net_ns_dev_list *devlist);
+
+extern int net_ns_dev_register(struct net_device *dev,
+ struct net_ns_dev_list *devlist);
+
+extern struct net_device *net_ns_dev_find_by_name(const char *devname,
+ struct net_ns_dev_list *devlist);
+extern int net_ns_dev_remove(const char *devname,
+ struct net_ns_dev_list *devlist);
+
+extern int net_ns_dev_add(const char *devname,
+ struct net_ns_dev_list *devlist);
+
+extern int free_net_ns_dev(struct net_ns_dev_list *devlist);
+
+#endif
Index: 2.6-mm/include/linux/net_ns.h
===================================================================
--- 2.6-mm.orig/include/linux/net_ns.h
+++ 2.6-mm/include/linux/net_ns.h
@@ -4,9 +4,11 @@
#include <linux/kref.h>
#include <linux/sched.h>
#include <linux/nsproxy.h>
+#include <linux/net_ns_dev.h>
struct net_namespace {
struct kref kref;
+ struct net_ns_dev_list dev_list;
};
extern struct net_namespace init_net_ns;
Index: 2.6-mm/net/core/net_ns_dev.c
===================================================================
--- /dev/null
+++ 2.6-mm/net/core/net_ns_dev.c
@@ -0,0 +1,205 @@
+/*
+ * net_ns_dev.c - adds namespace netwok device view
+ *
+ * Copyright (C) 2006 IBM
+ *
+ * Author: Daniel Lezcano <dlezcano@fr.ibm.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, version 2 of the
+ * License.
+ */
+#include <linux/list.h>
+#include <linux/spinlock.h>
+#include <linux/netdevice.h>
+#include <linux/net_ns_dev.h>
+
+int free_net_ns_dev(struct net_ns_dev_list *devlist)
+{
+ struct list_head *l, *next;
+ struct net_ns_dev *db;
+ struct net_device *dev;
+
+ write_lock(&devlist->lock);
+ list_for_each_safe(l, next, &devlist->list) {
+ db = list_entry(l, struct net_ns_dev, list);
+ dev = db->dev;
+ list_del(&db->list);
+ dev_put(dev);
+ kfree(db);
+ }
+ write_unlock(&devlist->lock);
+
+ return 0;
+}
+
+/*
+ * Remove a device to the namespace network devices list
+ * when registered from a namespace
+ * @dev : network device
+ * @dev_list: network namespace devices
+ * Return ENODEV if the device does not exist,
+ */
+int net_ns_dev_unregister(struct net_device *dev,
+ struct net_ns_dev_list *devlist)
+{
+ struct net_ns_dev *db;
+ struct list_head *l;
+ int ret = -ENODEV;
+
+ write_lock(&devlist->lock);
+ list_for_each(l, &devlist->list) {
+ db = list_entry(l, struct net_ns_dev, list);
+ if (dev != db->dev)
+ continue;
+
+ list_del(&db->list);
+ dev_put(dev);
+ kfree(db);
+ ret = 0;
+ break;
+ }
+ write_unlock(&devlist->lock);
+ return ret;
+}
+
+EXPORT_SYMBOL_GPL(net_ns_dev_unregister);
+
+/*
+ * Add a device to the namespace network devices list
+ * when registered from a namespace
+ * @dev : network device
+ * @dev_list: network namespace devices
+ * Return ENOMEM if allocation fails, 0 on success
+ */
+int net_ns_dev_register(struct net_device *dev,
+ struct net_ns_dev_list *devlist)
+{
+ struct net_ns_dev *db;
+
+ db = kmalloc(sizeof(*db), GFP_KERNEL);
+ if (!db)
+ return -ENOMEM;
+
+ write_lock(&devlist->lock);
+ dev_hold(dev);
+ db->dev = dev;
+ list_add_tail(&db->list, &devlist->list);
+ write_unlock(&devlist->lock);
+
+ return 0;
+}
+
+EXPORT_SYMBOL_GPL(net_ns_dev_register);
+
+/*
+ * Add a device to the namespace network devices list
+ * @devname : network device name
+ * @dev_list: network namespace devices
+ * Return ENODEV if the device does not exist,
+ * ENOMEM if allocation fails, 0 on success
+ */
+int net_ns_dev_add(const char *devname,
+ struct net_ns_dev_list *devlist)
+{
+ struct net_ns_dev *db;
+ struct net_device *dev;
+ int ret = 0;
+
+ read_lock(&dev_base_lock);
+
+ for (dev = dev_base; dev; dev = dev->next)
+ if (!strncmp(dev->name, devname, IFNAMSIZ))
+ break;
+
+ if (!dev) {
+ ret = -ENODEV;
+ goto out;
+ }
+
+ db = kmalloc(sizeof(*db), GFP_KERNEL);
+ if (!db) {
+ ret = -ENOMEM;
+ goto out;
+ }
+
+ write_lock(&devlist->lock);
+ db->dev = dev;
+ dev_hold(dev);
+ list_add_tail(&db->list, &devlist->list);
+ write_unlock(&devlist->lock);
+
+out:
+ read_unlock(&dev_base_lock);
+
+ return ret;
+}
+
+EXPORT_SYMBOL_GPL(net_ns_dev_add);
+
+/*
+ * Remove a device from the namespace network devices list
+ * @devname : network device name
+ * @dev_list: network namespace devices
+ * Return ENODEV if the device does not exist, 0 on success
+ */
+int net_ns_dev_remove(const char *devname,
+ struct net_ns_dev_list *devlist)
+{
+ struct net_ns_dev *db;
+ struct net_device *dev;
+ struct list_head *l;
+ int ret = 0;
+
+ write_lock(&devlist->lock);
+ list_for_each(l, &devlist->list) {
+ db = list_entry(l, struct net_ns_dev, list);
+ dev = db->dev;
+
+ if (!strncmp(dev->name, devname, IFNAMSIZ)) {
+ list_del(&db->list);
+ dev_put(dev);
+ kfree(db);
+ goto out;
+ }
+ }
+ ret = -ENODEV;
+out:
+ write_unlock(&devlist->lock);
+ return ret;
+}
+
+EXPORT_SYMBOL_GPL(net_ns_dev_remove);
+
+/*
+ * Find a namespace network device
+ * @devname : network device name
+ * @dev_list: network namespace devices
+ * Return ENODEV if the device does not exist, 0 on success
+ */
+struct net_device *net_ns_dev_find_by_name(const char *devname,
+ struct net_ns_dev_list *devlist)
+{
+ struct net_ns_dev *db;
+ struct net_device *dev;
+ struct list_head *l;
+
+ read_lock(&devlist->lock);
+
+ list_for_each(l, &devlist->list) {
+ db = list_entry(l, struct net_ns_dev, list);
+ dev = db->dev;
+
+ if (!strncmp(dev->name, devname, IFNAMSIZ)) {
+ dev_hold(dev);
+ goto out;
+ }
+ }
+ dev = NULL;
+out:
+ read_unlock(&devlist->lock);
+ return dev;
+}
+
+EXPORT_SYMBOL_GPL(net_ns_dev_find_by_name);
Index: 2.6-mm/net/net_ns.c
===================================================================
--- 2.6-mm.orig/net/net_ns.c
+++ 2.6-mm/net/net_ns.c
@@ -23,11 +23,16 @@
struct net_namespace *clone_net_ns(struct net_namespace *old_ns)
{
struct net_namespace *new_ns;
+ struct net_ns_dev_list *new_dev_list;
new_ns = kmalloc(sizeof(*new_ns), GFP_KERNEL);
if (!new_ns)
return NULL;
+
kref_init(&new_ns->kref);
+ new_dev_list = &new_ns->dev_list;
+ INIT_LIST_HEAD(&new_dev_list->list);
+ new_dev_list->lock = RW_LOCK_UNLOCKED;
return new_ns;
}
@@ -92,5 +97,6 @@ void free_net_ns(struct kref *kref)
struct net_namespace *ns;
ns = container_of(kref, struct net_namespace, kref);
+ free_net_ns_dev(&ns->dev_list);
kfree(ns);
}
Index: 2.6-mm/net/core/Makefile
===================================================================
--- 2.6-mm.orig/net/core/Makefile
+++ 2.6-mm/net/core/Makefile
@@ -7,7 +7,7 @@ obj-y := sock.o request_sock.o skbuff.o
obj-$(CONFIG_SYSCTL) += sysctl_net_core.o
-obj-y += dev.o ethtool.o dev_mcast.o dst.o \
+obj-y += dev.o net_ns_dev.o ethtool.o dev_mcast.o dst.o \
neighbour.o rtnetlink.o utils.o link_watch.o filter.o
obj-$(CONFIG_XFRM) += flow.o
Index: 2.6-mm/init/version.c
===================================================================
--- 2.6-mm.orig/init/version.c
+++ 2.6-mm/init/version.c
@@ -38,6 +38,10 @@ struct net_namespace init_net_ns = {
.kref = {
.refcount = ATOMIC_INIT(2),
},
+ .dev_list = {
+ .lock = RW_LOCK_UNLOCKED,
+ .list = LIST_HEAD_INIT(init_net_ns.dev_list.list),
+ },
};
EXPORT_SYMBOL_GPL(init_net_ns);
--
^ permalink raw reply
* [RFC] [patch 1/6] [Network namespace] Network namespace structure
From: dlezcano @ 2006-06-09 21:02 UTC (permalink / raw)
To: linux-kernel, netdev; +Cc: serue, haveblue, clg, dlezcano
In-Reply-To: <20060609210202.215291000@localhost.localdomain>
[-- Attachment #1: net_ns.patch --]
[-- Type: text/plain, Size: 11607 bytes --]
This patch adds to the nsproxy the network namespace and a set of
functions to unshare it. The network namespace structure should be
filled later with the identified network ressources needed for more
isolation.
Replace-Subject: [Network namespace] Network namespace structure
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
--
include/linux/init_task.h | 2
include/linux/net_ns.h | 59 ++++++++++++++++++++++++++++
include/linux/nsproxy.h | 2
include/linux/sched.h | 1
init/version.c | 8 +++
kernel/fork.c | 24 +++++++++--
kernel/nsproxy.c | 38 +++++++++++-------
net/Kconfig | 9 ++++
net/Makefile | 1
net/net_ns.c | 96 ++++++++++++++++++++++++++++++++++++++++++++++
10 files changed, 222 insertions(+), 18 deletions(-)
Index: 2.6-mm/include/linux/net_ns.h
===================================================================
--- /dev/null
+++ 2.6-mm/include/linux/net_ns.h
@@ -0,0 +1,59 @@
+#ifndef _LINUX_NET_NS_H
+#define _LINUX_NET_NS_H
+
+#include <linux/kref.h>
+#include <linux/sched.h>
+#include <linux/nsproxy.h>
+
+struct net_namespace {
+ struct kref kref;
+};
+
+extern struct net_namespace init_net_ns;
+
+#ifdef CONFIG_NET_NS
+
+extern int unshare_network(unsigned long unshare_flags,
+ struct net_namespace **new_net);
+
+extern int copy_network(int flags, struct task_struct *tsk);
+
+static inline void get_net_ns(struct net_namespace *ns)
+{
+ kref_get(&ns->kref);
+}
+
+void free_net_ns(struct kref *kref);
+
+static inline void put_net_ns(struct net_namespace *ns)
+{
+ kref_put(&ns->kref, free_net_ns);
+}
+
+static inline void exit_network(struct task_struct *p)
+{
+ struct net_namespace *net_ns = p->nsproxy->net_ns;
+ if (net_ns)
+ put_net_ns(net_ns);
+}
+#else /* !CONFIG_NET_NS */
+static inline int unshare_network(unsigned long unshare_flags,
+ struct net_namespace **new_net)
+{
+ return -EINVAL;
+}
+static inline int copy_network(int flags, struct task_struct *tsk)
+{
+ return 0;
+}
+static inline void get_net_ns(struct net_namespace *ns) {}
+static inline void put_net_ns(struct net_namespace *ns) {}
+static inline void exit_network(struct task_struct *p) {}
+#endif /* CONFIG_NET_NS */
+
+static inline struct net_namespace *net_ns(void)
+{
+ return current->nsproxy->net_ns;
+}
+
+#endif
Index: 2.6-mm/net/net_ns.c
===================================================================
--- /dev/null
+++ 2.6-mm/net/net_ns.c
@@ -0,0 +1,96 @@
+/*
+ * net_ns.c - adds support for network namespace
+ *
+ * Copyright (C) 2006 IBM
+ *
+ * Author: Daniel Lezcano <dlezcano@fr.ibm.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, version 2 of the
+ * License.
+ */
+
+#include <linux/net_ns.h>
+#include <linux/module.h>
+
+/*
+ * Clone a new ns copying an original, setting refcount to 1
+ * Cloned process will have
+ * @old_ns: namespace to clone
+ * Return NULL on error (failure to kmalloc), new ns otherwise
+ */
+struct net_namespace *clone_net_ns(struct net_namespace *old_ns)
+{
+ struct net_namespace *new_ns;
+
+ new_ns = kmalloc(sizeof(*new_ns), GFP_KERNEL);
+ if (!new_ns)
+ return NULL;
+ kref_init(&new_ns->kref);
+ return new_ns;
+}
+
+/*
+ * unshare the current process' network namespace.
+ * called only in sys_unshare()
+ */
+int unshare_network(unsigned long unshare_flags,
+ struct net_namespace **new_net)
+{
+ if (!(unshare_flags & CLONE_NEWNET))
+ return 0;
+
+ if (!capable(CAP_SYS_ADMIN))
+ return -EPERM;
+
+ *new_net = clone_net_ns(current->nsproxy->net_ns);
+ if (!*new_net)
+ return -ENOMEM;
+
+ return 0;
+}
+
+/*
+ * Copy task tsk's network namespace, or clone it if flags specifies
+ * CLONE_NEWNET. In latter case, changes to the network ressources of
+ * this process won't be seen by parent, and vice versa.
+ */
+int copy_network(int flags, struct task_struct *tsk)
+{
+ struct net_namespace *old_ns = tsk->nsproxy->net_ns;
+ struct net_namespace *new_ns;
+ int err = 0;
+
+ if (!old_ns)
+ return 0;
+
+ get_net_ns(old_ns);
+
+ if (!(flags & CLONE_NEWNET))
+ return 0;
+
+ if (!capable(CAP_SYS_ADMIN)) {
+ err = -EPERM;
+ goto out;
+ }
+
+ new_ns = clone_net_ns(old_ns);
+ if (!new_ns) {
+ err = -ENOMEM;
+ goto out;
+ }
+ tsk->nsproxy->net_ns = new_ns;
+
+out:
+ put_net_ns(old_ns);
+ return err;
+}
+
+void free_net_ns(struct kref *kref)
+{
+ struct net_namespace *ns;
+
+ ns = container_of(kref, struct net_namespace, kref);
+ kfree(ns);
+}
Index: 2.6-mm/include/linux/nsproxy.h
===================================================================
--- 2.6-mm.orig/include/linux/nsproxy.h
+++ 2.6-mm/include/linux/nsproxy.h
@@ -6,6 +6,7 @@
struct namespace;
struct uts_namespace;
+struct net_namespace;
/*
* A structure to contain pointers to all per-process
@@ -23,6 +24,7 @@ struct nsproxy {
atomic_t count;
spinlock_t nslock;
struct uts_namespace *uts_ns;
+ struct net_namespace *net_ns;
struct namespace *namespace;
};
extern struct nsproxy init_nsproxy;
Index: 2.6-mm/kernel/nsproxy.c
===================================================================
--- 2.6-mm.orig/kernel/nsproxy.c
+++ 2.6-mm/kernel/nsproxy.c
@@ -14,6 +14,7 @@
#include <linux/nsproxy.h>
#include <linux/namespace.h>
#include <linux/utsname.h>
+#include <linux/net_ns.h>
static inline void get_nsproxy(struct nsproxy *ns)
{
@@ -59,6 +60,8 @@ struct nsproxy *dup_namespaces(struct ns
get_namespace(ns->namespace);
if (ns->uts_ns)
get_uts_ns(ns->uts_ns);
+ if (ns->net_ns)
+ get_net_ns(ns->net_ns);
}
return ns;
@@ -79,7 +82,7 @@ int copy_namespaces(int flags, struct ta
get_nsproxy(old_ns);
- if (!(flags & (CLONE_NEWNS | CLONE_NEWUTS)))
+ if (!(flags & (CLONE_NEWNS | CLONE_NEWUTS | CLONE_NEWNET)))
return 0;
new_ns = clone_namespaces(old_ns);
@@ -91,21 +94,28 @@ int copy_namespaces(int flags, struct ta
tsk->nsproxy = new_ns;
err = copy_namespace(flags, tsk);
- if (err) {
- tsk->nsproxy = old_ns;
- put_nsproxy(new_ns);
- goto out;
- }
+ if (err)
+ goto bad_copy_namespace;
err = copy_utsname(flags, tsk);
- if (err) {
- if (new_ns->namespace)
- put_namespace(new_ns->namespace);
- tsk->nsproxy = old_ns;
- put_nsproxy(new_ns);
- goto out;
- }
+ if (err)
+ goto bad_copy_utsname;
+ err = copy_network(flags, tsk);
+ if (err)
+ goto bad_copy_network;
+
+ goto out;
+
+bad_copy_network:
+ if (new_ns->uts_ns)
+ put_uts_ns(new_ns->uts_ns);
+bad_copy_utsname:
+ if (new_ns->namespace)
+ put_namespace(new_ns->namespace);
+bad_copy_namespace:
+ tsk->nsproxy = old_ns;
+ put_nsproxy(new_ns);
out:
put_nsproxy(old_ns);
return err;
@@ -117,5 +127,7 @@ void free_nsproxy(struct nsproxy *ns)
put_namespace(ns->namespace);
if (ns->uts_ns)
put_uts_ns(ns->uts_ns);
+ if (ns->net_ns)
+ put_net_ns(ns->net_ns);
kfree(ns);
}
Index: 2.6-mm/include/linux/sched.h
===================================================================
--- 2.6-mm.orig/include/linux/sched.h
+++ 2.6-mm/include/linux/sched.h
@@ -25,6 +25,7 @@
#define CLONE_CHILD_SETTID 0x01000000 /* set the TID in the child */
#define CLONE_STOPPED 0x02000000 /* Start in stopped state */
#define CLONE_NEWUTS 0x04000000 /* New utsname group? */
+#define CLONE_NEWNET 0x08000000 /* New network namespace */
/*
* Scheduling policies
Index: 2.6-mm/net/Kconfig
===================================================================
--- 2.6-mm.orig/net/Kconfig
+++ 2.6-mm/net/Kconfig
@@ -60,6 +60,15 @@ config INET
Short answer: say Y.
+config NET_NS
+ bool "Network namespaces"
+ depends on NET
+ default n
+ ---help---
+ Support for network namespaces. This allows containers, i.e.
+ vservers, to use network namespaces to provide isolated
+ network for different servers. If unsure, say N.
+
if INET
source "net/ipv4/Kconfig"
source "net/ipv6/Kconfig"
Index: 2.6-mm/net/Makefile
===================================================================
--- 2.6-mm.orig/net/Makefile
+++ 2.6-mm/net/Makefile
@@ -50,3 +50,4 @@ obj-$(CONFIG_TIPC) += tipc/
ifeq ($(CONFIG_NET),y)
obj-$(CONFIG_SYSCTL) += sysctl_net.o
endif
+obj-$(CONFIG_NET_NS) += net_ns.o
Index: 2.6-mm/include/linux/init_task.h
===================================================================
--- 2.6-mm.orig/include/linux/init_task.h
+++ 2.6-mm/include/linux/init_task.h
@@ -4,6 +4,7 @@
#include <linux/file.h>
#include <linux/rcupdate.h>
#include <linux/utsname.h>
+#include <linux/net_ns.h>
#include <linux/interrupt.h>
#define INIT_FDTABLE \
@@ -73,6 +74,7 @@ extern struct nsproxy init_nsproxy;
.count = ATOMIC_INIT(1), \
.nslock = SPIN_LOCK_UNLOCKED, \
.uts_ns = &init_uts_ns, \
+ .net_ns = &init_net_ns, \
.namespace = NULL, \
}
Index: 2.6-mm/kernel/fork.c
===================================================================
--- 2.6-mm.orig/kernel/fork.c
+++ 2.6-mm/kernel/fork.c
@@ -1592,13 +1592,15 @@ asmlinkage long sys_unshare(unsigned lon
struct sem_undo_list *new_ulist = NULL;
struct nsproxy *new_nsproxy = NULL, *old_nsproxy = NULL;
struct uts_namespace *uts, *new_uts = NULL;
+ struct net_namespace *net, *new_net = NULL;
check_unshare_flags(&unshare_flags);
/* Return -EINVAL for all unsupported flags */
err = -EINVAL;
if (unshare_flags & ~(CLONE_THREAD|CLONE_FS|CLONE_NEWNS|CLONE_SIGHAND|
- CLONE_VM|CLONE_FILES|CLONE_SYSVSEM|CLONE_NEWUTS))
+ CLONE_VM|CLONE_FILES|CLONE_SYSVSEM|CLONE_NEWUTS|
+ CLONE_NEWNET))
goto bad_unshare_out;
if ((err = unshare_thread(unshare_flags)))
@@ -1617,18 +1619,20 @@ asmlinkage long sys_unshare(unsigned lon
goto bad_unshare_cleanup_fd;
if ((err = unshare_utsname(unshare_flags, &new_uts)))
goto bad_unshare_cleanup_semundo;
+ if ((err = unshare_network(unshare_flags, &new_net)))
+ goto bad_unshare_cleanup_utsname;
- if (new_ns || new_uts) {
+ if (new_ns || new_uts || new_net) {
old_nsproxy = current->nsproxy;
new_nsproxy = dup_namespaces(old_nsproxy);
if (!new_nsproxy) {
err = -ENOMEM;
- goto bad_unshare_cleanup_uts;
+ goto bad_unshare_cleanup_net;
}
}
if (new_fs || new_ns || new_sigh || new_mm || new_fd || new_ulist ||
- new_uts) {
+ new_uts || new_net) {
task_lock(current);
@@ -1676,13 +1680,23 @@ asmlinkage long sys_unshare(unsigned lon
new_uts = uts;
}
+ if (new_net) {
+ net = current->nsproxy->net_ns;
+ current->nsproxy->net_ns = new_net;
+ new_net = net;
+ }
+
task_unlock(current);
}
if (new_nsproxy)
put_nsproxy(new_nsproxy);
-bad_unshare_cleanup_uts:
+bad_unshare_cleanup_net:
+ if (new_net)
+ put_net_ns(new_net);
+
+bad_unshare_cleanup_utsname:
if (new_uts)
put_uts_ns(new_uts);
Index: 2.6-mm/init/version.c
===================================================================
--- 2.6-mm.orig/init/version.c
+++ 2.6-mm/init/version.c
@@ -10,6 +10,7 @@
#include <linux/module.h>
#include <linux/uts.h>
#include <linux/utsname.h>
+#include <linux/net_ns.h>
#include <linux/version.h>
#include <linux/sched.h>
@@ -33,6 +34,13 @@ struct uts_namespace init_uts_ns = {
};
EXPORT_SYMBOL_GPL(init_uts_ns);
+struct net_namespace init_net_ns = {
+ .kref = {
+ .refcount = ATOMIC_INIT(2),
+ },
+};
+EXPORT_SYMBOL_GPL(init_net_ns);
+
const char linux_banner[] =
"Linux version " UTS_RELEASE " (" LINUX_COMPILE_BY "@"
LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION "\n";
--
^ permalink raw reply
* [RFC] [patch 0/6] [Network namespace] introduction
From: dlezcano @ 2006-06-09 21:02 UTC (permalink / raw)
To: linux-kernel, netdev; +Cc: serue, haveblue, clg, dlezcano
The following patches create a private "network namespace" for use
within containers. This is intended for use with system containers
like vserver, but might also be useful for restricting individual
applications' access to the network stack.
These patches isolate traffic inside the network namespace. The
network ressources, the incoming and the outgoing packets are
identified to be related to a namespace.
It hides network resource not contained in the current namespace, but
still allows administration of the network with normal commands like
ifconfig.
It applies to the kernel version 2.6.17-rc6-mm1
It provides the following:
-------------------------
- when an application unshares its network namespace, it looses its
view of all network devices by default. The administrator can
choose to make any devices to become visible again. The container
then gains a view to the device but without the ip address
configured on it. It is up to the container administrator to use
ifconfig or ip command to setup a new ip address. This ip address
is only visible inside the container.
- the loopback is isolated inside the container and it is not
possible to communicate between containers via the
loopback.
- several containers can have an application bind to the same
address:port without conflicting.
What is for ?
-------------
- security : an application can be bounded inside a container
without interacting with the network used by another container
- consolidation : several instance of the same application can be
ran in different container because the network namespace allows
to bind to the same addr:port
What could be done ?
--------------------
- because the network ressources are related to a namespace, it is
easy to identify them. That facilitate the implementation of the
network migration
How to use ?
------------
- do unshare with the CLONE_NEWNET flag as root
- do echo eth0 > /sys/kernel/debug/net_ns/dev
- use ifconfig or ip command to set a new ip address
What is missing ?
-----------------
The routes are not yet isolated, that implies:
- binding to another container's address is allowed
- an outgoing packet which has an unset source address can
potentially get another container's address
- an incoming packet can be routed to the wrong container if there
are several containers listening to the same addr:port
--
^ permalink raw reply
* Re: [patch 4/8] e1000: prevent statistics from getting garbled during reset
From: Auke Kok @ 2006-06-09 18:28 UTC (permalink / raw)
To: jeff; +Cc: akpm, netdev, linas, jesse.brandeburg, john.ronciak
In-Reply-To: <200606090519.k595JiOL032023@shell0.pdx.osdl.net>
[-- Attachment #1: Type: text/plain, Size: 821 bytes --]
Ack,
Jeff, please pull this patch from:
git://lost.foo-projects.org/~ahkok/git/netdev-2.6 upstream
which is against netdev-2.6#upstream cac925a4aab1b7233d3beb591f53498816058a08
Cheers,
Auke
---
Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Acked-by: Auke Kok <auke-jan.h.kok@intel.com>
---
e1000_main.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletion(-)
akpm@osdl.org wrote:
> From: Linas Vepstas <linas@austin.ibm.com>
>
> If a PCI bus error/fault triggers a PCI bus reset, attempts to get the
> ethernet packet count statistics from the hardware will fail, returning
> garbage data upstream. This patch skips statistics data collection if the
> PCI device is not on the bus.
[snip]
[-- Attachment #2: e1000_prevent_garbled_stats_during_reset_linas.patch --]
[-- Type: text/x-patch, Size: 1276 bytes --]
e1000: prevent statistics from garbling during bus resets
If a PCI bus error/fault triggers a PCI bus reset, attempts to get
the ethernet packet count statistics from the hardware will fail,
returning garbage data upstream. This patch skips statistics data
collection if the PCI device is not on the bus.
Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Acked-by: Auke Kok <auke-jan.h.kok@intel.com>
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 56c7492..a373ccb 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -3045,14 +3045,20 @@ void
e1000_update_stats(struct e1000_adapter *adapter)
{
struct e1000_hw *hw = &adapter->hw;
+ struct pci_dev *pdev = adapter->pdev;
unsigned long flags;
uint16_t phy_tmp;
#define PHY_IDLE_ERROR_COUNT_MASK 0x00FF
- /* Prevent stats update while adapter is being reset */
+ /*
+ * Prevent stats update while adapter is being reset, or if the pci
+ * connection is down.
+ */
if (adapter->link_speed == 0)
return;
+ if (pdev->error_state && pdev->error_state != pci_channel_io_normal)
+ return;
spin_lock_irqsave(&adapter->stats_lock, flags);
^ permalink raw reply related
* Re: [patch 06/17] neighbour.c, pneigh_get_next() skips published entry
From: Jari Takkala @ 2006-06-09 20:14 UTC (permalink / raw)
To: Herbert Xu; +Cc: davem, akpm, netdev
On Fri, 9 Jun 2006, Herbert Xu wrote:
> Could you post an exact sequence of commands that reproduces the bug?
> That would help us in verifying your fix.
>
Publish a large number of ARP entries (greater than 10 required on my
system):
'arp -Ds <IP> <iface> pub'
View output of /proc/net/arp:
'dd if=/proc/net/arp of=arp-1024.out bs=1024'
The produced output will be missing on average one entry for every ten
entries published. Occasionally, the output will vary and the missing
entry will be displayed.
^ permalink raw reply
* Re: Using netconsole for debugging suspend/resume
From: Mark Lord @ 2006-06-09 15:24 UTC (permalink / raw)
To: Andi Kleen
Cc: Jeremy Fitzhardinge, Matt Mackall, Linux Kernel Mailing List,
netdev
In-Reply-To: <200606090546.15923.ak@suse.de>
Andi Kleen wrote:
>
> If your laptop has firewire you can also use firescope.
> (ftp://ftp.suse.com/pub/people/ak/firescope/)
..
> FW keeps running as long as nobody resets the ieee1394 chip.
This looks interesting. But how does one set it up for use
on the *other* end of that firewire cable? The Quickstart and
manpage don't seem to describe this fully.
Thanks
^ permalink raw reply
* Re: [NET]: Add netif_tx_lock
From: David Miller @ 2006-06-09 19:21 UTC (permalink / raw)
To: herbert; +Cc: mchan, jgarzik, netdev
In-Reply-To: <20060609054816.GA7612@gondor.apana.org.au>
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Fri, 9 Jun 2006 15:48:16 +1000
> On Thu, Jun 01, 2006 at 09:15:03PM +1000, herbert wrote:
> >
> > OK, here is a patch which does this.
> >
> > [NET]: Add netif_tx_lock
>
> Just noticed that I showed dyslexia in winbond.c :) Here is the corrected
> version.
>
> [NET]: Add netif_tx_lock
:-) Applied, thanks a lot Herbert.
^ permalink raw reply
* Re: [RFT] Realtek 8168 ethernet support
From: Jeff Garzik @ 2006-06-09 18:48 UTC (permalink / raw)
To: Francois Romieu; +Cc: Randy.Dunlap, Daniel Drake, netdev
In-Reply-To: <20060609183358.GA5835@electric-eye.fr.zoreil.com>
Francois Romieu wrote:
> Jeff Garzik <jeff@garzik.org> :
>> Randy.Dunlap wrote:
>>> Conversely, any reason to use the RealTek r1000 driver?
>> FWIW, RealTek emailed me about merging r1000. I suggested that, if the
>
> Which one ?
>
> r1000_n.c where #define RELEASE_DATE "2006/02/23"
They didn't say. Just "r1000"
Jeff
^ permalink raw reply
* Re: [PATCH 3/5] ehea: queue management
From: John Rose @ 2006-06-09 18:41 UTC (permalink / raw)
To: Jan-Bernd Themann; +Cc: netdev, Marcus Eder, Christoph Raisch, themann, tklein
In-Reply-To: <4487F421.2050001@de.ibm.com>
Hi-
> +#define EHEA_MEM_START 0xc000000000000000
You probably don't want to hardcode this. Maybe KERNELBASE from page.h?
> +
> +int ehea_reg_mr_adapter(struct ehea_adapter *adapter)
> +{
> + int i;
> + u64 hret;
> + u64 start = EHEA_MEM_START;
> + u64 end = (u64) high_memory;
> + u64 nr_pages = (end - start) / PAGE_SIZE;
> + u32 acc_ctrl = EHEA_MEM_ACC_CTRL;
> +
> + EDEB_EN(7, "adapter=%p", adapter);
> +
> + hret = ehea_h_alloc_resource_mr(adapter->handle,
> + start,
> + end - start,
> + acc_ctrl,
> + adapter->pd,
> + &adapter->mr_handle,
> + &adapter->lkey);
> + if (hret != H_SUCCESS) {
> + EDEB_EX(4, "Error: hret=%lX\n", hret);
> + return -EINVAL;
> + }
> +
> + for (i = 0; i < nr_pages; i++) {
> + hret = ehea_h_register_rpage_mr(adapter->handle,
> + adapter->mr_handle,
> + 0,
> + 0,
> + virt_to_abs(
> + (void *)(((u64) start)
> + + (i * PAGE_SIZE))),
> + 1);
> +
> + if (((hret != H_SUCCESS) && (hret != H_PAGE_REGISTERED))) {
> + ehea_h_free_resource_mr(adapter->handle, adapter->mr_handle);
> + EDEB_EX(4, " register rpage_mr: hret=%lX\n", hret);
> + return -EINVAL;
> + }
> + }
This creates DMA mappings for the entirety of kernel memory, right? Has
this been run by the ppc64 folks for possible impacts?
Thanks-
John
^ permalink raw reply
* Re: [RFT] Realtek 8168 ethernet support
From: Francois Romieu @ 2006-06-09 18:33 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Randy.Dunlap, Daniel Drake, netdev
In-Reply-To: <4488DF85.3090901@garzik.org>
Jeff Garzik <jeff@garzik.org> :
> Randy.Dunlap wrote:
> >Conversely, any reason to use the RealTek r1000 driver?
>
> FWIW, RealTek emailed me about merging r1000. I suggested that, if the
Which one ?
r1000_n.c where #define RELEASE_DATE "2006/02/23"
--
Ueimor
^ permalink raw reply
* [PATCH] ipv6: order addresses by scope
From: Brian Haley @ 2006-06-09 18:14 UTC (permalink / raw)
To: David Miller; +Cc: netdev
[-- Attachment #1: Type: text/plain, Size: 250 bytes --]
If IPv6 addresses are ordered by scope, then ipv6_dev_get_saddr() can
break-out of the device addr_list for() loop when the candidate source
address scope is less than the destination address scope.
Signed-off-by: Brian Haley <brian.haley@hp.com>
[-- Attachment #2: ip6order.patch --]
[-- Type: text/x-patch, Size: 1287 bytes --]
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 445006e..e1d6a6f 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -509,6 +509,25 @@ void inet6_ifa_finish_destroy(struct ine
kfree(ifp);
}
+static void
+ipv6_link_dev_addr(struct inet6_dev *idev, struct inet6_ifaddr *ifp)
+{
+ struct inet6_ifaddr *ifa, **ifap;
+
+ /*
+ * Each device address list is sorted in order of scope -
+ * global before linklocal.
+ */
+ for (ifap = &idev->addr_list; (ifa = *ifap) != NULL;
+ ifap = &ifa->if_next) {
+ if (ifp->scope > ifa->scope)
+ break;
+ }
+
+ ifp->if_next = *ifap;
+ *ifap = ifp;
+}
+
/* On success it returns ifp with increased reference count */
static struct inet6_ifaddr *
@@ -574,8 +593,7 @@ ipv6_add_addr(struct inet6_dev *idev, co
write_lock(&idev->lock);
/* Add to inet6_dev unicast addr list. */
- ifa->if_next = idev->addr_list;
- idev->addr_list = ifa;
+ ipv6_link_dev_addr(idev, ifa);
#ifdef CONFIG_IPV6_PRIVACY
if (ifa->flags&IFA_F_TEMPORARY) {
@@ -982,7 +1000,7 @@ int ipv6_dev_get_saddr(struct net_device
continue;
} else if (score.scope < hiscore.scope) {
if (score.scope < daddr_scope)
- continue;
+ break; /* addresses sorted by scope */
else {
score.rule = 2;
goto record_it;
^ permalink raw reply related
* Re: Using netconsole for debugging suspend/resume
From: Matt Mackall @ 2006-06-09 17:14 UTC (permalink / raw)
To: Andi Kleen; +Cc: David Miller, auke-jan.h.kok, jeremy, linux-kernel, netdev
In-Reply-To: <200606090750.25067.ak@suse.de>
On Fri, Jun 09, 2006 at 07:50:25AM +0200, Andi Kleen wrote:
> On Friday 09 June 2006 07:23, David Miller wrote:
> > From: Auke Kok <auke-jan.h.kok@intel.com>
> > Date: Thu, 08 Jun 2006 22:13:48 -0700
> >
> > > netconsole should retry. There is no timeout programmed here since that might
> > > lose important information, and you rather want netconsole to survive an odd
> > > unplugged cable then to lose vital debugging information when the system is
> > > busy for instance. (losing link will cause the interface to be down and thus
> > > the queue to be stopped)
> >
> > I completely disagree that netpoll should loop when the ethernet
> > cable is plugged out.
>
> Currently it is a bit dumb and doesn't distingush the various cases
> well.
>
> I submitted a patch to loop to be a bit more clever at some point. It can be still
> found in the netdev archives.
Agreed that timeouts should happen.
IIRC, the trouble with your patch was that it a) timed out on far too
short a timescale and b) locked up on my box. Unfortunately, so did my
own patch, which made timeouts approximately 1ms.
--
Mathematics is the supreme nostalgia of our time.
^ permalink raw reply
* Re: Problem authenticating using WPA with bcm43xx-softmac
From: Larry Finger @ 2006-06-09 16:24 UTC (permalink / raw)
To: Johannes Berg; +Cc: netdev
In-Reply-To: <1149867292.3864.30.camel@johannes.berg>
Johannes Berg wrote:
> On Fri, 2006-06-09 at 10:31 -0500, Larry Finger wrote:
>
>> Do you mean a special dump, or is the kernel debug output and wpa_supplicant debug output sufficient?
>
> I was thinking of packet dumps but earlier you said you couldn't create
> any so I'm out of ideas for now.
Actually, I will be able to get packet dumps. The main disk drive in my server, which is a laptop,
died last night. This will be an opportunity to upgrade it to a newer OS that will be able to run my
other Wifi card. Neither one will be able to authenticate, but one can packet dump for the other.
I'll send them when I get the server running again.
Larry
^ permalink raw reply
* r8169: freeze at high speeds
From: Mourad De Clerck @ 2006-06-09 16:03 UTC (permalink / raw)
To: netdev
[-- Attachment #1: Type: text/plain, Size: 1336 bytes --]
Hello,
I have a problem where my machine freezes as soon as I send it data at
high speeds. It works perfectly fine when transferring files slowly
(over the internet for instance). But after sending some data for a few
seconds at relatively high speed (let's say >10MB/sec), the whole
machine just freezes. I've had it happen at relatively low speeds too
(1MB/sec), but it's much less frequent. When I stick to really slow
speeds, I can work without problems for days.
I'm using the latest Debian kernel, which is based on 2.6.16.17 at the
moment.
btw: I tried using ethtool to force it on 100Mbit, but it seems to have
little effect (it stays put on 1000Mbit). Autonegotiation stays "on"
even after trying to switch it off manually.
The machine is a nforce2-based k7 (no SMP). One possibly weird thing is
that my SATA controller and my RT8169 are both on the same PCI card
(behind a PCI bridge) - lspci is attached.
I tried the patch that Francois Romieu posted on 2006-04-18, but it
still locks up. I also tried the r1000 driver from Realtek themselves,
but that one locks up too.
btw2: I do often use nvidia's binary driver, but I made sure it had
never been loaded when testing (fresh reboot, without nvidia.ko ever
being loaded).
Is this a known issue? Can I do anything to track down this bug?
Thank you,
-- Mourad DC
[-- Attachment #2: lspci.txt --]
[-- Type: text/plain, Size: 13649 bytes --]
00:00.0 Host bridge: nVidia Corporation nForce2 AGP (different version?) (rev c1)
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Latency: 0
Region 0: Memory at e0000000 (32-bit, prefetchable) [size=128M]
Capabilities: [40] AGP version 3.0
Status: RQ=32 Iso- ArqSz=2 Cal=0 SBA+ ITACoh- GART64- HTrans- 64bit- FW+ AGP3+ Rate=x4,x8
Command: RQ=1 ArqSz=0 Cal=0 SBA+ AGP+ GART64- 64bit- FW- Rate=x8
Capabilities: [60] HyperTransport: Host or Secondary Interface
Command: WarmRst+ DblEnd-
Link Control: CFlE- CST- CFE- <LkFail- Init+ EOC- TXO- <CRCErr=0
Link Config: MLWI=8bit MLWO=8bit LWI=8bit LWO=8bit
Revision ID: 0.16
00:00.1 RAM memory: nVidia Corporation nForce2 Memory Controller 1 (rev c1)
Subsystem: Holco Enterprise Co, Ltd/Shuttle Computer Unknown device f541
Control: I/O- Mem- BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap- 66MHz+ UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR-
00:00.2 RAM memory: nVidia Corporation nForce2 Memory Controller 4 (rev c1)
Subsystem: Holco Enterprise Co, Ltd/Shuttle Computer Unknown device f541
Control: I/O- Mem- BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap- 66MHz+ UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR-
00:00.3 RAM memory: nVidia Corporation nForce2 Memory Controller 3 (rev c1)
Subsystem: Holco Enterprise Co, Ltd/Shuttle Computer Unknown device f541
Control: I/O- Mem- BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap- 66MHz+ UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR-
00:00.4 RAM memory: nVidia Corporation nForce2 Memory Controller 2 (rev c1)
Subsystem: Holco Enterprise Co, Ltd/Shuttle Computer Unknown device f541
Control: I/O- Mem- BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap- 66MHz+ UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR-
00:00.5 RAM memory: nVidia Corporation nForce2 Memory Controller 5 (rev c1)
Subsystem: Holco Enterprise Co, Ltd/Shuttle Computer Unknown device f541
Control: I/O- Mem- BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap- 66MHz+ UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR-
00:01.0 ISA bridge: nVidia Corporation nForce2 ISA Bridge (rev a4)
Subsystem: Holco Enterprise Co, Ltd/Shuttle Computer Unknown device f541
Control: I/O+ Mem+ BusMaster+ SpecCycle+ MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Latency: 0
Capabilities: [48] HyperTransport: Slave or Primary Interface
Command: BaseUnitID=1 UnitCnt=15 MastHost- DefDir-
Link Control 0: CFlE- CST- CFE- <LkFail- Init+ EOC+ TXO- <CRCErr=0
Link Config 0: MLWI=8bit MLWO=8bit LWI=8bit LWO=8bit
Link Control 1: CFlE- CST- CFE- <LkFail- Init+ EOC- TXO+ <CRCErr=0
Link Config 1: MLWI=8bit MLWO=8bit LWI=8bit LWO=8bit
Revision ID: 0.00
00:01.1 SMBus: nVidia Corporation nForce2 SMBus (MCP) (rev a2)
Subsystem: Holco Enterprise Co, Ltd/Shuttle Computer Unknown device f541
Control: I/O+ Mem- BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Interrupt: pin A routed to IRQ 15
Region 0: I/O ports at dc00 [size=32]
Capabilities: [44] Power Management version 2
Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot+,D3cold+)
Status: D0 PME-Enable- DSel=0 DScale=0 PME-
00:02.0 USB Controller: nVidia Corporation nForce2 USB Controller (rev a4) (prog-if 10 [OHCI])
Subsystem: Holco Enterprise Co, Ltd/Shuttle Computer Unknown device f541
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Latency: 0 (750ns min, 250ns max)
Interrupt: pin A routed to IRQ 201
Region 0: Memory at ed085000 (32-bit, non-prefetchable) [size=4K]
Capabilities: [44] Power Management version 2
Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0+,D1+,D2+,D3hot+,D3cold+)
Status: D0 PME-Enable- DSel=0 DScale=0 PME-
00:02.1 USB Controller: nVidia Corporation nForce2 USB Controller (rev a4) (prog-if 10 [OHCI])
Subsystem: Holco Enterprise Co, Ltd/Shuttle Computer Unknown device f541
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Latency: 0 (750ns min, 250ns max)
Interrupt: pin B routed to IRQ 209
Region 0: Memory at ed081000 (32-bit, non-prefetchable) [size=4K]
Capabilities: [44] Power Management version 2
Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0+,D1+,D2+,D3hot+,D3cold+)
Status: D0 PME-Enable- DSel=0 DScale=0 PME-
00:02.2 USB Controller: nVidia Corporation nForce2 USB Controller (rev a4) (prog-if 20 [EHCI])
Subsystem: Holco Enterprise Co, Ltd/Shuttle Computer Unknown device f541
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Latency: 0 (750ns min, 250ns max)
Interrupt: pin C routed to IRQ 193
Region 0: Memory at ed082000 (32-bit, non-prefetchable) [size=256]
Capabilities: [44] Debug port
Capabilities: [80] Power Management version 2
Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0+,D1+,D2+,D3hot+,D3cold+)
Status: D0 PME-Enable- DSel=0 DScale=0 PME-
00:05.0 Multimedia audio controller: nVidia Corporation nForce Audio Processing Unit (rev a2)
Subsystem: Holco Enterprise Co, Ltd/Shuttle Computer Unknown device f541
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Latency: 0 (250ns min, 3000ns max)
Interrupt: pin A routed to IRQ 12
Region 0: Memory at ed000000 (32-bit, non-prefetchable) [size=512K]
Capabilities: [44] Power Management version 2
Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
Status: D0 PME-Enable- DSel=0 DScale=0 PME-
00:06.0 Multimedia audio controller: nVidia Corporation nForce2 AC97 Audio Controler (MCP) (rev a1)
Subsystem: Holco Enterprise Co, Ltd/Shuttle Computer Unknown device f541
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Latency: 0 (500ns min, 1250ns max)
Interrupt: pin A routed to IRQ 201
Region 0: I/O ports at e000 [size=256]
Region 1: I/O ports at d000 [size=128]
Region 2: Memory at ed086000 (32-bit, non-prefetchable) [size=4K]
Capabilities: [44] Power Management version 2
Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
Status: D0 PME-Enable- DSel=0 DScale=0 PME-
00:08.0 PCI bridge: nVidia Corporation nForce2 External PCI Bridge (rev a3) (prog-if 00 [Normal decode])
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B-
Status: Cap- 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Latency: 0
Bus: primary=00, secondary=01, subordinate=02, sec-latency=32
I/O behind bridge: 0000a000-0000bfff
Memory behind bridge: ec000000-ecffffff
Prefetchable memory behind bridge: 50000000-500fffff
Secondary status: 66MHz- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort+ <SERR- <PERR+
BridgeCtl: Parity- SERR+ NoISA- VGA- MAbort- >Reset- FastB2B-
00:09.0 IDE interface: nVidia Corporation nForce2 IDE (rev a2) (prog-if 8a [Master SecP PriP])
Subsystem: Holco Enterprise Co, Ltd/Shuttle Computer Unknown device f541
Control: I/O+ Mem- BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Latency: 0 (750ns min, 250ns max)
Region 4: I/O ports at f000 [size=16]
Capabilities: [44] Power Management version 2
Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
Status: D0 PME-Enable- DSel=0 DScale=0 PME-
00:0d.0 FireWire (IEEE 1394): nVidia Corporation nForce2 FireWire (IEEE 1394) Controller (rev a3) (prog-if 10 [OHCI])
Subsystem: Holco Enterprise Co, Ltd/Shuttle Computer Unknown device f541
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Latency: 0 (750ns min, 250ns max)
Interrupt: pin A routed to IRQ 193
Region 0: Memory at ed083000 (32-bit, non-prefetchable) [size=2K]
Region 1: Memory at ed084000 (32-bit, non-prefetchable) [size=64]
Capabilities: [44] Power Management version 2
Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0+,D1+,D2+,D3hot+,D3cold+)
Status: D0 PME-Enable- DSel=0 DScale=0 PME+
00:1e.0 PCI bridge: nVidia Corporation nForce2 AGP (rev c1) (prog-if 00 [Normal decode])
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B-
Status: Cap- 66MHz+ UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Latency: 32
Bus: primary=00, secondary=04, subordinate=04, sec-latency=32
Memory behind bridge: e9000000-ebffffff
Prefetchable memory behind bridge: d0000000-dfffffff
Secondary status: 66MHz+ FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort+ <SERR- <PERR-
BridgeCtl: Parity- SERR+ NoISA- VGA+ MAbort- >Reset- FastB2B-
01:06.0 PCI bridge: Hint Corp HB6 Universal PCI-PCI bridge (non-transparent mode) (rev 15) (prog-if 00 [Normal decode])
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B-
Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Latency: 32, Cache Line Size: 32 bytes
Bus: primary=01, secondary=02, subordinate=02, sec-latency=32
I/O behind bridge: 0000a000-0000bfff
Memory behind bridge: ec000000-ecffffff
Prefetchable memory behind bridge: 0000000050000000-0000000050000000
Secondary status: 66MHz- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- <SERR- <PERR-
BridgeCtl: Parity- SERR+ NoISA- VGA- MAbort- >Reset- FastB2B-
Capabilities: [80] Power Management version 2
Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0+,D1+,D2+,D3hot+,D3cold-)
Status: D0 PME-Enable- DSel=0 DScale=0 PME-
Bridge: PM- B3+
Capabilities: [90] #06 [0000]
Capabilities: [a0] Vital Product Data
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8169 Gigabit Ethernet (rev 10)
Subsystem: AFAVLAB Technology Inc Unknown device 8169
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV+ VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Latency: 32 (8000ns min, 16000ns max), Cache Line Size: 64 bytes
Interrupt: pin A routed to IRQ 185
Region 0: I/O ports at a000 [size=256]
Region 1: Memory at ec081000 (32-bit, non-prefetchable) [size=256]
[virtual] Expansion ROM at 50080000 [disabled] [size=64K]
Capabilities: [dc] Power Management version 2
Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=375mA PME(D0-,D1+,D2+,D3hot+,D3cold+)
Status: D0 PME-Enable- DSel=0 DScale=0 PME-
02:01.0 Mass storage controller: Silicon Image, Inc. SiI 3512 [SATALink/SATARaid] Serial ATA Controller (rev 01)
Subsystem: Silicon Image, Inc. SiI 3512 SATALink Controller
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Latency: 32, Cache Line Size: 32 bytes
Interrupt: pin A routed to IRQ 177
Region 0: I/O ports at a400 [size=8]
Region 1: I/O ports at a800 [size=4]
Region 2: I/O ports at ac00 [size=8]
Region 3: I/O ports at b000 [size=4]
Region 4: I/O ports at b400 [size=16]
Region 5: Memory at ec080000 (32-bit, non-prefetchable) [size=512]
[virtual] Expansion ROM at 50000000 [disabled] [size=512K]
Capabilities: [60] Power Management version 2
Flags: PMEClk- DSI+ D1+ D2+ AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
Status: D0 PME-Enable- DSel=0 DScale=2 PME-
04:00.0 VGA compatible controller: nVidia Corporation NV43 [GeForce 6600/GeForce 6600 GT] (rev a2) (prog-if 00 [VGA])
Subsystem: XFX Pine Group Inc. Unknown device 2119
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Latency: 248 (1250ns min, 250ns max)
Interrupt: pin A routed to IRQ 177
Region 0: Memory at e9000000 (32-bit, non-prefetchable) [size=16M]
Region 1: Memory at d0000000 (32-bit, prefetchable) [size=256M]
Region 2: Memory at ea000000 (32-bit, non-prefetchable) [size=16M]
[virtual] Expansion ROM at eb000000 [disabled] [size=128K]
Capabilities: [60] Power Management version 2
Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
Status: D0 PME-Enable- DSel=0 DScale=0 PME-
Capabilities: [44] AGP version 3.0
Status: RQ=256 Iso- ArqSz=0 Cal=3 SBA+ ITACoh- GART64- HTrans- 64bit- FW+ AGP3+ Rate=x4,x8
Command: RQ=32 ArqSz=2 Cal=0 SBA+ AGP+ GART64- 64bit- FW- Rate=x8
[-- Attachment #3: interrupts.txt --]
[-- Type: text/plain, Size: 533 bytes --]
CPU0
0: 524242 IO-APIC-edge timer
1: 10 IO-APIC-edge i8042
8: 4 IO-APIC-edge rtc
9: 0 IO-APIC-level acpi
14: 115 IO-APIC-edge ide0
177: 156100 IO-APIC-level libata, nvidia
185: 7 IO-APIC-level ohci1394, ehci_hcd:usb3
193: 413849 IO-APIC-level ohci_hcd:usb1, NVidia nForce2
201: 151166 IO-APIC-level ohci_hcd:usb2
209: 12184 IO-APIC-level eth0
NMI: 0
LOC: 524242
ERR: 0
MIS: 0
^ permalink raw reply
* Re: Problem authenticating using WPA with bcm43xx-softmac
From: Johannes Berg @ 2006-06-09 15:34 UTC (permalink / raw)
To: Larry Finger; +Cc: Dan Williams, netdev
In-Reply-To: <44899462.6070002@lwfinger.net>
[-- Attachment #1: Type: text/plain, Size: 284 bytes --]
On Fri, 2006-06-09 at 10:31 -0500, Larry Finger wrote:
> Do you mean a special dump, or is the kernel debug output and wpa_supplicant debug output sufficient?
I was thinking of packet dumps but earlier you said you couldn't create
any so I'm out of ideas for now.
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 793 bytes --]
^ permalink raw reply
* Re: Problem authenticating using WPA with bcm43xx-softmac
From: Larry Finger @ 2006-06-09 15:31 UTC (permalink / raw)
To: Johannes Berg; +Cc: Dan Williams, netdev, Jouni Malinen
In-Reply-To: <1149853494.3864.6.camel@johannes.berg>
Johannes Berg wrote:
> On Wed, 2006-06-07 at 13:12 -0500, Larry Finger wrote:
>> but why doesn't it work?
>
> No idea. If we had a dump maybe we could tell :/
Do you mean a special dump, or is the kernel debug output and wpa_supplicant debug output sufficient?
Larry
^ permalink raw reply
* Re: netif_tx_disable vs netif_stop_queue (possible races?)
From: Daniel Drake @ 2006-06-09 15:29 UTC (permalink / raw)
To: Herbert Xu; +Cc: netdev, david-b
In-Reply-To: <E1FoYoi-0001gg-00@gondolin.me.apana.org.au>
Herbert Xu wrote:
> Daniel Drake <dsd@gentoo.org> wrote:
>> More specifically, we're talking about drivers/usb/net/usbnet.c and the
>> usbnet_disconnect() function. The race I am highlighting is that
>> usbnet's hard_start_xmit handler (usbnet_start_xmit) may be running when
>> the disconnect happens.
>>
>> Is this a possible scenario?
>
> It should be safe, if only because of the synchronize_net that occurs
> before a netdev can be freed.
Can I interpret your response as: If the TX queue is disabled in
advance, no hard_start_xmit functions will be running on any CPU after
synchronize_net() has returned?
The synchronize_net() code doesn't make it very clear.
Thanks,
Daniel
^ permalink raw reply
* Re: [patch 6/8] drivers/char/hw_random.c: remove assert()'s
From: Jeff Garzik @ 2006-06-09 14:19 UTC (permalink / raw)
To: akpm; +Cc: netdev, bunk
In-Reply-To: <200606090519.k595JlHj032029@shell0.pdx.osdl.net>
akpm@osdl.org wrote:
> From: Adrian Bunk <bunk@stusta.de>
>
> Remove the assert()'s from drivers/char/hw_random.c since you both needed
> to enable a manual option in the driver source to make them effective and
> they only covered some obviously impossible cases.
>
> Signed-off-by: Adrian Bunk <bunk@stusta.de>
> Signed-off-by: Andrew Morton <akpm@osdl.org>
100% NAK. They are there, obviously, for driver debugging and
development. Just like libata's debug stuff, you certainly have to
enable them manually.
Until this driver goes away (real soon, right?), the debugging facility
should stay.
Jeff
^ permalink raw reply
* [PATCH] ehea: IBM eHEA Ethernet Device Driver - first full release
From: Jan-Bernd Themann @ 2006-06-09 13:02 UTC (permalink / raw)
To: netdev; +Cc: meder, raisch, schickhj, themann, tklein
Hello,
here is the URL for our device driver. It is a tarball containing
a patch set for kernel 2.6.17-rc6. This version should compile
without warning.
http://prdownloads.sourceforge.net/ibmehcad/ehea_EHEA_0005_2.6.17-rc6.tgz?download
Signed-off-by: Jan-Bernd Themann <themann@de.ibm.com>
Changelog-by: Jan-Bernd Themann <themann@de.ibm.com>
Differences to patch set http://www.spinics.net/lists/netdev/msg05889.html
Changelog:
- Added Kconfig and Makefile patch in drivers/net
- Changed tarball to patches instead of .c files
Jan-Bernd
> Patches and new drivers should always go to the mailing
> list...... except for the case where they are too big to
> be posted to the mailing list. For that special case,
> a URL to a patch should be posted.
>
> Jeff
^ permalink raw reply
* Re: [PATCH 2.6.17-rc6-mm1 ] net: RFC 3828-compliant UDP-Lite support
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2006-06-09 13:29 UTC (permalink / raw)
To: gerrit
Cc: davem, jmorris, alan, kuznet, pekkas, kaber, linux-kernel, netdev,
yoshfuji
In-Reply-To: <200606091036.42075.gerrit@erg.abdn.ac.uk>
In article <200606091036.42075.gerrit@erg.abdn.ac.uk> (at Fri, 9 Jun 2006 10:36:41 +0100), Gerrit Renker <gerrit@erg.abdn.ac.uk> says:
> Thank you for your replies and comments, I will be back when the v6 side is ready.
Please fix the following as well.
1. Put your code in net/ipv4, probably as udplite.c, and remove net/udp-lite/.
Similarly, plasse put implementation as net/ipv6/udplite.c.
2. Eliminate any cosmetic changes (space, new-line, coding style etc.);
minimize diffs between udp.c udplite.c
BTW, I cannot find descriptions about fragmentation of
UDP-Lite in the spec. Is it yours?
--
YOSHIFUJI Hideaki @ USAGI Project <yoshfuji@linux-ipv6.org>
GPG-FP : 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA
^ permalink raw reply
* Re: Firewall question
From: Lennart Sorensen @ 2006-06-09 13:12 UTC (permalink / raw)
To: Andi Kleen; +Cc: Alex Davis, netfilter, netdev
In-Reply-To: <200606090543.24401.ak@suse.de>
On Fri, Jun 09, 2006 at 05:43:24AM +0200, Andi Kleen wrote:
> No one out on the internet, but it would be trivial for someone outside
> his house. All his traffic will be on a long unsecured cable.
>
> That is why I would never bridge home ethernet traffic onto a DSL line.
Hmm, traffic sent between his machines would not go over the DSL since
the MAC address doesn't match the DSL modem (I would think so at
least). It would be a mess if the DSL modem tried to forwards all
traffic on an ethernet segment (well it doesn't have the bandwidth for
sure). Maybe I am incorrectly assuming the DSL modem only forwards the
PPPoE traffic being sent at it. I could see broadcast traffic being
forwarded, although arps and such are generally not that interesting.
Len Sorensen
^ permalink raw reply
* Re: [patch 1/8] myri10ge: alpha build fix
From: Brice Goglin @ 2006-06-09 11:46 UTC (permalink / raw)
To: akpm; +Cc: jeff, netdev
In-Reply-To: <200606090519.k595JfxP032014@shell0.pdx.osdl.net>
A similar fix is included in the myri10ge update that Jeff merged into
netdev yesterday.
thanks,
Brice
akpm@osdl.org wrote:
> From: Andrew Morton <akpm@osdl.org>
>
> drivers/net/myri10ge/myri10ge.c: In function 'myri10ge_submit_8rx':
> drivers/net/myri10ge/myri10ge.c:772: error: 'DMA_32BIT_MASK' undeclared (first use in this function)
> drivers/net/myri10ge/myri10ge.c:772: error: (Each undeclared identifier is reported only once
> drivers/net/myri10ge/myri10ge.c:772: error: for each function it appears in.)
> drivers/net/myri10ge/myri10ge.c: In function 'myri10ge_probe':
> drivers/net/myri10ge/myri10ge.c:2607: error: 'DMA_64BIT_MASK' undeclared (first use in this function)
> drivers/net/myri10ge/myri10ge.c:2612: error: 'DMA_32BIT_MASK' undeclared (first use in this function)
>
> Cc: Brice Goglin <brice@myri.com>
> Cc: Jeff Garzik <jeff@garzik.org>
> Signed-off-by: Andrew Morton <akpm@osdl.org>
> ---
>
> drivers/net/myri10ge/myri10ge.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff -puN drivers/net/myri10ge/myri10ge.c~myri10ge-alpha-build-fix drivers/net/myri10ge/myri10ge.c
> --- devel/drivers/net/myri10ge/myri10ge.c~myri10ge-alpha-build-fix 2006-06-03 21:13:30.000000000 -0700
> +++ devel-akpm/drivers/net/myri10ge/myri10ge.c 2006-06-03 21:13:43.000000000 -0700
> @@ -59,6 +59,8 @@
> #include <linux/crc32.h>
> #include <linux/moduleparam.h>
> #include <linux/io.h>
> +#include <linux/dma-mapping.h>
> +
> #include <net/checksum.h>
> #include <asm/byteorder.h>
> #include <asm/io.h>
> _
>
^ 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