Skip to content

Commit

Permalink
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Browse files Browse the repository at this point in the history
* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6:
  [NETFILTER] x_table.c: sem2mutex
  [IPV4]: Aggregate route entries with different TOS values
  [TCP]: Mark tcp_*mem[] __read_mostly.
  [TCP]: Set default max buffers from memory pool size
  [SCTP]: Fix up sctp_rcv return value
  [NET]: Take RTNL when unregistering notifier
  [WIRELESS]: Fix config dependencies.
  [NET]: Fill in a 32-bit hole in struct sock on 64-bit platforms.
  [NET]: Ensure device name passed to SO_BINDTODEVICE is NULL terminated.
  [MODULES]: Don't allow statically declared exports
  [BRIDGE]: Unaligned accesses in the ethernet bridge
  • Loading branch information
Linus Torvalds committed Mar 25, 2006
2 parents 368d17e + 9e19bb6 commit b55813a
Show file tree
Hide file tree
Showing 12 changed files with 84 additions and 80 deletions.
1 change: 1 addition & 0 deletions drivers/net/wireless/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ config NET_RADIO

config NET_WIRELESS_RTNETLINK
bool "Wireless Extension API over RtNetlink"
depends on NET_RADIO
---help---
Support the Wireless Extension API over the RtNetlink socket
in addition to the traditional ioctl interface (selected above).
Expand Down
1 change: 1 addition & 0 deletions include/linux/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ void *__symbol_get_gpl(const char *symbol);

/* For every exported symbol, place a struct in the __ksymtab section */
#define __EXPORT_SYMBOL(sym, sec) \
extern typeof(sym) sym; \
__CRC_SYMBOL(sym, sec) \
static const char __kstrtab_##sym[] \
__attribute__((section("__ksymtab_strings"))) \
Expand Down
2 changes: 1 addition & 1 deletion include/net/route.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ extern struct ip_rt_acct *ip_rt_acct;
struct in_device;
extern int ip_rt_init(void);
extern void ip_rt_redirect(u32 old_gw, u32 dst, u32 new_gw,
u32 src, u8 tos, struct net_device *dev);
u32 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);
Expand Down
2 changes: 1 addition & 1 deletion include/net/sock.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ struct sock {
gfp_t sk_allocation;
int sk_sndbuf;
int sk_route_caps;
int sk_rcvlowat;
unsigned long sk_flags;
unsigned long sk_lingertime;
/*
Expand All @@ -230,7 +231,6 @@ struct sock {
unsigned short sk_max_ack_backlog;
__u32 sk_priority;
struct ucred sk_peercred;
int sk_rcvlowat;
long sk_rcvtimeo;
long sk_sndtimeo;
struct sk_filter *sk_filter;
Expand Down
5 changes: 3 additions & 2 deletions net/bridge/br_stp_bpdu.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <linux/llc.h>
#include <net/llc.h>
#include <net/llc_pdu.h>
#include <asm/unaligned.h>

#include "br_private.h"
#include "br_private_stp.h"
Expand Down Expand Up @@ -59,12 +60,12 @@ static inline void br_set_ticks(unsigned char *dest, int j)
{
unsigned long ticks = (STP_HZ * j)/ HZ;

*((__be16 *) dest) = htons(ticks);
put_unaligned(htons(ticks), (__be16 *)dest);
}

static inline int br_get_ticks(const unsigned char *src)
{
unsigned long ticks = ntohs(*(__be16 *)src);
unsigned long ticks = ntohs(get_unaligned((__be16 *)src));

return (ticks * HZ + STP_HZ - 1) / STP_HZ;
}
Expand Down
7 changes: 6 additions & 1 deletion net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,12 @@ int register_netdevice_notifier(struct notifier_block *nb)

int unregister_netdevice_notifier(struct notifier_block *nb)
{
return notifier_chain_unregister(&netdev_chain, nb);
int err;

rtnl_lock();
err = notifier_chain_unregister(&netdev_chain, nb);
rtnl_unlock();
return err;
}

/**
Expand Down
5 changes: 3 additions & 2 deletions net/core/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,9 @@ int sock_setsockopt(struct socket *sock, int level, int optname,
if (!valbool) {
sk->sk_bound_dev_if = 0;
} else {
if (optlen > IFNAMSIZ)
optlen = IFNAMSIZ;
if (optlen > IFNAMSIZ - 1)
optlen = IFNAMSIZ - 1;
memset(devname, 0, sizeof(devname));
if (copy_from_user(devname, optval, optlen)) {
ret = -EFAULT;
break;
Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/icmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ static void icmp_redirect(struct sk_buff *skb)
case ICMP_REDIR_HOST:
case ICMP_REDIR_HOSTTOS:
ip_rt_redirect(skb->nh.iph->saddr, ip, skb->h.icmph->un.gateway,
iph->saddr, iph->tos, skb->dev);
iph->saddr, skb->dev);
break;
}
out:
Expand Down
45 changes: 18 additions & 27 deletions net/ipv4/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
* Robert Olsson : Added rt_cache statistics
* Arnaldo C. Melo : Convert proc stuff to seq_file
* Eric Dumazet : hashed spinlocks and rt_check_expire() fixes.
* Ilia Sotnikov : Ignore TOS on PMTUD and Redirect
* Ilia Sotnikov : Removed TOS from hash calculations
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -247,9 +249,9 @@ static DEFINE_PER_CPU(struct rt_cache_stat, rt_cache_stat);
static int rt_intern_hash(unsigned hash, struct rtable *rth,
struct rtable **res);

static unsigned int rt_hash_code(u32 daddr, u32 saddr, u8 tos)
static unsigned int rt_hash_code(u32 daddr, u32 saddr)
{
return (jhash_3words(daddr, saddr, (u32) tos, rt_hash_rnd)
return (jhash_2words(daddr, saddr, rt_hash_rnd)
& rt_hash_mask);
}

Expand Down Expand Up @@ -1111,16 +1113,14 @@ static void rt_del(unsigned hash, struct rtable *rt)
}

void ip_rt_redirect(u32 old_gw, u32 daddr, u32 new_gw,
u32 saddr, u8 tos, struct net_device *dev)
u32 saddr, struct net_device *dev)
{
int i, k;
struct in_device *in_dev = in_dev_get(dev);
struct rtable *rth, **rthp;
u32 skeys[2] = { saddr, 0 };
int ikeys[2] = { dev->ifindex, 0 };

tos &= IPTOS_RT_MASK;

if (!in_dev)
return;

Expand All @@ -1141,8 +1141,7 @@ void ip_rt_redirect(u32 old_gw, u32 daddr, u32 new_gw,
for (i = 0; i < 2; i++) {
for (k = 0; k < 2; k++) {
unsigned hash = rt_hash_code(daddr,
skeys[i] ^ (ikeys[k] << 5),
tos);
skeys[i] ^ (ikeys[k] << 5));

rthp=&rt_hash_table[hash].chain;

Expand All @@ -1152,7 +1151,6 @@ void ip_rt_redirect(u32 old_gw, u32 daddr, u32 new_gw,

if (rth->fl.fl4_dst != daddr ||
rth->fl.fl4_src != skeys[i] ||
rth->fl.fl4_tos != tos ||
rth->fl.oif != ikeys[k] ||
rth->fl.iif != 0) {
rthp = &rth->u.rt_next;
Expand Down Expand Up @@ -1232,10 +1230,9 @@ void ip_rt_redirect(u32 old_gw, u32 daddr, u32 new_gw,
if (IN_DEV_LOG_MARTIANS(in_dev) && net_ratelimit())
printk(KERN_INFO "Redirect from %u.%u.%u.%u on %s about "
"%u.%u.%u.%u ignored.\n"
" Advised path = %u.%u.%u.%u -> %u.%u.%u.%u, "
"tos %02x\n",
" Advised path = %u.%u.%u.%u -> %u.%u.%u.%u\n",
NIPQUAD(old_gw), dev->name, NIPQUAD(new_gw),
NIPQUAD(saddr), NIPQUAD(daddr), tos);
NIPQUAD(saddr), NIPQUAD(daddr));
#endif
in_dev_put(in_dev);
}
Expand All @@ -1253,8 +1250,7 @@ static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst)
rt->u.dst.expires) {
unsigned hash = rt_hash_code(rt->fl.fl4_dst,
rt->fl.fl4_src ^
(rt->fl.oif << 5),
rt->fl.fl4_tos);
(rt->fl.oif << 5));
#if RT_CACHE_DEBUG >= 1
printk(KERN_DEBUG "ip_rt_advice: redirect to "
"%u.%u.%u.%u/%02x dropped\n",
Expand Down Expand Up @@ -1391,14 +1387,13 @@ unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu)
struct rtable *rth;
u32 skeys[2] = { iph->saddr, 0, };
u32 daddr = iph->daddr;
u8 tos = iph->tos & IPTOS_RT_MASK;
unsigned short est_mtu = 0;

if (ipv4_config.no_pmtu_disc)
return 0;

for (i = 0; i < 2; i++) {
unsigned hash = rt_hash_code(daddr, skeys[i], tos);
unsigned hash = rt_hash_code(daddr, skeys[i]);

rcu_read_lock();
for (rth = rcu_dereference(rt_hash_table[hash].chain); rth;
Expand All @@ -1407,7 +1402,6 @@ unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu)
rth->fl.fl4_src == skeys[i] &&
rth->rt_dst == daddr &&
rth->rt_src == iph->saddr &&
rth->fl.fl4_tos == tos &&
rth->fl.iif == 0 &&
!(dst_metric_locked(&rth->u.dst, RTAX_MTU))) {
unsigned short mtu = new_mtu;
Expand Down Expand Up @@ -1658,7 +1652,7 @@ static int ip_route_input_mc(struct sk_buff *skb, u32 daddr, u32 saddr,
RT_CACHE_STAT_INC(in_slow_mc);

in_dev_put(in_dev);
hash = rt_hash_code(daddr, saddr ^ (dev->ifindex << 5), tos);
hash = rt_hash_code(daddr, saddr ^ (dev->ifindex << 5));
return rt_intern_hash(hash, rth, (struct rtable**) &skb->dst);

e_nobufs:
Expand Down Expand Up @@ -1823,7 +1817,7 @@ static inline int ip_mkroute_input_def(struct sk_buff *skb,
return err;

/* put it into the cache */
hash = rt_hash_code(daddr, saddr ^ (fl->iif << 5), tos);
hash = rt_hash_code(daddr, saddr ^ (fl->iif << 5));
return rt_intern_hash(hash, rth, (struct rtable**)&skb->dst);
}

Expand Down Expand Up @@ -1864,7 +1858,7 @@ static inline int ip_mkroute_input(struct sk_buff *skb,
return err;

/* put it into the cache */
hash = rt_hash_code(daddr, saddr ^ (fl->iif << 5), tos);
hash = rt_hash_code(daddr, saddr ^ (fl->iif << 5));
err = rt_intern_hash(hash, rth, &rtres);
if (err)
return err;
Expand Down Expand Up @@ -2041,7 +2035,7 @@ out: return err;
rth->rt_flags &= ~RTCF_LOCAL;
}
rth->rt_type = res.type;
hash = rt_hash_code(daddr, saddr ^ (fl.iif << 5), tos);
hash = rt_hash_code(daddr, saddr ^ (fl.iif << 5));
err = rt_intern_hash(hash, rth, (struct rtable**)&skb->dst);
goto done;

Expand Down Expand Up @@ -2088,7 +2082,7 @@ int ip_route_input(struct sk_buff *skb, u32 daddr, u32 saddr,
int iif = dev->ifindex;

tos &= IPTOS_RT_MASK;
hash = rt_hash_code(daddr, saddr ^ (iif << 5), tos);
hash = rt_hash_code(daddr, saddr ^ (iif << 5));

rcu_read_lock();
for (rth = rcu_dereference(rt_hash_table[hash].chain); rth;
Expand Down Expand Up @@ -2286,10 +2280,8 @@ static inline int ip_mkroute_output_def(struct rtable **rp,
int err = __mkroute_output(&rth, res, fl, oldflp, dev_out, flags);
unsigned hash;
if (err == 0) {
u32 tos = RT_FL_TOS(oldflp);

hash = rt_hash_code(oldflp->fl4_dst,
oldflp->fl4_src ^ (oldflp->oif << 5), tos);
oldflp->fl4_src ^ (oldflp->oif << 5));
err = rt_intern_hash(hash, rth, rp);
}

Expand All @@ -2304,7 +2296,6 @@ static inline int ip_mkroute_output(struct rtable** rp,
unsigned flags)
{
#ifdef CONFIG_IP_ROUTE_MULTIPATH_CACHED
u32 tos = RT_FL_TOS(oldflp);
unsigned char hop;
unsigned hash;
int err = -EINVAL;
Expand Down Expand Up @@ -2334,7 +2325,7 @@ static inline int ip_mkroute_output(struct rtable** rp,

hash = rt_hash_code(oldflp->fl4_dst,
oldflp->fl4_src ^
(oldflp->oif << 5), tos);
(oldflp->oif << 5));
err = rt_intern_hash(hash, rth, rp);

/* forward hop information to multipath impl. */
Expand Down Expand Up @@ -2563,7 +2554,7 @@ int __ip_route_output_key(struct rtable **rp, const struct flowi *flp)
unsigned hash;
struct rtable *rth;

hash = rt_hash_code(flp->fl4_dst, flp->fl4_src ^ (flp->oif << 5), flp->fl4_tos);
hash = rt_hash_code(flp->fl4_dst, flp->fl4_src ^ (flp->oif << 5));

rcu_read_lock_bh();
for (rth = rcu_dereference(rt_hash_table[hash].chain); rth;
Expand Down
26 changes: 16 additions & 10 deletions net/ipv4/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@
#include <linux/fs.h>
#include <linux/random.h>
#include <linux/bootmem.h>
#include <linux/cache.h>

#include <net/icmp.h>
#include <net/tcp.h>
Expand All @@ -275,9 +276,9 @@ atomic_t tcp_orphan_count = ATOMIC_INIT(0);

EXPORT_SYMBOL_GPL(tcp_orphan_count);

int sysctl_tcp_mem[3];
int sysctl_tcp_wmem[3] = { 4 * 1024, 16 * 1024, 128 * 1024 };
int sysctl_tcp_rmem[3] = { 4 * 1024, 87380, 87380 * 2 };
int sysctl_tcp_mem[3] __read_mostly;
int sysctl_tcp_wmem[3] __read_mostly;
int sysctl_tcp_rmem[3] __read_mostly;

EXPORT_SYMBOL(sysctl_tcp_mem);
EXPORT_SYMBOL(sysctl_tcp_rmem);
Expand Down Expand Up @@ -2081,7 +2082,8 @@ __setup("thash_entries=", set_thash_entries);
void __init tcp_init(void)
{
struct sk_buff *skb = NULL;
int order, i;
unsigned long limit;
int order, i, max_share;

if (sizeof(struct tcp_skb_cb) > sizeof(skb->cb))
__skb_cb_too_small_for_tcp(sizeof(struct tcp_skb_cb),
Expand Down Expand Up @@ -2155,12 +2157,16 @@ void __init tcp_init(void)
sysctl_tcp_mem[1] = 1024 << order;
sysctl_tcp_mem[2] = 1536 << order;

if (order < 3) {
sysctl_tcp_wmem[2] = 64 * 1024;
sysctl_tcp_rmem[0] = PAGE_SIZE;
sysctl_tcp_rmem[1] = 43689;
sysctl_tcp_rmem[2] = 2 * 43689;
}
limit = ((unsigned long)sysctl_tcp_mem[1]) << (PAGE_SHIFT - 7);
max_share = min(4UL*1024*1024, limit);

sysctl_tcp_wmem[0] = SK_STREAM_MEM_QUANTUM;
sysctl_tcp_wmem[1] = 16*1024;
sysctl_tcp_wmem[2] = max(64*1024, max_share);

sysctl_tcp_rmem[0] = SK_STREAM_MEM_QUANTUM;
sysctl_tcp_rmem[1] = 87380;
sysctl_tcp_rmem[2] = max(87380, max_share);

printk(KERN_INFO "TCP: Hash tables configured "
"(established %d bind %d)\n",
Expand Down
Loading

0 comments on commit b55813a

Please sign in to comment.