diff options
author | Roland McGrath <roland@gnu.org> | 2000-02-05 12:24:31 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 2000-02-05 12:24:31 +0000 |
commit | 9f3e44843d354432de49e01a1c954d556c678e20 (patch) | |
tree | 448618f32bbb2be5fbc9b6c999a07d1963649abe /pfinet/linux-src/net/ipv4 | |
parent | 11282e4f068cacd7d08e61c5372b560f4656df87 (diff) |
Merge Linux_2_2_13 -> Linux_2_2_14 changes
Diffstat (limited to 'pfinet/linux-src/net/ipv4')
-rw-r--r-- | pfinet/linux-src/net/ipv4/arp.c | 33 | ||||
-rw-r--r-- | pfinet/linux-src/net/ipv4/devinet.c | 11 | ||||
-rw-r--r-- | pfinet/linux-src/net/ipv4/tcp.c | 43 |
3 files changed, 80 insertions, 7 deletions
diff --git a/pfinet/linux-src/net/ipv4/arp.c b/pfinet/linux-src/net/ipv4/arp.c index 508142d4..a9b60afe 100644 --- a/pfinet/linux-src/net/ipv4/arp.c +++ b/pfinet/linux-src/net/ipv4/arp.c @@ -1,6 +1,6 @@ /* linux/net/inet/arp.c * - * Version: $Id: arp.c,v 1.77.2.1 1999/06/28 10:39:23 davem Exp $ + * Version: $Id: arp.c,v 1.77.2.4 1999/09/23 19:03:36 davem Exp $ * * Copyright (C) 1994 by Florian La Roche * @@ -65,6 +65,8 @@ * clean up the APFDDI & gen. FDDI bits. * Alexey Kuznetsov: new arp state machine; * now it is in net/core/neighbour.c. + * Julian Anastasov: "hidden" flag: hide the + * interface and don't reply for it */ /* RFC1122 Status: @@ -308,10 +310,15 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb) u32 saddr; u8 *dst_ha = NULL; struct device *dev = neigh->dev; + struct device *dev2; + struct in_device *in_dev2; u32 target = *(u32*)neigh->primary_key; int probes = neigh->probes; - if (skb && inet_addr_type(skb->nh.iph->saddr) == RTN_LOCAL) + if (skb && + (dev2 = ip_dev_find(skb->nh.iph->saddr)) != NULL && + (in_dev2 = dev2->ip_ptr) != NULL && + !IN_DEV_HIDDEN(in_dev2)) saddr = skb->nh.iph->saddr; else saddr = inet_select_addr(dev, target, RT_SCOPE_LINK); @@ -653,8 +660,14 @@ int arp_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt) /* Special case: IPv4 duplicate address detection packet (RFC2131) */ if (sip == 0) { + struct device *dev2; + struct in_device *in_dev2; + if (arp->ar_op == __constant_htons(ARPOP_REQUEST) && - inet_addr_type(tip) == RTN_LOCAL) + (dev2 = ip_dev_find(tip)) != NULL && + (dev2 == dev || + ((in_dev2 = dev2->ip_ptr) != NULL && + !IN_DEV_HIDDEN(in_dev2)))) arp_send(ARPOP_REPLY,ETH_P_ARP,tip,dev,tip,sha,dev->dev_addr,dev->dev_addr); goto out; } @@ -668,6 +681,20 @@ int arp_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt) if (addr_type == RTN_LOCAL) { n = neigh_event_ns(&arp_tbl, sha, &sip, dev); if (n) { + if (ipv4_devconf.hidden && + skb->pkt_type != PACKET_HOST) { + struct device *dev2; + struct in_device *in_dev2; + + if ((dev2 = ip_dev_find(tip)) != NULL && + dev2 != dev && + (in_dev2 = dev2->ip_ptr) != NULL && + IN_DEV_HIDDEN(in_dev2)) { + neigh_release(n); + goto out; + } + } + arp_send(ARPOP_REPLY,ETH_P_ARP,sip,dev,tip,sha,dev->dev_addr,sha); neigh_release(n); } diff --git a/pfinet/linux-src/net/ipv4/devinet.c b/pfinet/linux-src/net/ipv4/devinet.c index d980631b..ed3d17c2 100644 --- a/pfinet/linux-src/net/ipv4/devinet.c +++ b/pfinet/linux-src/net/ipv4/devinet.c @@ -718,7 +718,7 @@ u32 inet_select_addr(struct device *dev, u32 dst, int scope) addr = ifa->ifa_local; } endfor_ifa(in_dev); - if (addr || scope >= RT_SCOPE_LINK) + if (addr) return addr; /* Not loopback addresses on loopback should be preferred @@ -730,7 +730,9 @@ u32 inet_select_addr(struct device *dev, u32 dst, int scope) continue; for_primary_ifa(in_dev) { - if (ifa->ifa_scope <= scope) + if (!IN_DEV_HIDDEN(in_dev) && + ifa->ifa_scope <= scope && + ifa->ifa_scope != RT_SCOPE_LINK) return ifa->ifa_local; } endfor_ifa(in_dev); } @@ -983,7 +985,7 @@ int devinet_sysctl_forward(ctl_table *ctl, int write, struct file * filp, static struct devinet_sysctl_table { struct ctl_table_header *sysctl_header; - ctl_table devinet_vars[12]; + ctl_table devinet_vars[13]; ctl_table devinet_dev[2]; ctl_table devinet_conf_dir[2]; ctl_table devinet_proto_dir[2]; @@ -1023,6 +1025,9 @@ static struct devinet_sysctl_table {NET_IPV4_CONF_LOG_MARTIANS, "log_martians", &ipv4_devconf.log_martians, sizeof(int), 0644, NULL, &proc_dointvec}, + {NET_IPV4_CONF_HIDDEN, "hidden", + &ipv4_devconf.hidden, sizeof(int), 0644, NULL, + &proc_dointvec}, {0}}, {{NET_PROTO_CONF_ALL, "all", NULL, 0, 0555, devinet_sysctl.devinet_vars},{0}}, diff --git a/pfinet/linux-src/net/ipv4/tcp.c b/pfinet/linux-src/net/ipv4/tcp.c index 89e1bbbf..cf8cee22 100644 --- a/pfinet/linux-src/net/ipv4/tcp.c +++ b/pfinet/linux-src/net/ipv4/tcp.c @@ -5,7 +5,7 @@ * * Implementation of the Transmission Control Protocol(TCP). * - * Version: $Id: tcp.c,v 1.140.2.4 1999/08/09 03:13:12 davem Exp $ + * Version: $Id: tcp.c,v 1.140.2.5 1999/09/23 19:21:16 davem Exp $ * * Authors: Ross Biro, <bir7@leland.Stanford.Edu> * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> @@ -1817,6 +1817,8 @@ extern void __skb_cb_too_small_for_tcp(int, int); void __init tcp_init(void) { struct sk_buff *skb = NULL; + unsigned long goal; + int order; if(sizeof(struct tcp_skb_cb) > sizeof(skb->cb)) __skb_cb_too_small_for_tcp(sizeof(struct tcp_skb_cb), @@ -1842,4 +1844,43 @@ void __init tcp_init(void) NULL, NULL); if(!tcp_timewait_cachep) panic("tcp_init: Cannot alloc tcp_tw_bucket cache."); + + /* Size and allocate TCP hash tables. */ + goal = num_physpages >> (20 - PAGE_SHIFT); + for (order = 0; (1UL << order) < goal; order++) + ; + do { + tcp_ehash_size = (1UL << order) * PAGE_SIZE / + sizeof(struct sock *); + tcp_ehash = (struct sock **) + __get_free_pages(GFP_ATOMIC, order); + } while (tcp_ehash == NULL && --order >= 0); + + if (!tcp_ehash) + panic("Failed to allocate TCP established hash table\n"); + memset(tcp_ehash, 0, tcp_ehash_size * sizeof(struct sock *)); + + goal = (((1UL << order) * PAGE_SIZE) / sizeof(struct tcp_bind_bucket *)); + if (goal > (64 * 1024)) { + /* Don't size the bind-hash larger than the port + * space, that is just silly. + */ + goal = (((64 * 1024) * sizeof(struct tcp_bind_bucket *)) / PAGE_SIZE); + for (order = 0; (1UL << order) < goal; order++) + ; + } + + do { + tcp_bhash_size = (1UL << order) * PAGE_SIZE / + sizeof(struct tcp_bind_bucket *); + tcp_bhash = (struct tcp_bind_bucket **) + __get_free_pages(GFP_ATOMIC, order); + } while (tcp_bhash == NULL && --order >= 0); + + if (!tcp_bhash) + panic("Failed to allocate TCP bind hash table\n"); + memset(tcp_bhash, 0, tcp_bhash_size * sizeof(struct tcp_bind_bucket *)); + + printk("TCP: Hash tables configured (ehash %d bhash %d)\n", + tcp_ehash_size, tcp_bhash_size); } |