Re: weird socket refusal by kernel 2.2.11

David S. Miller (davem@redhat.com)
Fri, 13 Aug 1999 09:42:56 -0700


Date: Fri, 13 Aug 1999 22:32:50 +1000 (EST)
From: Jim Woodward <jim@jim.southcom.com.au>

in /var/log/messages i find:

Aug 13 22:12:19 jim inetd[381]: fork: Cannot allocate memory
Aug 13 22:13:09 jim last message repeated 2 times
Aug 13 22:17:24 jim inetd[381]: fork: Cannot allocate memory

...

any ideas?

Known bug, here is the fix, it's in the 2.2.12 pre-patches already:

diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/include/net/tcp.h linux.12p2/include/net/tcp.h
--- linux.vanilla/include/net/tcp.h Tue Aug 10 21:45:41 1999
+++ linux.12p2/include/net/tcp.h Fri Aug 13 14:18:15 1999
@@ -142,7 +142,8 @@
nonagle;

/* And these are ours. */
- __u32 rcv_nxt,snd_nxt;
+ __u32 rcv_nxt, snd_nxt;
+ __u16 window;
struct tcp_func *af_specific;
struct tcp_bind_bucket *tb;
struct tcp_tw_bucket *next_death;
diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/ipv4/tcp_input.c linux.12p2/net/ipv4/tcp_input.c
--- linux.vanilla/net/ipv4/tcp_input.c Tue Aug 10 21:45:41 1999
+++ linux.12p2/net/ipv4/tcp_input.c Fri Aug 13 14:18:15 1999
@@ -1006,7 +1006,8 @@
tcp_tw_reschedule(tw);
}
/* Ack old packets if necessary */
- if (!after(TCP_SKB_CB(skb)->end_seq, tw->rcv_nxt))
+ if (!after(TCP_SKB_CB(skb)->end_seq, tw->rcv_nxt) &&
+ (th->doff * 4) > len)
return TCP_TW_ACK;
return 0;
}
@@ -1067,7 +1068,8 @@
tw->family = sk->family;
tw->reuse = sk->reuse;
tw->rcv_nxt = sk->tp_pinfo.af_tcp.rcv_nxt;
- tw->snd_nxt = sk->tp_pinfo.af_tcp.snd_nxt;
+ tw->snd_nxt = sk->tp_pinfo.af_tcp.snd_nxt;
+ tw->window = tcp_select_window(sk);
tw->af_specific = sk->tp_pinfo.af_tcp.af_specific;

#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/ipv4/tcp_ipv4.c linux.12p2/net/ipv4/tcp_ipv4.c
--- linux.vanilla/net/ipv4/tcp_ipv4.c Tue Aug 10 21:45:41 1999
+++ linux.12p2/net/ipv4/tcp_ipv4.c Fri Aug 13 14:18:15 1999
@@ -5,7 +5,7 @@
*
* Implementation of the Transmission Control Protocol(TCP).
*
- * Version: $Id: tcp_ipv4.c,v 1.175.2.8 1999/08/08 08:43:20 davem Exp $
+ * Version: $Id: tcp_ipv4.c,v 1.175.2.9 1999/08/12 15:34:26 davem Exp $
*
* IPv4 specific functions
*
@@ -1026,7 +1026,7 @@
*
* Assumes that the caller did basic address and flag checks.
*/
-static void tcp_v4_send_ack(struct sk_buff *skb, __u32 seq, __u32 ack)
+static void tcp_v4_send_ack(struct sk_buff *skb, __u32 seq, __u32 ack, __u16 window)
{
struct tcphdr *th = skb->h.th;
struct tcphdr rth;
@@ -1042,6 +1042,8 @@
rth.ack_seq = ack;
rth.ack = 1;

+ rth.window = htons(window);
+
memset(&arg, 0, sizeof arg);
arg.iov[0].iov_base = (unsigned char *)&rth;
arg.iov[0].iov_len = sizeof rth;
@@ -1774,17 +1776,18 @@
do_time_wait:
/* Sorry for the ugly switch. 2.3 will have a better solution. */
switch (tcp_timewait_state_process((struct tcp_tw_bucket *)sk,
- skb, th, skb->len)) {
+ skb, th, skb->len)) {
case TCP_TW_ACK:
- tcp_v4_send_ack(skb, ((struct tcp_tw_bucket *)sk)->snd_nxt,
- ((struct tcp_tw_bucket *)sk)->rcv_nxt);
- break;
+ tcp_v4_send_ack(skb,
+ ((struct tcp_tw_bucket *)sk)->snd_nxt,
+ ((struct tcp_tw_bucket *)sk)->rcv_nxt,
+ ((struct tcp_tw_bucket *)sk)->window);
+ goto discard_it;
case TCP_TW_RST:
goto no_tcp_socket;
default:
goto discard_it;
}
- return 0;
}

static void __tcp_v4_rehash(struct sock *sk)
diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/net/ipv6/tcp_ipv6.c linux.12p2/net/ipv6/tcp_ipv6.c
--- linux.vanilla/net/ipv6/tcp_ipv6.c Tue Aug 10 21:45:41 1999
+++ linux.12p2/net/ipv6/tcp_ipv6.c Fri Aug 13 14:18:15 1999
@@ -5,7 +5,7 @@
* Authors:
* Pedro Roque <roque@di.fc.ul.pt>
*
- * $Id: tcp_ipv6.c,v 1.104.2.6 1999/08/08 08:43:23 davem Exp $
+ * $Id: tcp_ipv6.c,v 1.104.2.7 1999/08/12 15:34:32 davem Exp $
*
* Based on:
* linux/net/ipv4/tcp.c
@@ -1121,7 +1121,7 @@
kfree_skb(buff);
}

-static void tcp_v6_send_ack(struct sk_buff *skb, __u32 seq, __u32 ack)
+static void tcp_v6_send_ack(struct sk_buff *skb, __u32 seq, __u32 ack, __u16 window)
{
struct tcphdr *th = skb->h.th, *t1;
struct sk_buff *buff;
@@ -1144,6 +1144,8 @@
t1->seq = seq;
t1->ack_seq = ack;

+ t1->window = htons(window);
+
buff->csum = csum_partial((char *)t1, sizeof(*t1), 0);

fl.nl_u.ip6_u.daddr = &skb->nh.ipv6h->saddr;
@@ -1461,18 +1463,18 @@

do_time_wait:
switch (tcp_timewait_state_process((struct tcp_tw_bucket *)sk,
- skb, th, skb->len)) {
+ skb, th, skb->len)) {
case TCP_TW_ACK:
- tcp_v6_send_ack(skb, ((struct tcp_tw_bucket *)sk)->snd_nxt,
- ((struct tcp_tw_bucket *)sk)->rcv_nxt);
- break;
+ tcp_v6_send_ack(skb,
+ ((struct tcp_tw_bucket *)sk)->snd_nxt,
+ ((struct tcp_tw_bucket *)sk)->rcv_nxt,
+ ((struct tcp_tw_bucket *)sk)->window);
+ goto discard_it;
case TCP_TW_RST:
goto no_tcp_socket;
default:
goto discard_it;
}
-
- return 0;
}

static int tcp_v6_rebuild_header(struct sock *sk)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/