Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
7ec55aac
Commit
7ec55aac
authored
Nov 23, 2007
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Import 0.99.14s
parent
1f3d6740
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
91 additions
and
55 deletions
+91
-55
Makefile
Makefile
+1
-1
include/linux/sys.h
include/linux/sys.h
+1
-0
include/linux/unistd.h
include/linux/unistd.h
+2
-0
kernel/sched.c
kernel/sched.c
+2
-1
kernel/sys.c
kernel/sys.c
+13
-0
net/inet/arp.c
net/inet/arp.c
+5
-7
net/inet/dev.c
net/inet/dev.c
+2
-2
net/inet/eth.c
net/inet/eth.c
+2
-2
net/inet/icmp.c
net/inet/icmp.c
+4
-5
net/inet/ip.c
net/inet/ip.c
+12
-11
net/inet/loopback.c
net/inet/loopback.c
+1
-1
net/inet/packet.c
net/inet/packet.c
+2
-2
net/inet/raw.c
net/inet/raw.c
+2
-2
net/inet/skbuff.h
net/inet/skbuff.h
+2
-0
net/inet/tcp.c
net/inet/tcp.c
+39
-20
net/inet/udp.c
net/inet/udp.c
+1
-1
No files found.
Makefile
View file @
7ec55aac
VERSION
=
0.99
PATCHLEVEL
=
14
ALPHA
=
r
ALPHA
=
s
all
:
Version zImage
...
...
include/linux/sys.h
View file @
7ec55aac
...
...
@@ -142,6 +142,7 @@ extern int sys_init_module();
extern
int
sys_delete_module
();
extern
int
sys_get_kernel_syms
();
/* 130 */
extern
int
sys_quotactl
();
extern
int
sys_getpgid
();
/*
* These are system calls that will be removed at some time
...
...
include/linux/unistd.h
View file @
7ec55aac
...
...
@@ -137,6 +137,8 @@
#define __NR_init_module 128
#define __NR_delete_module 129
#define __NR_get_kernel_syms 130
#define __NR_quotactl 131
#define __NR_getpgid 132
extern
int
errno
;
...
...
kernel/sched.c
View file @
7ec55aac
...
...
@@ -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_clone
,
sys_setdomainname
,
sys_newuname
,
sys_modify_ldt
,
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.... */
int
NR_syscalls
=
sizeof
(
sys_call_table
)
/
sizeof
(
fn_ptr
);
...
...
kernel/sys.c
View file @
7ec55aac
...
...
@@ -490,6 +490,19 @@ asmlinkage int sys_setpgid(pid_t pid, pid_t pgid)
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
)
{
return
current
->
pgrp
;
...
...
net/inet/arp.c
View file @
7ec55aac
...
...
@@ -238,7 +238,7 @@ arp_send_q(void)
/* Can we now complete this packet? */
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
->
dev
->
queue_xmit
(
skb
,
skb
->
dev
,
0
);
}
else
{
...
...
@@ -287,8 +287,7 @@ arp_response(struct arphdr *arp1, struct device *dev, int addrtype)
skb
->
len
=
sizeof
(
struct
arphdr
)
+
(
2
*
arp1
->
ar_hln
)
+
(
2
*
arp1
->
ar_pln
)
+
dev
->
hard_header_len
;
skb
->
mem_len
=
sizeof
(
struct
sk_buff
)
+
skb
->
len
;
hlen
=
dev
->
hard_header
((
unsigned
char
*
)(
skb
+
1
),
dev
,
ETH_P_ARP
,
src
,
dst
,
skb
->
len
);
hlen
=
dev
->
hard_header
(
skb
->
data
,
dev
,
ETH_P_ARP
,
src
,
dst
,
skb
->
len
);
if
(
hlen
<
0
)
{
printk
(
"ARP: cannot create HW frame header for REPLY !
\n
"
);
kfree_skb
(
skb
,
FREE_WRITE
);
...
...
@@ -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
* 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
);
arp2
->
ar_hrd
=
arp1
->
ar_hrd
;
arp2
->
ar_pro
=
arp1
->
ar_pro
;
...
...
@@ -617,13 +616,12 @@ arp_send(unsigned long paddr, struct device *dev, unsigned long saddr)
skb
->
dev
=
dev
;
skb
->
next
=
NULL
;
skb
->
free
=
1
;
tmp
=
dev
->
hard_header
((
unsigned
char
*
)(
skb
+
1
),
dev
,
ETH_P_ARP
,
0
,
saddr
,
skb
->
len
);
tmp
=
dev
->
hard_header
(
skb
->
data
,
dev
,
ETH_P_ARP
,
0
,
saddr
,
skb
->
len
);
if
(
tmp
<
0
)
{
kfree_skb
(
skb
,
FREE_WRITE
);
return
;
}
arp
=
(
struct
arphdr
*
)
(
(
unsigned
char
*
)
(
skb
+
1
)
+
tmp
);
arp
=
(
struct
arphdr
*
)
(
skb
->
data
+
tmp
);
arp
->
ar_hrd
=
htons
(
dev
->
type
);
if
(
dev
->
type
!=
3
)
/* AX.25 */
arp
->
ar_pro
=
htons
(
ETH_P_IP
);
...
...
net/inet/dev.c
View file @
7ec55aac
...
...
@@ -537,7 +537,7 @@ dev_rint(unsigned char *buff, long len, int flags, struct device *dev)
skb
->
mem_addr
=
(
struct
sk_buff
*
)
skb
;
/* First we copy the packet into a buffer, and save it for later. */
to
=
(
unsigned
char
*
)
(
skb
+
1
)
;
to
=
skb
->
data
;
left
=
len
;
len2
=
len
;
while
(
len2
>
0
)
{
...
...
@@ -614,7 +614,7 @@ inet_bh(void *tmp)
* the MAC header, if any (as indicated by its "length"
* 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
;
/*
...
...
net/inet/eth.c
View file @
7ec55aac
...
...
@@ -168,7 +168,7 @@ eth_add_arp(unsigned long addr, struct sk_buff *skb, struct device *dev)
{
struct
ethhdr
*
eth
;
eth
=
(
struct
ethhdr
*
)
(
skb
+
1
)
;
eth
=
(
struct
ethhdr
*
)
skb
->
data
;
arp_add
(
addr
,
eth
->
h_source
,
dev
);
}
...
...
@@ -179,7 +179,7 @@ eth_type_trans(struct sk_buff *skb, struct device *dev)
{
struct
ethhdr
*
eth
;
eth
=
(
struct
ethhdr
*
)
(
skb
+
1
)
;
eth
=
(
struct
ethhdr
*
)
skb
->
data
;
if
(
ntohs
(
eth
->
h_proto
)
<
1536
)
return
(
htons
(
ETH_P_802_3
));
...
...
net/inet/icmp.c
View file @
7ec55aac
...
...
@@ -104,8 +104,7 @@ icmp_send(struct sk_buff *skb_in, int type, int code, struct device *dev)
len
-=
sizeof
(
struct
sk_buff
);
/* Find the IP header. */
iph
=
(
struct
iphdr
*
)
(
skb_in
+
1
);
iph
=
(
struct
iphdr
*
)
((
unsigned
char
*
)
iph
+
dev
->
hard_header_len
);
iph
=
(
struct
iphdr
*
)
(
skb_in
->
data
+
dev
->
hard_header_len
);
/* Build Layer 2-3 headers for message back to source. */
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)
/* Re-adjust length according to actual IP header size. */
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
->
code
=
code
;
icmph
->
checksum
=
0
;
...
...
@@ -269,7 +268,7 @@ icmp_echo(struct icmphdr *icmph, struct sk_buff *skb, struct device *dev,
skb2
->
len
=
offset
+
len
;
/* Build ICMP_ECHO Response message. */
icmphr
=
(
struct
icmphdr
*
)
(
(
char
*
)
(
skb2
+
1
)
+
offset
);
icmphr
=
(
struct
icmphdr
*
)
(
skb2
->
data
+
offset
);
memcpy
((
char
*
)
icmphr
,
(
char
*
)
icmph
,
len
);
icmphr
->
type
=
ICMP_ECHOREPLY
;
icmphr
->
code
=
0
;
...
...
@@ -333,7 +332,7 @@ icmp_address(struct icmphdr *icmph, struct sk_buff *skb, struct device *dev,
skb2
->
len
=
offset
+
len
;
/* Build ICMP ADDRESS MASK Response message. */
icmphr
=
(
struct
icmphdr
*
)
(
(
char
*
)
(
skb2
+
1
)
+
offset
);
icmphr
=
(
struct
icmphdr
*
)
(
skb2
->
data
+
offset
);
icmphr
->
type
=
ICMP_ADDRESSREPLY
;
icmphr
->
code
=
0
;
icmphr
->
checksum
=
0
;
...
...
net/inet/ip.c
View file @
7ec55aac
...
...
@@ -178,7 +178,7 @@ ip_send(struct sk_buff *skb, unsigned long daddr, int len, struct device *dev,
unsigned
char
*
ptr
;
int
mac
;
ptr
=
(
unsigned
char
*
)(
skb
+
1
)
;
ptr
=
skb
->
data
;
mac
=
0
;
skb
->
arp
=
1
;
if
(
dev
->
hard_header
)
{
...
...
@@ -218,7 +218,7 @@ ip_build_header(struct sk_buff *skb, unsigned long saddr, unsigned long daddr,
" type=%d, opt=%X, len = %d)
\n
"
,
skb
,
saddr
,
daddr
,
*
dev
,
type
,
opt
,
len
));
buff
=
(
unsigned
char
*
)(
skb
+
1
)
;
buff
=
skb
->
data
;
/* See if we need to look up the device. */
if
(
*
dev
==
NULL
)
{
...
...
@@ -666,7 +666,7 @@ static struct ipq *ip_create(struct sk_buff *skb, struct iphdr *iph, struct devi
memset
(
qp
,
0
,
sizeof
(
struct
ipq
));
/* 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
);
if
(
qp
->
mac
==
NULL
)
{
...
...
@@ -687,7 +687,7 @@ static struct ipq *ip_create(struct sk_buff *skb, struct iphdr *iph, struct devi
}
/* Fill in the structure. */
memcpy
(
qp
->
mac
,
(
skb
+
1
)
,
maclen
);
memcpy
(
qp
->
mac
,
skb
->
data
,
maclen
);
memcpy
(
qp
->
iph
,
iph
,
ihlen
+
8
);
qp
->
len
=
0
;
qp
->
ihlen
=
ihlen
;
...
...
@@ -760,7 +760,7 @@ static struct sk_buff *ip_glue(struct ipq *qp)
/* Fill in the basic details. */
skb
->
len
=
(
len
-
qp
->
maclen
);
skb
->
h
.
raw
=
(
unsigned
char
*
)
(
skb
+
1
)
;
skb
->
h
.
raw
=
skb
->
data
;
skb
->
free
=
1
;
skb
->
lock
=
1
;
...
...
@@ -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
;
/* 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? */
if
((
flags
&
IP_MF
)
==
0
)
...
...
@@ -967,7 +967,7 @@ static struct sk_buff *ip_defrag(struct iphdr *iph, struct sk_buff *skb, struct
int
offset
;
/* Point into the IP datagram header. */
raw
=
(
unsigned
char
*
)
(
skb
+
1
)
;
raw
=
skb
->
data
;
iph
=
(
struct
iphdr
*
)
(
raw
+
dev
->
hard_header_len
);
/* Setup starting values. */
...
...
@@ -1026,7 +1026,7 @@ static struct sk_buff *ip_defrag(struct iphdr *iph, struct sk_buff *skb, struct
skb2
->
arp
=
skb
->
arp
;
skb2
->
free
=
skb
->
free
;
skb2
->
len
=
len
+
hlen
;
skb2
->
h
.
raw
=
(
char
*
)
(
skb2
+
1
)
;
skb2
->
h
.
raw
=
(
char
*
)
skb2
->
data
;
if
(
sk
)
sk
->
wmem_alloc
+=
skb2
->
mem_len
;
...
...
@@ -1155,7 +1155,7 @@ ip_forward(struct sk_buff *skb, struct device *dev, int is_frag)
printk
(
"
\n
IP: No memory available for IP forward
\n
"
);
return
;
}
ptr
=
(
unsigned
char
*
)(
skb2
+
1
)
;
ptr
=
skb2
->
data
;
skb2
->
sk
=
NULL
;
skb2
->
free
=
1
;
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)
DPRINTF
((
DBG_IP
,
"<<
\n
"
));
skb
->
ip_hdr
=
iph
;
/* Fragments can cause ICMP errors too! */
/* 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
)
{
DPRINTF
((
DBG_IP
,
"
\n
IP: *** datagram error ***
\n
"
));
...
...
@@ -1363,7 +1364,7 @@ ip_queue_xmit(struct sock *sk, struct device *dev,
skb
->
when
=
jiffies
;
DPRINTF
((
DBG_IP
,
">>
\n
"
));
ptr
=
(
unsigned
char
*
)(
skb
+
1
)
;
ptr
=
skb
->
data
;
ptr
+=
dev
->
hard_header_len
;
iph
=
(
struct
iphdr
*
)
ptr
;
iph
->
tot_len
=
ntohs
(
skb
->
len
-
dev
->
hard_header_len
);
...
...
@@ -1450,7 +1451,7 @@ ip_retransmit(struct sock *sk, int all)
the frame in twice. Because of the technique used this
would be a little sad */
if
(
!
skb
->
arp
)
{
if
(
dev
->
rebuild_header
(
skb
+
1
,
dev
))
{
if
(
dev
->
rebuild_header
(
skb
->
data
,
dev
))
{
sti
();
/* Failed to rebuild - next */
if
(
!
all
)
break
;
skb
=
(
struct
sk_buff
*
)
skb
->
link3
;
...
...
net/inet/loopback.c
View file @
7ec55aac
...
...
@@ -61,7 +61,7 @@ loopback_xmit(struct sk_buff *skb, struct device *dev)
dev
->
tbusy
=
1
;
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
);
while
(
done
!=
1
)
{
...
...
net/inet/packet.c
View file @
7ec55aac
...
...
@@ -131,7 +131,7 @@ packet_sendto(struct sock *sk, unsigned char *from, int len,
skb
->
mem_len
=
len
+
sizeof
(
*
skb
);
skb
->
sk
=
sk
;
skb
->
free
=
1
;
memcpy_fromfs
(
skb
+
1
,
from
,
len
);
memcpy_fromfs
(
skb
->
data
,
from
,
len
);
skb
->
len
=
len
;
skb
->
next
=
NULL
;
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,
return
err
;
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. */
if
(
saddr
)
{
...
...
net/inet/raw.c
View file @
7ec55aac
...
...
@@ -227,7 +227,7 @@ raw_sendto(struct sock *sk, unsigned char *from, int 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
the IP header */
...
...
@@ -236,7 +236,7 @@ raw_sendto(struct sock *sk, unsigned char *from, int len,
unsigned
char
*
buff
;
struct
iphdr
*
iph
;
buff
=
(
unsigned
char
*
)(
skb
+
1
)
;
buff
=
skb
->
data
;
buff
+=
tmp
;
iph
=
(
struct
iphdr
*
)
buff
;
iph
->
saddr
=
sk
->
saddr
;
...
...
net/inet/skbuff.h
View file @
7ec55aac
...
...
@@ -76,6 +76,8 @@ struct sk_buff {
urg_used
;
unsigned
char
tries
,
lock
;
/* Lock is now unused */
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
...
...
net/inet/tcp.c
View file @
7ec55aac
...
...
@@ -99,6 +99,8 @@
#include <asm/segment.h>
#include <linux/mm.h>
#define USE_NAGLE
#define SEQ_TICK 3
unsigned
long
seq_offset
;
...
...
@@ -601,7 +603,7 @@ tcp_send_partial(struct sock *sk)
skb
=
sk
->
send_tmp
;
/* 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
(
!
skb
->
h
.
th
->
syn
&&
!
skb
->
h
.
th
->
fin
)
...
...
@@ -616,11 +618,11 @@ tcp_send_partial(struct sock *sk)
/* We need to complete and send the packet. */
tcp_send_check
(
skb
->
h
.
th
,
sk
->
saddr
,
sk
->
daddr
,
skb
->
len
-
(
unsigned
long
)
skb
->
h
.
th
+
(
unsigned
long
)
(
skb
+
1
)
,
sk
);
(
unsigned
long
)
skb
->
data
,
sk
);
skb
->
h
.
seq
=
sk
->
send_seq
;
if
(
after
(
sk
->
send_seq
,
sk
->
window_seq
)
||
sk
->
retransmits
||
(
sk
->
retransmits
&&
sk
->
timeout
==
TIME_WRITE
)
||
sk
->
packets_out
>=
sk
->
cong_window
)
{
DPRINTF
((
DBG_TCP
,
"sk->cong_window = %d, sk->packets_out = %d
\n
"
,
sk
->
cong_window
,
sk
->
packets_out
));
...
...
@@ -673,7 +675,7 @@ if (inet_debug == DBG_SLIP) printk("\rtcp_ack: malloc failed\n");
buff
->
mem_len
=
MAX_ACK_SIZE
;
buff
->
len
=
sizeof
(
struct
tcphdr
);
buff
->
sk
=
sk
;
t1
=
(
struct
tcphdr
*
)
(
buff
+
1
)
;
t1
=
(
struct
tcphdr
*
)
buff
->
data
;
/* Put in the IP header and routing stuff. */
tmp
=
sk
->
prot
->
build_header
(
buff
,
sk
->
saddr
,
daddr
,
&
dev
,
...
...
@@ -846,7 +848,7 @@ tcp_write(struct sock *sk, unsigned char *from,
skb
=
sk
->
send_tmp
;
/* 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
);
/* If sk->mtu has been changed this could cause problems. */
...
...
@@ -860,8 +862,7 @@ tcp_write(struct sock *sk, unsigned char *from,
copy
=
0
;
}
memcpy_fromfs
((
unsigned
char
*
)(
skb
+
1
)
+
skb
->
len
,
from
,
copy
);
memcpy_fromfs
(
skb
->
data
+
skb
->
len
,
from
,
copy
);
skb
->
len
+=
copy
;
from
+=
copy
;
copied
+=
copy
;
...
...
@@ -869,7 +870,7 @@ tcp_write(struct sock *sk, unsigned char *from,
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
);
}
continue
;
...
...
@@ -947,7 +948,7 @@ tcp_write(struct sock *sk, unsigned char *from,
skb
->
sk
=
sk
;
skb
->
free
=
0
;
buff
=
(
unsigned
char
*
)(
skb
+
1
)
;
buff
=
skb
->
data
;
/*
* FIXME: we need to optimize this.
...
...
@@ -996,7 +997,7 @@ tcp_write(struct sock *sk, unsigned char *from,
skb
->
h
.
seq
=
sk
->
send_seq
;
if
(
after
(
sk
->
send_seq
,
sk
->
window_seq
)
||
sk
->
retransmits
||
(
sk
->
retransmits
&&
sk
->
timeout
==
TIME_WRITE
)
||
sk
->
packets_out
>=
sk
->
cong_window
)
{
DPRINTF
((
DBG_TCP
,
"sk->cong_window = %d, sk->packets_out = %d
\n
"
,
sk
->
cong_window
,
sk
->
packets_out
));
...
...
@@ -1099,7 +1100,7 @@ tcp_read_wakeup(struct sock *sk)
}
buff
->
len
+=
tmp
;
t1
=
(
struct
tcphdr
*
)(
(
char
*
)(
buff
+
1
)
+
tmp
);
t1
=
(
struct
tcphdr
*
)(
buff
->
data
+
tmp
);
memcpy
(
t1
,(
void
*
)
&
sk
->
dummy_th
,
sizeof
(
*
t1
));
t1
->
seq
=
ntohl
(
sk
->
send_seq
);
...
...
@@ -1562,7 +1563,7 @@ tcp_shutdown(struct sock *sk, int how)
buff
->
mem_len
=
MAX_RESET_SIZE
;
buff
->
sk
=
sk
;
buff
->
len
=
sizeof
(
*
t1
);
t1
=
(
struct
tcphdr
*
)
(
buff
+
1
)
;
t1
=
(
struct
tcphdr
*
)
buff
->
data
;
/* Put in the IP header and routing stuff. */
tmp
=
prot
->
build_header
(
buff
,
sk
->
saddr
,
sk
->
daddr
,
&
dev
,
...
...
@@ -1577,7 +1578,7 @@ tcp_shutdown(struct sock *sk, int how)
}
t1
=
(
struct
tcphdr
*
)((
char
*
)
t1
+
tmp
);
buff
->
len
+=
tmp
;
buff
->
len
+=
tmp
;
buff
->
dev
=
dev
;
memcpy
(
t1
,
th
,
sizeof
(
*
t1
));
t1
->
seq
=
ntohl
(
sk
->
send_seq
);
...
...
@@ -1673,7 +1674,7 @@ tcp_reset(unsigned long saddr, unsigned long daddr, struct tcphdr *th,
buff
->
sk
=
NULL
;
buff
->
dev
=
dev
;
t1
=
(
struct
tcphdr
*
)
(
buff
+
1
)
;
t1
=
(
struct
tcphdr
*
)
buff
->
data
;
/* Put in the IP header and routing stuff. */
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,
buff
->
len
=
sizeof
(
struct
tcphdr
)
+
4
;
buff
->
sk
=
newsk
;
t1
=
(
struct
tcphdr
*
)
(
buff
+
1
)
;
t1
=
(
struct
tcphdr
*
)
buff
->
data
;
/* Put in the IP header and routing stuff. */
tmp
=
sk
->
prot
->
build_header
(
buff
,
newsk
->
saddr
,
newsk
->
daddr
,
&
dev
,
...
...
@@ -2058,7 +2059,7 @@ tcp_close(struct sock *sk, int timeout)
buff
->
sk
=
sk
;
buff
->
free
=
1
;
buff
->
len
=
sizeof
(
*
t1
);
t1
=
(
struct
tcphdr
*
)
(
buff
+
1
)
;
t1
=
(
struct
tcphdr
*
)
buff
->
data
;
/* Put in the IP header and routing stuff. */
tmp
=
prot
->
build_header
(
buff
,
sk
->
saddr
,
sk
->
daddr
,
&
dev
,
...
...
@@ -2072,7 +2073,7 @@ tcp_close(struct sock *sk, int timeout)
}
t1
=
(
struct
tcphdr
*
)((
char
*
)
t1
+
tmp
);
buff
->
len
+=
tmp
;
buff
->
len
+=
tmp
;
buff
->
dev
=
dev
;
memcpy
(
t1
,
th
,
sizeof
(
*
t1
));
t1
->
seq
=
ntohl
(
sk
->
send_seq
);
...
...
@@ -2132,7 +2133,9 @@ tcp_write_xmit(struct sock *sk)
while
(
sk
->
wfront
!=
NULL
&&
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
)
{
skb
=
sk
->
wfront
;
IS_SKB
(
skb
);
...
...
@@ -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
"
,
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
)
||
(
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)
if
(
sk
->
wfront
!=
NULL
)
{
if
(
after
(
sk
->
window_seq
,
sk
->
wfront
->
h
.
seq
)
&&
(
sk
->
retransmits
==
0
||
sk
->
timeout
!=
TIME_WRITE
||
before
(
sk
->
wfront
->
h
.
seq
,
sk
->
rcv_ack_seq
+
1
))
&&
sk
->
packets_out
<
sk
->
cong_window
)
{
flag
|=
1
;
...
...
@@ -2891,7 +2898,7 @@ tcp_connect(struct sock *sk, struct sockaddr_in *usin, int addr_len)
buff
->
len
=
24
;
buff
->
sk
=
sk
;
buff
->
free
=
1
;
t1
=
(
struct
tcphdr
*
)
(
buff
+
1
)
;
t1
=
(
struct
tcphdr
*
)
buff
->
data
;
/* Put in the IP header and routing stuff. */
/* 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,
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. */
if
(
th
->
ack
&&
len
==
(
th
->
doff
*
4
)
&&
after
(
th
->
seq
,
sk
->
acked_seq
-
32767
)
&&
!
th
->
fin
&&
!
th
->
syn
)
return
(
1
);
#endif
if
(
!
th
->
rst
)
{
/* Try to resync things. */
...
...
@@ -3159,9 +3175,12 @@ if (inet_debug == DBG_SLIP) printk("\rtcp_rcv: bad checksum\n");
case
TCP_TIME_WAIT
:
if
(
!
tcp_sequence
(
sk
,
th
,
len
,
opt
,
saddr
,
dev
))
{
if
(
inet_debug
==
DBG_SLIP
)
printk
(
"
\r
tcp_rcv: not in seq
\n
"
);
#ifdef undef
/* nice idea, but tcp_sequence already does this. Maybe it shouldn't?? */
if
(
!
th
->
rst
)
tcp_send_ack
(
sk
->
send_seq
,
sk
->
acked_seq
,
sk
,
th
,
saddr
);
#endif
kfree_skb
(
skb
,
FREE_READ
);
release_sock
(
sk
);
return
(
0
);
...
...
@@ -3453,7 +3472,7 @@ tcp_write_wakeup(struct sock *sk)
buff
->
free
=
1
;
buff
->
sk
=
sk
;
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. */
tmp
=
sk
->
prot
->
build_header
(
buff
,
sk
->
saddr
,
sk
->
daddr
,
&
dev
,
...
...
net/inet/udp.c
View file @
7ec55aac
...
...
@@ -244,7 +244,7 @@ udp_send(struct sock *sk, struct sockaddr_in *sin,
skb
->
arp
=
0
;
/* Now build the IP and MAC header. */
buff
=
(
unsigned
char
*
)
(
skb
+
1
)
;
buff
=
skb
->
data
;
saddr
=
0
;
dev
=
NULL
;
DPRINTF
((
DBG_UDP
,
"UDP: >> IP_Header: %X -> %X dev=%X prot=%X len=%d
\n
"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment