Commit 7ec55aac authored by Linus Torvalds's avatar Linus Torvalds

Import 0.99.14s

parent 1f3d6740
VERSION = 0.99 VERSION = 0.99
PATCHLEVEL = 14 PATCHLEVEL = 14
ALPHA = r ALPHA = s
all: Version zImage all: Version zImage
......
...@@ -142,6 +142,7 @@ extern int sys_init_module(); ...@@ -142,6 +142,7 @@ extern int sys_init_module();
extern int sys_delete_module(); extern int sys_delete_module();
extern int sys_get_kernel_syms(); /* 130 */ extern int sys_get_kernel_syms(); /* 130 */
extern int sys_quotactl(); extern int sys_quotactl();
extern int sys_getpgid();
/* /*
* These are system calls that will be removed at some time * These are system calls that will be removed at some time
......
...@@ -137,6 +137,8 @@ ...@@ -137,6 +137,8 @@
#define __NR_init_module 128 #define __NR_init_module 128
#define __NR_delete_module 129 #define __NR_delete_module 129
#define __NR_get_kernel_syms 130 #define __NR_get_kernel_syms 130
#define __NR_quotactl 131
#define __NR_getpgid 132
extern int errno; extern int errno;
......
...@@ -137,7 +137,8 @@ sys_newfstat, sys_uname, sys_iopl, sys_vhangup, sys_idle, sys_vm86, ...@@ -137,7 +137,8 @@ sys_newfstat, sys_uname, sys_iopl, sys_vhangup, sys_idle, sys_vm86,
sys_wait4, sys_swapoff, sys_sysinfo, sys_ipc, sys_fsync, sys_sigreturn, sys_wait4, sys_swapoff, sys_sysinfo, sys_ipc, sys_fsync, sys_sigreturn,
sys_clone, sys_setdomainname, sys_newuname, sys_modify_ldt, sys_clone, sys_setdomainname, sys_newuname, sys_modify_ldt,
sys_adjtimex, sys_mprotect, sys_sigprocmask, sys_create_module, sys_adjtimex, sys_mprotect, sys_sigprocmask, sys_create_module,
sys_init_module, sys_delete_module, sys_get_kernel_syms, sys_quotactl }; sys_init_module, sys_delete_module, sys_get_kernel_syms, sys_quotactl,
sys_getpgid };
/* So we don't have to do any more manual updating.... */ /* So we don't have to do any more manual updating.... */
int NR_syscalls = sizeof(sys_call_table)/sizeof(fn_ptr); int NR_syscalls = sizeof(sys_call_table)/sizeof(fn_ptr);
......
...@@ -490,6 +490,19 @@ asmlinkage int sys_setpgid(pid_t pid, pid_t pgid) ...@@ -490,6 +490,19 @@ asmlinkage int sys_setpgid(pid_t pid, pid_t pgid)
return -ESRCH; return -ESRCH;
} }
asmlinkage int sys_getpgid(pid_t pid)
{
struct task_struct * p;
if (!pid)
pid = current->pid;
for_each_task(p) {
if (p->pid == pid)
return p->pgrp;
}
return -ESRCH;
}
asmlinkage int sys_getpgrp(void) asmlinkage int sys_getpgrp(void)
{ {
return current->pgrp; return current->pgrp;
......
...@@ -238,7 +238,7 @@ arp_send_q(void) ...@@ -238,7 +238,7 @@ arp_send_q(void)
/* Can we now complete this packet? */ /* Can we now complete this packet? */
sti(); sti();
if (skb->arp || !skb->dev->rebuild_header(skb+1, skb->dev)) { if (skb->arp || !skb->dev->rebuild_header(skb->data, skb->dev)) {
skb->arp = 1; skb->arp = 1;
skb->dev->queue_xmit(skb, skb->dev, 0); skb->dev->queue_xmit(skb, skb->dev, 0);
} else { } else {
...@@ -287,8 +287,7 @@ arp_response(struct arphdr *arp1, struct device *dev, int addrtype) ...@@ -287,8 +287,7 @@ arp_response(struct arphdr *arp1, struct device *dev, int addrtype)
skb->len = sizeof(struct arphdr) + (2 * arp1->ar_hln) + skb->len = sizeof(struct arphdr) + (2 * arp1->ar_hln) +
(2 * arp1->ar_pln) + dev->hard_header_len; (2 * arp1->ar_pln) + dev->hard_header_len;
skb->mem_len = sizeof(struct sk_buff) + skb->len; skb->mem_len = sizeof(struct sk_buff) + skb->len;
hlen = dev->hard_header((unsigned char *)(skb+1), dev, hlen = dev->hard_header(skb->data, dev, ETH_P_ARP, src, dst, skb->len);
ETH_P_ARP, src, dst, skb->len);
if (hlen < 0) { if (hlen < 0) {
printk("ARP: cannot create HW frame header for REPLY !\n"); printk("ARP: cannot create HW frame header for REPLY !\n");
kfree_skb(skb, FREE_WRITE); kfree_skb(skb, FREE_WRITE);
...@@ -300,7 +299,7 @@ arp_response(struct arphdr *arp1, struct device *dev, int addrtype) ...@@ -300,7 +299,7 @@ arp_response(struct arphdr *arp1, struct device *dev, int addrtype)
* This looks ugly, but we have to deal with the variable-length * This looks ugly, but we have to deal with the variable-length
* ARP packets and such. It is not as bad as it looks- FvK * ARP packets and such. It is not as bad as it looks- FvK
*/ */
arp2 = (struct arphdr *) ((unsigned char *) (skb+1) + hlen); arp2 = (struct arphdr *) (skb->data + hlen);
ptr2 = ((unsigned char *) &arp2->ar_op) + sizeof(u_short); ptr2 = ((unsigned char *) &arp2->ar_op) + sizeof(u_short);
arp2->ar_hrd = arp1->ar_hrd; arp2->ar_hrd = arp1->ar_hrd;
arp2->ar_pro = arp1->ar_pro; arp2->ar_pro = arp1->ar_pro;
...@@ -617,13 +616,12 @@ arp_send(unsigned long paddr, struct device *dev, unsigned long saddr) ...@@ -617,13 +616,12 @@ arp_send(unsigned long paddr, struct device *dev, unsigned long saddr)
skb->dev = dev; skb->dev = dev;
skb->next = NULL; skb->next = NULL;
skb->free = 1; skb->free = 1;
tmp = dev->hard_header((unsigned char *)(skb+1), dev, tmp = dev->hard_header(skb->data, dev, ETH_P_ARP, 0, saddr, skb->len);
ETH_P_ARP, 0, saddr, skb->len);
if (tmp < 0) { if (tmp < 0) {
kfree_skb(skb,FREE_WRITE); kfree_skb(skb,FREE_WRITE);
return; return;
} }
arp = (struct arphdr *) ((unsigned char *) (skb+1) + tmp); arp = (struct arphdr *) (skb->data + tmp);
arp->ar_hrd = htons(dev->type); arp->ar_hrd = htons(dev->type);
if(dev->type!=3) /* AX.25 */ if(dev->type!=3) /* AX.25 */
arp->ar_pro = htons(ETH_P_IP); arp->ar_pro = htons(ETH_P_IP);
......
...@@ -537,7 +537,7 @@ dev_rint(unsigned char *buff, long len, int flags, struct device *dev) ...@@ -537,7 +537,7 @@ dev_rint(unsigned char *buff, long len, int flags, struct device *dev)
skb->mem_addr = (struct sk_buff *) skb; skb->mem_addr = (struct sk_buff *) skb;
/* First we copy the packet into a buffer, and save it for later. */ /* First we copy the packet into a buffer, and save it for later. */
to = (unsigned char *) (skb + 1); to = skb->data;
left = len; left = len;
len2 = len; len2 = len;
while (len2 > 0) { while (len2 > 0) {
...@@ -614,7 +614,7 @@ inet_bh(void *tmp) ...@@ -614,7 +614,7 @@ inet_bh(void *tmp)
* the MAC header, if any (as indicated by its "length" * the MAC header, if any (as indicated by its "length"
* field). Take care now! * field). Take care now!
*/ */
skb->h.raw = (unsigned char *) (skb + 1) + skb->dev->hard_header_len; skb->h.raw = skb->data + skb->dev->hard_header_len;
skb->len -= skb->dev->hard_header_len; skb->len -= skb->dev->hard_header_len;
/* /*
......
...@@ -168,7 +168,7 @@ eth_add_arp(unsigned long addr, struct sk_buff *skb, struct device *dev) ...@@ -168,7 +168,7 @@ eth_add_arp(unsigned long addr, struct sk_buff *skb, struct device *dev)
{ {
struct ethhdr *eth; struct ethhdr *eth;
eth = (struct ethhdr *) (skb + 1); eth = (struct ethhdr *) skb->data;
arp_add(addr, eth->h_source, dev); arp_add(addr, eth->h_source, dev);
} }
...@@ -179,7 +179,7 @@ eth_type_trans(struct sk_buff *skb, struct device *dev) ...@@ -179,7 +179,7 @@ eth_type_trans(struct sk_buff *skb, struct device *dev)
{ {
struct ethhdr *eth; struct ethhdr *eth;
eth = (struct ethhdr *) (skb + 1); eth = (struct ethhdr *) skb->data;
if(ntohs(eth->h_proto)<1536) if(ntohs(eth->h_proto)<1536)
return(htons(ETH_P_802_3)); return(htons(ETH_P_802_3));
......
...@@ -104,8 +104,7 @@ icmp_send(struct sk_buff *skb_in, int type, int code, struct device *dev) ...@@ -104,8 +104,7 @@ icmp_send(struct sk_buff *skb_in, int type, int code, struct device *dev)
len -= sizeof(struct sk_buff); len -= sizeof(struct sk_buff);
/* Find the IP header. */ /* Find the IP header. */
iph = (struct iphdr *) (skb_in + 1); iph = (struct iphdr *) (skb_in->data + dev->hard_header_len);
iph = (struct iphdr *) ((unsigned char *) iph + dev->hard_header_len);
/* Build Layer 2-3 headers for message back to source. */ /* Build Layer 2-3 headers for message back to source. */
offset = ip_build_header(skb, dev->pa_addr, iph->saddr, offset = ip_build_header(skb, dev->pa_addr, iph->saddr,
...@@ -118,7 +117,7 @@ icmp_send(struct sk_buff *skb_in, int type, int code, struct device *dev) ...@@ -118,7 +117,7 @@ icmp_send(struct sk_buff *skb_in, int type, int code, struct device *dev)
/* Re-adjust length according to actual IP header size. */ /* Re-adjust length according to actual IP header size. */
skb->len = offset + sizeof(struct icmphdr) + sizeof(struct iphdr) + 8; skb->len = offset + sizeof(struct icmphdr) + sizeof(struct iphdr) + 8;
icmph = (struct icmphdr *) ((unsigned char *) (skb + 1) + offset); icmph = (struct icmphdr *) (skb->data + offset);
icmph->type = type; icmph->type = type;
icmph->code = code; icmph->code = code;
icmph->checksum = 0; icmph->checksum = 0;
...@@ -269,7 +268,7 @@ icmp_echo(struct icmphdr *icmph, struct sk_buff *skb, struct device *dev, ...@@ -269,7 +268,7 @@ icmp_echo(struct icmphdr *icmph, struct sk_buff *skb, struct device *dev,
skb2->len = offset + len; skb2->len = offset + len;
/* Build ICMP_ECHO Response message. */ /* Build ICMP_ECHO Response message. */
icmphr = (struct icmphdr *) ((char *) (skb2 + 1) + offset); icmphr = (struct icmphdr *) (skb2->data + offset);
memcpy((char *) icmphr, (char *) icmph, len); memcpy((char *) icmphr, (char *) icmph, len);
icmphr->type = ICMP_ECHOREPLY; icmphr->type = ICMP_ECHOREPLY;
icmphr->code = 0; icmphr->code = 0;
...@@ -333,7 +332,7 @@ icmp_address(struct icmphdr *icmph, struct sk_buff *skb, struct device *dev, ...@@ -333,7 +332,7 @@ icmp_address(struct icmphdr *icmph, struct sk_buff *skb, struct device *dev,
skb2->len = offset + len; skb2->len = offset + len;
/* Build ICMP ADDRESS MASK Response message. */ /* Build ICMP ADDRESS MASK Response message. */
icmphr = (struct icmphdr *) ((char *) (skb2 + 1) + offset); icmphr = (struct icmphdr *) (skb2->data + offset);
icmphr->type = ICMP_ADDRESSREPLY; icmphr->type = ICMP_ADDRESSREPLY;
icmphr->code = 0; icmphr->code = 0;
icmphr->checksum = 0; icmphr->checksum = 0;
......
...@@ -178,7 +178,7 @@ ip_send(struct sk_buff *skb, unsigned long daddr, int len, struct device *dev, ...@@ -178,7 +178,7 @@ ip_send(struct sk_buff *skb, unsigned long daddr, int len, struct device *dev,
unsigned char *ptr; unsigned char *ptr;
int mac; int mac;
ptr = (unsigned char *)(skb + 1); ptr = skb->data;
mac = 0; mac = 0;
skb->arp = 1; skb->arp = 1;
if (dev->hard_header) { if (dev->hard_header) {
...@@ -218,7 +218,7 @@ ip_build_header(struct sk_buff *skb, unsigned long saddr, unsigned long daddr, ...@@ -218,7 +218,7 @@ ip_build_header(struct sk_buff *skb, unsigned long saddr, unsigned long daddr,
" type=%d, opt=%X, len = %d)\n", " type=%d, opt=%X, len = %d)\n",
skb, saddr, daddr, *dev, type, opt, len)); skb, saddr, daddr, *dev, type, opt, len));
buff = (unsigned char *)(skb + 1); buff = skb->data;
/* See if we need to look up the device. */ /* See if we need to look up the device. */
if (*dev == NULL) { if (*dev == NULL) {
...@@ -666,7 +666,7 @@ static struct ipq *ip_create(struct sk_buff *skb, struct iphdr *iph, struct devi ...@@ -666,7 +666,7 @@ static struct ipq *ip_create(struct sk_buff *skb, struct iphdr *iph, struct devi
memset(qp, 0, sizeof(struct ipq)); memset(qp, 0, sizeof(struct ipq));
/* Allocate memory for the MAC header. */ /* Allocate memory for the MAC header. */
maclen = ((unsigned long) iph) - ((unsigned long) (skb + 1)); maclen = ((unsigned long) iph) - ((unsigned long) skb->data);
qp->mac = (unsigned char *) kmalloc(maclen, GFP_ATOMIC); qp->mac = (unsigned char *) kmalloc(maclen, GFP_ATOMIC);
if (qp->mac == NULL) if (qp->mac == NULL)
{ {
...@@ -687,7 +687,7 @@ static struct ipq *ip_create(struct sk_buff *skb, struct iphdr *iph, struct devi ...@@ -687,7 +687,7 @@ static struct ipq *ip_create(struct sk_buff *skb, struct iphdr *iph, struct devi
} }
/* Fill in the structure. */ /* Fill in the structure. */
memcpy(qp->mac, (skb + 1), maclen); memcpy(qp->mac, skb->data, maclen);
memcpy(qp->iph, iph, ihlen + 8); memcpy(qp->iph, iph, ihlen + 8);
qp->len = 0; qp->len = 0;
qp->ihlen = ihlen; qp->ihlen = ihlen;
...@@ -760,7 +760,7 @@ static struct sk_buff *ip_glue(struct ipq *qp) ...@@ -760,7 +760,7 @@ static struct sk_buff *ip_glue(struct ipq *qp)
/* Fill in the basic details. */ /* Fill in the basic details. */
skb->len = (len - qp->maclen); skb->len = (len - qp->maclen);
skb->h.raw = (unsigned char *) (skb + 1); skb->h.raw = skb->data;
skb->free = 1; skb->free = 1;
skb->lock = 1; skb->lock = 1;
...@@ -855,7 +855,7 @@ static struct sk_buff *ip_defrag(struct iphdr *iph, struct sk_buff *skb, struct ...@@ -855,7 +855,7 @@ static struct sk_buff *ip_defrag(struct iphdr *iph, struct sk_buff *skb, struct
end = offset + ntohs(iph->tot_len) - ihl; end = offset + ntohs(iph->tot_len) - ihl;
/* Point into the IP datagram 'data' part. */ /* Point into the IP datagram 'data' part. */
ptr = ((unsigned char *) (skb + 1)) + dev->hard_header_len + ihl; ptr = skb->data + dev->hard_header_len + ihl;
/* Is this the final fragment? */ /* Is this the final fragment? */
if ((flags & IP_MF) == 0) if ((flags & IP_MF) == 0)
...@@ -967,7 +967,7 @@ static struct sk_buff *ip_defrag(struct iphdr *iph, struct sk_buff *skb, struct ...@@ -967,7 +967,7 @@ static struct sk_buff *ip_defrag(struct iphdr *iph, struct sk_buff *skb, struct
int offset; int offset;
/* Point into the IP datagram header. */ /* Point into the IP datagram header. */
raw = (unsigned char *) (skb + 1); raw = skb->data;
iph = (struct iphdr *) (raw + dev->hard_header_len); iph = (struct iphdr *) (raw + dev->hard_header_len);
/* Setup starting values. */ /* Setup starting values. */
...@@ -1026,7 +1026,7 @@ static struct sk_buff *ip_defrag(struct iphdr *iph, struct sk_buff *skb, struct ...@@ -1026,7 +1026,7 @@ static struct sk_buff *ip_defrag(struct iphdr *iph, struct sk_buff *skb, struct
skb2->arp = skb->arp; skb2->arp = skb->arp;
skb2->free = skb->free; skb2->free = skb->free;
skb2->len = len + hlen; skb2->len = len + hlen;
skb2->h.raw=(char *)(skb2+1); skb2->h.raw=(char *) skb2->data;
if (sk) if (sk)
sk->wmem_alloc += skb2->mem_len; sk->wmem_alloc += skb2->mem_len;
...@@ -1155,7 +1155,7 @@ ip_forward(struct sk_buff *skb, struct device *dev, int is_frag) ...@@ -1155,7 +1155,7 @@ ip_forward(struct sk_buff *skb, struct device *dev, int is_frag)
printk("\nIP: No memory available for IP forward\n"); printk("\nIP: No memory available for IP forward\n");
return; return;
} }
ptr = (unsigned char *)(skb2 + 1); ptr = skb2->data;
skb2->sk = NULL; skb2->sk = NULL;
skb2->free = 1; skb2->free = 1;
skb2->len = skb->len + dev2->hard_header_len; skb2->len = skb->len + dev2->hard_header_len;
...@@ -1199,6 +1199,7 @@ ip_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt) ...@@ -1199,6 +1199,7 @@ ip_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt)
DPRINTF((DBG_IP, "<<\n")); DPRINTF((DBG_IP, "<<\n"));
skb->ip_hdr = iph; /* Fragments can cause ICMP errors too! */
/* Is the datagram acceptable? */ /* Is the datagram acceptable? */
if (skb->len<sizeof(struct iphdr) || iph->ihl<5 || iph->version != 4 || ip_fast_csum((unsigned char *)iph, iph->ihl) !=0) { if (skb->len<sizeof(struct iphdr) || iph->ihl<5 || iph->version != 4 || ip_fast_csum((unsigned char *)iph, iph->ihl) !=0) {
DPRINTF((DBG_IP, "\nIP: *** datagram error ***\n")); DPRINTF((DBG_IP, "\nIP: *** datagram error ***\n"));
...@@ -1363,7 +1364,7 @@ ip_queue_xmit(struct sock *sk, struct device *dev, ...@@ -1363,7 +1364,7 @@ ip_queue_xmit(struct sock *sk, struct device *dev,
skb->when = jiffies; skb->when = jiffies;
DPRINTF((DBG_IP, ">>\n")); DPRINTF((DBG_IP, ">>\n"));
ptr = (unsigned char *)(skb + 1); ptr = skb->data;
ptr += dev->hard_header_len; ptr += dev->hard_header_len;
iph = (struct iphdr *)ptr; iph = (struct iphdr *)ptr;
iph->tot_len = ntohs(skb->len-dev->hard_header_len); iph->tot_len = ntohs(skb->len-dev->hard_header_len);
...@@ -1450,7 +1451,7 @@ ip_retransmit(struct sock *sk, int all) ...@@ -1450,7 +1451,7 @@ ip_retransmit(struct sock *sk, int all)
the frame in twice. Because of the technique used this the frame in twice. Because of the technique used this
would be a little sad */ would be a little sad */
if (!skb->arp) { if (!skb->arp) {
if (dev->rebuild_header(skb+1, dev)) { if (dev->rebuild_header(skb->data, dev)) {
sti(); /* Failed to rebuild - next */ sti(); /* Failed to rebuild - next */
if (!all) break; if (!all) break;
skb = (struct sk_buff *)skb->link3; skb = (struct sk_buff *)skb->link3;
......
...@@ -61,7 +61,7 @@ loopback_xmit(struct sk_buff *skb, struct device *dev) ...@@ -61,7 +61,7 @@ loopback_xmit(struct sk_buff *skb, struct device *dev)
dev->tbusy = 1; dev->tbusy = 1;
sti(); sti();
done = dev_rint((unsigned char *)(skb+1), skb->len, 0, dev); done = dev_rint(skb->data, skb->len, 0, dev);
if (skb->free) kfree_skb(skb, FREE_WRITE); if (skb->free) kfree_skb(skb, FREE_WRITE);
while (done != 1) { while (done != 1) {
......
...@@ -131,7 +131,7 @@ packet_sendto(struct sock *sk, unsigned char *from, int len, ...@@ -131,7 +131,7 @@ packet_sendto(struct sock *sk, unsigned char *from, int len,
skb->mem_len = len + sizeof(*skb); skb->mem_len = len + sizeof(*skb);
skb->sk = sk; skb->sk = sk;
skb->free = 1; skb->free = 1;
memcpy_fromfs (skb+1, from, len); memcpy_fromfs(skb->data, from, len);
skb->len = len; skb->len = len;
skb->next = NULL; skb->next = NULL;
if (dev->flags & IFF_UP) dev->queue_xmit(skb, dev, sk->priority); if (dev->flags & IFF_UP) dev->queue_xmit(skb, dev, sk->priority);
...@@ -214,7 +214,7 @@ packet_recvfrom(struct sock *sk, unsigned char *to, int len, ...@@ -214,7 +214,7 @@ packet_recvfrom(struct sock *sk, unsigned char *to, int len,
return err; return err;
copied = min(len, skb->len); copied = min(len, skb->len);
memcpy_tofs(to, skb+1, copied); /* Don't use skb_copy_datagram here: We can't get frag chains */ memcpy_tofs(to, skb->data, copied); /* Don't use skb_copy_datagram here: We can't get frag chains */
/* Copy the address. */ /* Copy the address. */
if (saddr) { if (saddr) {
......
...@@ -227,7 +227,7 @@ raw_sendto(struct sock *sk, unsigned char *from, int len, ...@@ -227,7 +227,7 @@ raw_sendto(struct sock *sk, unsigned char *from, int len,
} }
/* verify_area(VERIFY_WRITE, from, len);*/ /* verify_area(VERIFY_WRITE, from, len);*/
memcpy_fromfs ((unsigned char *)(skb+1)+tmp, from, len); memcpy_fromfs(skb->data + tmp, from, len);
/* If we are using IPPROTO_RAW, we need to fill in the source address in /* If we are using IPPROTO_RAW, we need to fill in the source address in
the IP header */ the IP header */
...@@ -236,7 +236,7 @@ raw_sendto(struct sock *sk, unsigned char *from, int len, ...@@ -236,7 +236,7 @@ raw_sendto(struct sock *sk, unsigned char *from, int len,
unsigned char *buff; unsigned char *buff;
struct iphdr *iph; struct iphdr *iph;
buff = (unsigned char *)(skb + 1); buff = skb->data;
buff += tmp; buff += tmp;
iph = (struct iphdr *)buff; iph = (struct iphdr *)buff;
iph->saddr = sk->saddr; iph->saddr = sk->saddr;
......
...@@ -76,6 +76,8 @@ struct sk_buff { ...@@ -76,6 +76,8 @@ struct sk_buff {
urg_used; urg_used;
unsigned char tries,lock; /* Lock is now unused */ unsigned char tries,lock; /* Lock is now unused */
unsigned short users; /* User count - see datagram.c (and soon seqpacket.c/stream.c) */ unsigned short users; /* User count - see datagram.c (and soon seqpacket.c/stream.c) */
unsigned long padding[0];
unsigned char data[0];
}; };
#define SK_WMEM_MAX 8192 #define SK_WMEM_MAX 8192
......
...@@ -99,6 +99,8 @@ ...@@ -99,6 +99,8 @@
#include <asm/segment.h> #include <asm/segment.h>
#include <linux/mm.h> #include <linux/mm.h>
#define USE_NAGLE
#define SEQ_TICK 3 #define SEQ_TICK 3
unsigned long seq_offset; unsigned long seq_offset;
...@@ -601,7 +603,7 @@ tcp_send_partial(struct sock *sk) ...@@ -601,7 +603,7 @@ tcp_send_partial(struct sock *sk)
skb = sk->send_tmp; skb = sk->send_tmp;
/* If we have queued a header size packet.. */ /* If we have queued a header size packet.. */
if(skb->len-(unsigned long)skb->h.th + (unsigned long)(skb+1)==sizeof(struct tcphdr)) if(skb->len-(unsigned long)skb->h.th + (unsigned long)skb->data == sizeof(struct tcphdr))
{ {
/* If its got a syn or fin its notionally included in the size..*/ /* If its got a syn or fin its notionally included in the size..*/
if(!skb->h.th->syn && !skb->h.th->fin) if(!skb->h.th->syn && !skb->h.th->fin)
...@@ -616,11 +618,11 @@ tcp_send_partial(struct sock *sk) ...@@ -616,11 +618,11 @@ tcp_send_partial(struct sock *sk)
/* We need to complete and send the packet. */ /* We need to complete and send the packet. */
tcp_send_check(skb->h.th, sk->saddr, sk->daddr, tcp_send_check(skb->h.th, sk->saddr, sk->daddr,
skb->len-(unsigned long)skb->h.th + skb->len-(unsigned long)skb->h.th +
(unsigned long)(skb+1), sk); (unsigned long)skb->data, sk);
skb->h.seq = sk->send_seq; skb->h.seq = sk->send_seq;
if (after(sk->send_seq , sk->window_seq) || if (after(sk->send_seq , sk->window_seq) ||
sk->retransmits || (sk->retransmits && sk->timeout == TIME_WRITE) ||
sk->packets_out >= sk->cong_window) { sk->packets_out >= sk->cong_window) {
DPRINTF((DBG_TCP, "sk->cong_window = %d, sk->packets_out = %d\n", DPRINTF((DBG_TCP, "sk->cong_window = %d, sk->packets_out = %d\n",
sk->cong_window, sk->packets_out)); sk->cong_window, sk->packets_out));
...@@ -673,7 +675,7 @@ if (inet_debug == DBG_SLIP) printk("\rtcp_ack: malloc failed\n"); ...@@ -673,7 +675,7 @@ if (inet_debug == DBG_SLIP) printk("\rtcp_ack: malloc failed\n");
buff->mem_len = MAX_ACK_SIZE; buff->mem_len = MAX_ACK_SIZE;
buff->len = sizeof(struct tcphdr); buff->len = sizeof(struct tcphdr);
buff->sk = sk; buff->sk = sk;
t1 =(struct tcphdr *)(buff + 1); t1 =(struct tcphdr *) buff->data;
/* Put in the IP header and routing stuff. */ /* Put in the IP header and routing stuff. */
tmp = sk->prot->build_header(buff, sk->saddr, daddr, &dev, tmp = sk->prot->build_header(buff, sk->saddr, daddr, &dev,
...@@ -846,7 +848,7 @@ tcp_write(struct sock *sk, unsigned char *from, ...@@ -846,7 +848,7 @@ tcp_write(struct sock *sk, unsigned char *from,
skb = sk->send_tmp; skb = sk->send_tmp;
/* IP header + TCP header */ /* IP header + TCP header */
hdrlen = ((unsigned long)skb->h.th - (unsigned long)(skb+1)) hdrlen = ((unsigned long)skb->h.th - (unsigned long)skb->data)
+ sizeof(struct tcphdr); + sizeof(struct tcphdr);
/* If sk->mtu has been changed this could cause problems. */ /* If sk->mtu has been changed this could cause problems. */
...@@ -860,8 +862,7 @@ tcp_write(struct sock *sk, unsigned char *from, ...@@ -860,8 +862,7 @@ tcp_write(struct sock *sk, unsigned char *from,
copy = 0; copy = 0;
} }
memcpy_fromfs((unsigned char *)(skb+1) + skb->len, memcpy_fromfs(skb->data + skb->len, from, copy);
from, copy);
skb->len += copy; skb->len += copy;
from += copy; from += copy;
copied += copy; copied += copy;
...@@ -869,7 +870,7 @@ tcp_write(struct sock *sk, unsigned char *from, ...@@ -869,7 +870,7 @@ tcp_write(struct sock *sk, unsigned char *from,
sk->send_seq += copy; sk->send_seq += copy;
} }
if ((skb->len - hdrlen) > sk->mtu || (flags & MSG_OOB)) { if ((skb->len - hdrlen) >= sk->mtu || (flags & MSG_OOB)) {
tcp_send_partial(sk); tcp_send_partial(sk);
} }
continue; continue;
...@@ -947,7 +948,7 @@ tcp_write(struct sock *sk, unsigned char *from, ...@@ -947,7 +948,7 @@ tcp_write(struct sock *sk, unsigned char *from,
skb->sk = sk; skb->sk = sk;
skb->free = 0; skb->free = 0;
buff =(unsigned char *)(skb+1); buff = skb->data;
/* /*
* FIXME: we need to optimize this. * FIXME: we need to optimize this.
...@@ -996,7 +997,7 @@ tcp_write(struct sock *sk, unsigned char *from, ...@@ -996,7 +997,7 @@ tcp_write(struct sock *sk, unsigned char *from,
skb->h.seq = sk->send_seq; skb->h.seq = sk->send_seq;
if (after(sk->send_seq , sk->window_seq) || if (after(sk->send_seq , sk->window_seq) ||
sk->retransmits || (sk->retransmits && sk->timeout == TIME_WRITE) ||
sk->packets_out >= sk->cong_window) { sk->packets_out >= sk->cong_window) {
DPRINTF((DBG_TCP, "sk->cong_window = %d, sk->packets_out = %d\n", DPRINTF((DBG_TCP, "sk->cong_window = %d, sk->packets_out = %d\n",
sk->cong_window, sk->packets_out)); sk->cong_window, sk->packets_out));
...@@ -1099,7 +1100,7 @@ tcp_read_wakeup(struct sock *sk) ...@@ -1099,7 +1100,7 @@ tcp_read_wakeup(struct sock *sk)
} }
buff->len += tmp; buff->len += tmp;
t1 =(struct tcphdr *)((char *)(buff+1) +tmp); t1 =(struct tcphdr *)(buff->data +tmp);
memcpy(t1,(void *) &sk->dummy_th, sizeof(*t1)); memcpy(t1,(void *) &sk->dummy_th, sizeof(*t1));
t1->seq = ntohl(sk->send_seq); t1->seq = ntohl(sk->send_seq);
...@@ -1562,7 +1563,7 @@ tcp_shutdown(struct sock *sk, int how) ...@@ -1562,7 +1563,7 @@ tcp_shutdown(struct sock *sk, int how)
buff->mem_len = MAX_RESET_SIZE; buff->mem_len = MAX_RESET_SIZE;
buff->sk = sk; buff->sk = sk;
buff->len = sizeof(*t1); buff->len = sizeof(*t1);
t1 =(struct tcphdr *)(buff + 1); t1 =(struct tcphdr *) buff->data;
/* Put in the IP header and routing stuff. */ /* Put in the IP header and routing stuff. */
tmp = prot->build_header(buff,sk->saddr, sk->daddr, &dev, tmp = prot->build_header(buff,sk->saddr, sk->daddr, &dev,
...@@ -1577,7 +1578,7 @@ tcp_shutdown(struct sock *sk, int how) ...@@ -1577,7 +1578,7 @@ tcp_shutdown(struct sock *sk, int how)
} }
t1 =(struct tcphdr *)((char *)t1 +tmp); t1 =(struct tcphdr *)((char *)t1 +tmp);
buff ->len += tmp; buff->len += tmp;
buff->dev = dev; buff->dev = dev;
memcpy(t1, th, sizeof(*t1)); memcpy(t1, th, sizeof(*t1));
t1->seq = ntohl(sk->send_seq); t1->seq = ntohl(sk->send_seq);
...@@ -1673,7 +1674,7 @@ tcp_reset(unsigned long saddr, unsigned long daddr, struct tcphdr *th, ...@@ -1673,7 +1674,7 @@ tcp_reset(unsigned long saddr, unsigned long daddr, struct tcphdr *th,
buff->sk = NULL; buff->sk = NULL;
buff->dev = dev; buff->dev = dev;
t1 =(struct tcphdr *)(buff + 1); t1 =(struct tcphdr *) buff->data;
/* Put in the IP header and routing stuff. */ /* Put in the IP header and routing stuff. */
tmp = prot->build_header(buff, saddr, daddr, &dev, IPPROTO_TCP, opt, tmp = prot->build_header(buff, saddr, daddr, &dev, IPPROTO_TCP, opt,
...@@ -1908,7 +1909,7 @@ tcp_conn_request(struct sock *sk, struct sk_buff *skb, ...@@ -1908,7 +1909,7 @@ tcp_conn_request(struct sock *sk, struct sk_buff *skb,
buff->len = sizeof(struct tcphdr)+4; buff->len = sizeof(struct tcphdr)+4;
buff->sk = newsk; buff->sk = newsk;
t1 =(struct tcphdr *)(buff + 1); t1 =(struct tcphdr *) buff->data;
/* Put in the IP header and routing stuff. */ /* Put in the IP header and routing stuff. */
tmp = sk->prot->build_header(buff, newsk->saddr, newsk->daddr, &dev, tmp = sk->prot->build_header(buff, newsk->saddr, newsk->daddr, &dev,
...@@ -2058,7 +2059,7 @@ tcp_close(struct sock *sk, int timeout) ...@@ -2058,7 +2059,7 @@ tcp_close(struct sock *sk, int timeout)
buff->sk = sk; buff->sk = sk;
buff->free = 1; buff->free = 1;
buff->len = sizeof(*t1); buff->len = sizeof(*t1);
t1 =(struct tcphdr *)(buff + 1); t1 =(struct tcphdr *) buff->data;
/* Put in the IP header and routing stuff. */ /* Put in the IP header and routing stuff. */
tmp = prot->build_header(buff,sk->saddr, sk->daddr, &dev, tmp = prot->build_header(buff,sk->saddr, sk->daddr, &dev,
...@@ -2072,7 +2073,7 @@ tcp_close(struct sock *sk, int timeout) ...@@ -2072,7 +2073,7 @@ tcp_close(struct sock *sk, int timeout)
} }
t1 =(struct tcphdr *)((char *)t1 +tmp); t1 =(struct tcphdr *)((char *)t1 +tmp);
buff ->len += tmp; buff->len += tmp;
buff->dev = dev; buff->dev = dev;
memcpy(t1, th, sizeof(*t1)); memcpy(t1, th, sizeof(*t1));
t1->seq = ntohl(sk->send_seq); t1->seq = ntohl(sk->send_seq);
...@@ -2132,7 +2133,9 @@ tcp_write_xmit(struct sock *sk) ...@@ -2132,7 +2133,9 @@ tcp_write_xmit(struct sock *sk)
while(sk->wfront != NULL && while(sk->wfront != NULL &&
before(sk->wfront->h.seq, sk->window_seq) && before(sk->wfront->h.seq, sk->window_seq) &&
(sk->retransmits == 0 || before(sk->wfront->h.seq, sk->rcv_ack_seq +1)) (sk->retransmits == 0 ||
sk->timeout != TIME_WRITE ||
before(sk->wfront->h.seq, sk->rcv_ack_seq +1))
&& sk->packets_out < sk->cong_window) { && sk->packets_out < sk->cong_window) {
skb = sk->wfront; skb = sk->wfront;
IS_SKB(skb); IS_SKB(skb);
...@@ -2208,6 +2211,9 @@ tcp_ack(struct sock *sk, struct tcphdr *th, unsigned long saddr, int len) ...@@ -2208,6 +2211,9 @@ tcp_ack(struct sock *sk, struct tcphdr *th, unsigned long saddr, int len)
"sk->rcv_ack_seq=%d, sk->window_seq = %d\n", "sk->rcv_ack_seq=%d, sk->window_seq = %d\n",
ack, ntohs(th->window), sk->rcv_ack_seq, sk->window_seq)); ack, ntohs(th->window), sk->rcv_ack_seq, sk->window_seq));
if (sk->retransmits && sk->timeout == TIME_KEEPOPEN)
sk->retransmits = 0;
if (after(ack, sk->send_seq+1) || before(ack, sk->rcv_ack_seq-1)) { if (after(ack, sk->send_seq+1) || before(ack, sk->rcv_ack_seq-1)) {
if (after(ack, sk->send_seq) || if (after(ack, sk->send_seq) ||
(sk->state != TCP_ESTABLISHED && sk->state != TCP_CLOSE_WAIT)) { (sk->state != TCP_ESTABLISHED && sk->state != TCP_CLOSE_WAIT)) {
...@@ -2391,6 +2397,7 @@ tcp_ack(struct sock *sk, struct tcphdr *th, unsigned long saddr, int len) ...@@ -2391,6 +2397,7 @@ tcp_ack(struct sock *sk, struct tcphdr *th, unsigned long saddr, int len)
if (sk->wfront != NULL) { if (sk->wfront != NULL) {
if (after (sk->window_seq, sk->wfront->h.seq) && if (after (sk->window_seq, sk->wfront->h.seq) &&
(sk->retransmits == 0 || (sk->retransmits == 0 ||
sk->timeout != TIME_WRITE ||
before(sk->wfront->h.seq, sk->rcv_ack_seq +1)) before(sk->wfront->h.seq, sk->rcv_ack_seq +1))
&& sk->packets_out < sk->cong_window) { && sk->packets_out < sk->cong_window) {
flag |= 1; flag |= 1;
...@@ -2891,7 +2898,7 @@ tcp_connect(struct sock *sk, struct sockaddr_in *usin, int addr_len) ...@@ -2891,7 +2898,7 @@ tcp_connect(struct sock *sk, struct sockaddr_in *usin, int addr_len)
buff->len = 24; buff->len = 24;
buff->sk = sk; buff->sk = sk;
buff->free = 1; buff->free = 1;
t1 = (struct tcphdr *)(buff + 1); t1 = (struct tcphdr *) buff->data;
/* Put in the IP header and routing stuff. */ /* Put in the IP header and routing stuff. */
/* We need to build the routing stuff fromt the things saved in skb. */ /* We need to build the routing stuff fromt the things saved in skb. */
...@@ -2995,10 +3002,19 @@ tcp_sequence(struct sock *sk, struct tcphdr *th, short len, ...@@ -2995,10 +3002,19 @@ tcp_sequence(struct sock *sk, struct tcphdr *th, short len,
return(0); return(0);
} }
#ifdef undef
/*
* if we do this, we won't respond to keepalive packets, since those
* are slightly out of window, and we have to generate an ack
* a late ack out still not to have a sequence number less than
* one we've seen before. Berkeley doesn't seem to do this, but it's
* always hard to be sure.
*/
/* In case it's just a late ack, let it through. */ /* In case it's just a late ack, let it through. */
if (th->ack && len == (th->doff * 4) && if (th->ack && len == (th->doff * 4) &&
after(th->seq, sk->acked_seq - 32767) && after(th->seq, sk->acked_seq - 32767) &&
!th->fin && !th->syn) return(1); !th->fin && !th->syn) return(1);
#endif
if (!th->rst) { if (!th->rst) {
/* Try to resync things. */ /* Try to resync things. */
...@@ -3159,9 +3175,12 @@ if (inet_debug == DBG_SLIP) printk("\rtcp_rcv: bad checksum\n"); ...@@ -3159,9 +3175,12 @@ if (inet_debug == DBG_SLIP) printk("\rtcp_rcv: bad checksum\n");
case TCP_TIME_WAIT: case TCP_TIME_WAIT:
if (!tcp_sequence(sk, th, len, opt, saddr,dev)) { if (!tcp_sequence(sk, th, len, opt, saddr,dev)) {
if (inet_debug == DBG_SLIP) printk("\rtcp_rcv: not in seq\n"); if (inet_debug == DBG_SLIP) printk("\rtcp_rcv: not in seq\n");
#ifdef undef
/* nice idea, but tcp_sequence already does this. Maybe it shouldn't?? */
if(!th->rst) if(!th->rst)
tcp_send_ack(sk->send_seq, sk->acked_seq, tcp_send_ack(sk->send_seq, sk->acked_seq,
sk, th, saddr); sk, th, saddr);
#endif
kfree_skb(skb, FREE_READ); kfree_skb(skb, FREE_READ);
release_sock(sk); release_sock(sk);
return(0); return(0);
...@@ -3453,7 +3472,7 @@ tcp_write_wakeup(struct sock *sk) ...@@ -3453,7 +3472,7 @@ tcp_write_wakeup(struct sock *sk)
buff->free = 1; buff->free = 1;
buff->sk = sk; buff->sk = sk;
DPRINTF((DBG_TCP, "in tcp_write_wakeup\n")); DPRINTF((DBG_TCP, "in tcp_write_wakeup\n"));
t1 = (struct tcphdr *)(buff + 1); t1 = (struct tcphdr *) buff->data;
/* Put in the IP header and routing stuff. */ /* Put in the IP header and routing stuff. */
tmp = sk->prot->build_header(buff, sk->saddr, sk->daddr, &dev, tmp = sk->prot->build_header(buff, sk->saddr, sk->daddr, &dev,
......
...@@ -244,7 +244,7 @@ udp_send(struct sock *sk, struct sockaddr_in *sin, ...@@ -244,7 +244,7 @@ udp_send(struct sock *sk, struct sockaddr_in *sin,
skb->arp = 0; skb->arp = 0;
/* Now build the IP and MAC header. */ /* Now build the IP and MAC header. */
buff = (unsigned char *) (skb+1); buff = skb->data;
saddr = 0; saddr = 0;
dev = NULL; dev = NULL;
DPRINTF((DBG_UDP, "UDP: >> IP_Header: %X -> %X dev=%X prot=%X len=%d\n", DPRINTF((DBG_UDP, "UDP: >> IP_Header: %X -> %X dev=%X prot=%X len=%d\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment