From 0c3b091b9a7a5184011e75afa7f0206d288ddb06 Mon Sep 17 00:00:00 2001 From: Mirko Lindner Date: Wed, 5 Dec 2007 21:10:02 -0800 Subject: [NIU]: Fix link LED handling. The LED in the current driver will not be controlled correctly. During a link change the carrier of the link is not available and the LED will never turn on. Signed-off-by: David S. Miller --- drivers/net/niu.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/drivers/net/niu.c b/drivers/net/niu.c index 112ab079ce7..abfc61c3a38 100644 --- a/drivers/net/niu.c +++ b/drivers/net/niu.c @@ -1045,6 +1045,7 @@ static int niu_serdes_init(struct niu *np) } static void niu_init_xif(struct niu *); +static void niu_handle_led(struct niu *, int status); static int niu_link_status_common(struct niu *np, int link_up) { @@ -1066,11 +1067,15 @@ static int niu_link_status_common(struct niu *np, int link_up) spin_lock_irqsave(&np->lock, flags); niu_init_xif(np); + niu_handle_led(np, 1); spin_unlock_irqrestore(&np->lock, flags); netif_carrier_on(dev); } else if (netif_carrier_ok(dev) && !link_up) { niuwarn(LINK, "%s: Link is down\n", dev->name); + spin_lock_irqsave(&np->lock, flags); + niu_handle_led(np, 0); + spin_unlock_irqrestore(&np->lock, flags); netif_carrier_off(dev); } @@ -3915,16 +3920,14 @@ static int niu_init_ipp(struct niu *np) return 0; } -static void niu_init_xif_xmac(struct niu *np) +static void niu_handle_led(struct niu *np, int status) { - struct niu_link_config *lp = &np->link_config; u64 val; - val = nr64_mac(XMAC_CONFIG); if ((np->flags & NIU_FLAGS_10G) != 0 && (np->flags & NIU_FLAGS_FIBER) != 0) { - if (netif_carrier_ok(np->dev)) { + if (status) { val |= XMAC_CONFIG_LED_POLARITY; val &= ~XMAC_CONFIG_FORCE_LED_ON; } else { @@ -3933,6 +3936,15 @@ static void niu_init_xif_xmac(struct niu *np) } } + nw64_mac(XMAC_CONFIG, val); +} + +static void niu_init_xif_xmac(struct niu *np) +{ + struct niu_link_config *lp = &np->link_config; + u64 val; + + val = nr64_mac(XMAC_CONFIG); val &= ~XMAC_CONFIG_SEL_POR_CLK_SRC; val |= XMAC_CONFIG_TX_OUTPUT_EN; @@ -4776,6 +4788,8 @@ static int niu_close(struct net_device *dev) niu_free_channels(np); + niu_handle_led(np, 0); + return 0; } -- cgit v1.2.3 From 73afc9069289bdb77cf0c81cb9775dcb63894bbe Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Wed, 5 Dec 2007 21:35:23 -0800 Subject: [BRIDGE]: Section fix. WARNING: vmlinux.o(.init.text+0x204e2): Section mismatch: reference to .exit.text:br_fdb_fini (between 'br_init' and 'br_fdb_init') Signed-off-by: Andrew Morton Signed-off-by: David S. Miller --- net/bridge/br_fdb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c index eb57502bb26..bc40377136a 100644 --- a/net/bridge/br_fdb.c +++ b/net/bridge/br_fdb.c @@ -44,7 +44,7 @@ int __init br_fdb_init(void) return 0; } -void __exit br_fdb_fini(void) +void br_fdb_fini(void) { kmem_cache_destroy(br_fdb_cache); } -- cgit v1.2.3 From ca46f9c834913fc5d5c196d70673375cdaba6b56 Mon Sep 17 00:00:00 2001 From: Mitsuru Chinen Date: Wed, 5 Dec 2007 22:31:47 -0800 Subject: [IPv6] SNMP: Increment OutNoRoutes when connecting to unreachable network IPv6 stack doesn't increment OutNoRoutes counter when IP datagrams is being discarded because no route could be found to transmit them to their destination. IPv6 stack should increment the counter. Incidentally, IPv4 stack increments that counter in such situation. Signed-off-by: Mitsuru Chinen Signed-off-by: David S. Miller --- net/ipv6/ip6_output.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 86e1835ce4e..6338a9c1aa1 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -933,6 +933,8 @@ static int ip6_dst_lookup_tail(struct sock *sk, return 0; out_err_release: + if (err == -ENETUNREACH) + IP6_INC_STATS_BH(NULL, IPSTATS_MIB_OUTNOROUTES); dst_release(*dst); *dst = NULL; return err; -- cgit v1.2.3 From 7f53878dc2618bf7c01e2135bd271ac01bd85dc9 Mon Sep 17 00:00:00 2001 From: Mitsuru Chinen Date: Fri, 7 Dec 2007 01:07:24 -0800 Subject: [IPv4]: Reply net unreachable ICMP message IPv4 stack doesn't reply any ICMP destination unreachable message with net unreachable code when IP detagrams are being discarded because of no route could be found in the forwarding path. Incidentally, IPv6 stack replies such ICMPv6 message in the similar situation. Signed-off-by: Mitsuru Chinen Signed-off-by: David S. Miller --- net/ipv4/route.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/ipv4/route.c b/net/ipv4/route.c index c426dec6d57..79c4b9360a1 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -1252,6 +1252,7 @@ static int ip_error(struct sk_buff *skb) break; case ENETUNREACH: code = ICMP_NET_UNREACH; + IP_INC_STATS_BH(IPSTATS_MIB_INNOROUTES); break; case EACCES: code = ICMP_PKT_FILTERED; @@ -1881,6 +1882,8 @@ no_route: RT_CACHE_STAT_INC(in_no_route); spec_dst = inet_select_addr(dev, 0, RT_SCOPE_UNIVERSE); res.type = RTN_UNREACHABLE; + if (err == -ESRCH) + err = -ENETUNREACH; goto local_input; /* -- cgit v1.2.3 From 56c99d0415e8b778c200f115b198c126243ec351 Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Thu, 6 Dec 2007 02:19:07 -0800 Subject: [IPV4]: Remove prototype of ip_rt_advice ip_rt_advice has been gone, so no need to keep prototype and debug message. Signed-off-by: Denis V. Lunev Signed-off-by: David S. Miller --- include/net/route.h | 1 - net/ipv4/route.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/include/net/route.h b/include/net/route.h index f7ce6259f86..59b0b19205a 100644 --- a/include/net/route.h +++ b/include/net/route.h @@ -109,7 +109,6 @@ struct in_device; extern int ip_rt_init(void); extern void ip_rt_redirect(__be32 old_gw, __be32 dst, __be32 new_gw, __be32 src, struct net_device *dev); -extern void ip_rt_advice(struct rtable **rp, int advice); extern void rt_cache_flush(int how); extern int __ip_route_output_key(struct rtable **, const struct flowi *flp); extern int ip_route_output_key(struct rtable **, struct flowi *flp); diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 79c4b9360a1..d2bc6148a73 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -1161,7 +1161,7 @@ static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst) unsigned hash = rt_hash(rt->fl.fl4_dst, rt->fl.fl4_src, rt->fl.oif); #if RT_CACHE_DEBUG >= 1 - printk(KERN_DEBUG "ip_rt_advice: redirect to " + printk(KERN_DEBUG "ipv4_negative_advice: redirect to " "%u.%u.%u.%u/%02x dropped\n", NIPQUAD(rt->rt_dst), rt->fl.fl4_tos); #endif -- cgit v1.2.3 From f26f7c480555812ca7c4037e0a50fa54afe2cb4a Mon Sep 17 00:00:00 2001 From: Vlad Yasevich Date: Thu, 6 Dec 2007 22:50:27 -0800 Subject: [SCTP]: Add bind hash locking to the migrate code SCTP accept code tries to add a newliy created socket to a bind bucket without holding a lock. On a really busy system, that can causes slab corruptions. Add a lock around this code. Signed-off-by: Vlad Yasevich Signed-off-by: David S. Miller --- net/sctp/socket.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/sctp/socket.c b/net/sctp/socket.c index ff8bc95670e..9f5d7930f54 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c @@ -6325,6 +6325,7 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, struct sctp_endpoint *newep = newsp->ep; struct sk_buff *skb, *tmp; struct sctp_ulpevent *event; + struct sctp_bind_hashbucket *head; int flags = 0; /* Migrate socket buffer sizes and all the socket level options to the @@ -6342,10 +6343,15 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, newsp->hmac = NULL; /* Hook this new socket in to the bind_hash list. */ + head = &sctp_port_hashtable[sctp_phashfn(inet_sk(oldsk)->num)]; + sctp_local_bh_disable(); + sctp_spin_lock(&head->lock); pp = sctp_sk(oldsk)->bind_hash; sk_add_bind_node(newsk, &pp->owner); sctp_sk(newsk)->bind_hash = pp; inet_sk(newsk)->num = inet_sk(oldsk)->num; + sctp_spin_unlock(&head->lock); + sctp_local_bh_enable(); /* Copy the bind_addr list from the original endpoint to the new * endpoint so that we can handle restarts properly -- cgit v1.2.3 From 8e71a11c9f3c09a01fcb445772ffd61b140f2479 Mon Sep 17 00:00:00 2001 From: Vlad Yasevich Date: Thu, 6 Dec 2007 22:50:54 -0800 Subject: [SCTP]: Fix the bind_addr info during migration. During accept/migrate the code attempts to copy the addresses from the parent endpoint to the new endpoint. However, if the parent was bound to a wildcard address, then we end up pointlessly copying all of the current addresses on the system. Signed-off-by: Vlad Yasevich Signed-off-by: David S. Miller --- include/net/sctp/structs.h | 3 +++ net/sctp/bind_addr.c | 26 ++++++++++++++++++++++++++ net/sctp/socket.c | 12 ++---------- 3 files changed, 31 insertions(+), 10 deletions(-) diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index eb3113c38a9..002a00a4e6b 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h @@ -1184,6 +1184,9 @@ int sctp_bind_addr_copy(struct sctp_bind_addr *dest, const struct sctp_bind_addr *src, sctp_scope_t scope, gfp_t gfp, int flags); +int sctp_bind_addr_dup(struct sctp_bind_addr *dest, + const struct sctp_bind_addr *src, + gfp_t gfp); int sctp_add_bind_addr(struct sctp_bind_addr *, union sctp_addr *, __u8 use_as_src, gfp_t gfp); int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *); diff --git a/net/sctp/bind_addr.c b/net/sctp/bind_addr.c index cae95af9a8c..6a7d01091f0 100644 --- a/net/sctp/bind_addr.c +++ b/net/sctp/bind_addr.c @@ -105,6 +105,32 @@ out: return error; } +/* Exactly duplicate the address lists. This is necessary when doing + * peer-offs and accepts. We don't want to put all the current system + * addresses into the endpoint. That's useless. But we do want duplicat + * the list of bound addresses that the older endpoint used. + */ +int sctp_bind_addr_dup(struct sctp_bind_addr *dest, + const struct sctp_bind_addr *src, + gfp_t gfp) +{ + struct sctp_sockaddr_entry *addr; + struct list_head *pos; + int error = 0; + + /* All addresses share the same port. */ + dest->port = src->port; + + list_for_each(pos, &src->address_list) { + addr = list_entry(pos, struct sctp_sockaddr_entry, list); + error = sctp_add_bind_addr(dest, &addr->a, 1, gfp); + if (error < 0) + break; + } + + return error; +} + /* Initialize the SCTP_bind_addr structure for either an endpoint or * an association. */ diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 9f5d7930f54..ea9649ca0b2 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c @@ -6326,7 +6326,6 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, struct sk_buff *skb, *tmp; struct sctp_ulpevent *event; struct sctp_bind_hashbucket *head; - int flags = 0; /* Migrate socket buffer sizes and all the socket level options to the * new socket. @@ -6356,15 +6355,8 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, /* Copy the bind_addr list from the original endpoint to the new * endpoint so that we can handle restarts properly */ - if (PF_INET6 == assoc->base.sk->sk_family) - flags = SCTP_ADDR6_ALLOWED; - if (assoc->peer.ipv4_address) - flags |= SCTP_ADDR4_PEERSUPP; - if (assoc->peer.ipv6_address) - flags |= SCTP_ADDR6_PEERSUPP; - sctp_bind_addr_copy(&newsp->ep->base.bind_addr, - &oldsp->ep->base.bind_addr, - SCTP_SCOPE_GLOBAL, GFP_KERNEL, flags); + sctp_bind_addr_dup(&newsp->ep->base.bind_addr, + &oldsp->ep->base.bind_addr, GFP_KERNEL); /* Move any messages in the old socket's receive queue that are for the * peeled off association to the new socket's receive queue. -- cgit v1.2.3 From e35de02615f97b785dc6f73cba421cea06bcbd10 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Thu, 6 Dec 2007 22:52:16 -0800 Subject: [VLAN]: Lost rtnl_unlock() in vlan_ioctl() The SET_VLAN_NAME_TYPE_CMD command w/o CAP_NET_ADMIN capability doesn't release the rtnl lock. Signed-off-by: Pavel Emelyanov Signed-off-by: David S. Miller --- net/8021q/vlan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index 6567213959c..5b183156307 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c @@ -776,7 +776,7 @@ static int vlan_ioctl_handler(struct net *net, void __user *arg) case SET_VLAN_NAME_TYPE_CMD: err = -EPERM; if (!capable(CAP_NET_ADMIN)) - return -EPERM; + break; if ((args.u.name_type >= 0) && (args.u.name_type < VLAN_NAME_TYPE_HIGHEST)) { vlan_name_type = args.u.name_type; -- cgit v1.2.3 From 4aa9cb320e8081fbaec0c10eb0e077c8ca4d1ad9 Mon Sep 17 00:00:00 2001 From: David Howells Date: Fri, 7 Dec 2007 04:31:47 -0800 Subject: [AF_RXRPC]: Add a missing goto Add a missing goto to error handling in the RXKAD security module for AF_RXRPC. Signed-off-by: David Howells Signed-off-by: David S. Miller --- net/rxrpc/rxkad.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/rxrpc/rxkad.c b/net/rxrpc/rxkad.c index e09a95aa68f..8e69d699383 100644 --- a/net/rxrpc/rxkad.c +++ b/net/rxrpc/rxkad.c @@ -1021,6 +1021,7 @@ static int rxkad_verify_response(struct rxrpc_connection *conn, abort_code = RXKADINCONSISTENCY; if (version != RXKAD_VERSION) + goto protocol_error; abort_code = RXKADTICKETLEN; if (ticket_len < 4 || ticket_len > MAXKRB5TICKETLEN) -- cgit v1.2.3