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
b97edd05
Commit
b97edd05
authored
Oct 26, 2003
by
Hideaki Yoshifuji
Committed by
David S. Miller
Oct 26, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[IPV4,6]: Use common storage for cork'd flow, needed to handle mapped-ipv4 ipv6 addresses properly.
parent
e8b06d94
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
27 deletions
+25
-27
include/linux/ip.h
include/linux/ip.h
+2
-0
include/linux/ipv6.h
include/linux/ipv6.h
+0
-2
include/linux/udp.h
include/linux/udp.h
+1
-5
net/ipv4/udp.c
net/ipv4/udp.c
+11
-9
net/ipv6/ip6_output.c
net/ipv6/ip6_output.c
+5
-4
net/ipv6/udp.c
net/ipv6/udp.c
+6
-7
No files found.
include/linux/ip.h
View file @
b97edd05
...
@@ -83,6 +83,7 @@
...
@@ -83,6 +83,7 @@
#include <linux/types.h>
#include <linux/types.h>
#include <net/sock.h>
#include <net/sock.h>
#include <linux/igmp.h>
#include <linux/igmp.h>
#include <net/flow.h>
struct
ip_options
{
struct
ip_options
{
__u32
faddr
;
/* Saved first hop address */
__u32
faddr
;
/* Saved first hop address */
...
@@ -141,6 +142,7 @@ struct inet_opt {
...
@@ -141,6 +142,7 @@ struct inet_opt {
struct
rtable
*
rt
;
struct
rtable
*
rt
;
int
length
;
/* Total length of all frames */
int
length
;
/* Total length of all frames */
u32
addr
;
u32
addr
;
struct
flowi
fl
;
}
cork
;
}
cork
;
};
};
...
...
include/linux/ipv6.h
View file @
b97edd05
...
@@ -174,7 +174,6 @@ enum {
...
@@ -174,7 +174,6 @@ enum {
#include <net/if_inet6.h>
/* struct ipv6_mc_socklist */
#include <net/if_inet6.h>
/* struct ipv6_mc_socklist */
#include <linux/tcp.h>
#include <linux/tcp.h>
#include <linux/udp.h>
#include <linux/udp.h>
#include <net/flow.h>
/*
/*
This structure contains results of exthdrs parsing
This structure contains results of exthdrs parsing
...
@@ -235,7 +234,6 @@ struct ipv6_pinfo {
...
@@ -235,7 +234,6 @@ struct ipv6_pinfo {
struct
{
struct
{
struct
ipv6_txoptions
*
opt
;
struct
ipv6_txoptions
*
opt
;
struct
rt6_info
*
rt
;
struct
rt6_info
*
rt
;
struct
flowi
fl
;
int
hop_limit
;
int
hop_limit
;
}
cork
;
}
cork
;
};
};
...
...
include/linux/udp.h
View file @
b97edd05
...
@@ -44,13 +44,9 @@ struct udp_opt {
...
@@ -44,13 +44,9 @@ struct udp_opt {
unsigned
int
corkflag
;
/* Cork is required */
unsigned
int
corkflag
;
/* Cork is required */
__u16
encap_type
;
/* Is this an Encapsulation socket? */
__u16
encap_type
;
/* Is this an Encapsulation socket? */
/*
/*
* Following member
s
retains the infomation to create a UDP header
* Following member retains the infomation to create a UDP header
* when the socket is uncorked.
* when the socket is uncorked.
*/
*/
u32
saddr
;
/* source address */
u32
daddr
;
/* destination address */
__u16
sport
;
/* source port */
__u16
dport
;
/* destination port */
__u16
len
;
/* total length of pending frames */
__u16
len
;
/* total length of pending frames */
};
};
...
...
net/ipv4/udp.c
View file @
b97edd05
...
@@ -398,6 +398,8 @@ static void udp_flush_pending_frames(struct sock *sk)
...
@@ -398,6 +398,8 @@ static void udp_flush_pending_frames(struct sock *sk)
*/
*/
static
int
udp_push_pending_frames
(
struct
sock
*
sk
,
struct
udp_opt
*
up
)
static
int
udp_push_pending_frames
(
struct
sock
*
sk
,
struct
udp_opt
*
up
)
{
{
struct
inet_opt
*
inet
=
inet_sk
(
sk
);
struct
flowi
*
fl
=
&
inet
->
cork
.
fl
;
struct
sk_buff
*
skb
;
struct
sk_buff
*
skb
;
struct
udphdr
*
uh
;
struct
udphdr
*
uh
;
int
err
=
0
;
int
err
=
0
;
...
@@ -410,8 +412,8 @@ static int udp_push_pending_frames(struct sock *sk, struct udp_opt *up)
...
@@ -410,8 +412,8 @@ static int udp_push_pending_frames(struct sock *sk, struct udp_opt *up)
* Create a UDP header
* Create a UDP header
*/
*/
uh
=
skb
->
h
.
uh
;
uh
=
skb
->
h
.
uh
;
uh
->
source
=
up
->
sport
;
uh
->
source
=
fl
->
fl_ip_
sport
;
uh
->
dest
=
up
->
dport
;
uh
->
dest
=
fl
->
fl_ip_
dport
;
uh
->
len
=
htons
(
up
->
len
);
uh
->
len
=
htons
(
up
->
len
);
uh
->
check
=
0
;
uh
->
check
=
0
;
...
@@ -426,12 +428,12 @@ static int udp_push_pending_frames(struct sock *sk, struct udp_opt *up)
...
@@ -426,12 +428,12 @@ static int udp_push_pending_frames(struct sock *sk, struct udp_opt *up)
*/
*/
if
(
skb
->
ip_summed
==
CHECKSUM_HW
)
{
if
(
skb
->
ip_summed
==
CHECKSUM_HW
)
{
skb
->
csum
=
offsetof
(
struct
udphdr
,
check
);
skb
->
csum
=
offsetof
(
struct
udphdr
,
check
);
uh
->
check
=
~
csum_tcpudp_magic
(
up
->
saddr
,
up
->
daddr
,
uh
->
check
=
~
csum_tcpudp_magic
(
fl
->
fl4_src
,
fl
->
fl4_dst
,
up
->
len
,
IPPROTO_UDP
,
0
);
up
->
len
,
IPPROTO_UDP
,
0
);
}
else
{
}
else
{
skb
->
csum
=
csum_partial
((
char
*
)
uh
,
skb
->
csum
=
csum_partial
((
char
*
)
uh
,
sizeof
(
struct
udphdr
),
skb
->
csum
);
sizeof
(
struct
udphdr
),
skb
->
csum
);
uh
->
check
=
csum_tcpudp_magic
(
up
->
saddr
,
up
->
daddr
,
uh
->
check
=
csum_tcpudp_magic
(
fl
->
fl4_src
,
fl
->
fl4_dst
,
up
->
len
,
IPPROTO_UDP
,
skb
->
csum
);
up
->
len
,
IPPROTO_UDP
,
skb
->
csum
);
if
(
uh
->
check
==
0
)
if
(
uh
->
check
==
0
)
uh
->
check
=
-
1
;
uh
->
check
=
-
1
;
...
@@ -456,7 +458,7 @@ static int udp_push_pending_frames(struct sock *sk, struct udp_opt *up)
...
@@ -456,7 +458,7 @@ static int udp_push_pending_frames(struct sock *sk, struct udp_opt *up)
skb_queue_walk
(
&
sk
->
sk_write_queue
,
skb
)
{
skb_queue_walk
(
&
sk
->
sk_write_queue
,
skb
)
{
csum
=
csum_add
(
csum
,
skb
->
csum
);
csum
=
csum_add
(
csum
,
skb
->
csum
);
}
}
uh
->
check
=
csum_tcpudp_magic
(
up
->
saddr
,
up
->
daddr
,
uh
->
check
=
csum_tcpudp_magic
(
fl
->
fl4_src
,
fl
->
fl4_dst
,
up
->
len
,
IPPROTO_UDP
,
csum
);
up
->
len
,
IPPROTO_UDP
,
csum
);
if
(
uh
->
check
==
0
)
if
(
uh
->
check
==
0
)
uh
->
check
=
-
1
;
uh
->
check
=
-
1
;
...
@@ -636,10 +638,10 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
...
@@ -636,10 +638,10 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
/*
/*
* Now cork the socket to pend data.
* Now cork the socket to pend data.
*/
*/
up
->
daddr
=
daddr
;
inet
->
cork
.
fl
.
fl4_dst
=
daddr
;
up
->
dport
=
dport
;
inet
->
cork
.
fl
.
fl_ip_
dport
=
dport
;
up
->
saddr
=
saddr
;
inet
->
cork
.
fl
.
fl4_src
=
saddr
;
up
->
sport
=
inet
->
sport
;
inet
->
cork
.
fl
.
fl_ip_
sport
=
inet
->
sport
;
up
->
pending
=
1
;
up
->
pending
=
1
;
do_append_data:
do_append_data:
...
...
net/ipv6/ip6_output.c
View file @
b97edd05
...
@@ -1239,7 +1239,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, int offse
...
@@ -1239,7 +1239,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, int offse
}
}
dst_hold
(
&
rt
->
u
.
dst
);
dst_hold
(
&
rt
->
u
.
dst
);
np
->
cork
.
rt
=
rt
;
np
->
cork
.
rt
=
rt
;
np
->
cork
.
fl
=
*
fl
;
inet
->
cork
.
fl
=
*
fl
;
np
->
cork
.
hop_limit
=
hlimit
;
np
->
cork
.
hop_limit
=
hlimit
;
inet
->
cork
.
fragsize
=
mtu
=
dst_pmtu
(
&
rt
->
u
.
dst
);
inet
->
cork
.
fragsize
=
mtu
=
dst_pmtu
(
&
rt
->
u
.
dst
);
inet
->
cork
.
length
=
0
;
inet
->
cork
.
length
=
0
;
...
@@ -1250,6 +1250,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, int offse
...
@@ -1250,6 +1250,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, int offse
transhdrlen
+=
exthdrlen
;
transhdrlen
+=
exthdrlen
;
}
else
{
}
else
{
rt
=
np
->
cork
.
rt
;
rt
=
np
->
cork
.
rt
;
fl
=
&
inet
->
cork
.
fl
;
if
(
inet
->
cork
.
flags
&
IPCORK_OPT
)
if
(
inet
->
cork
.
flags
&
IPCORK_OPT
)
opt
=
np
->
cork
.
opt
;
opt
=
np
->
cork
.
opt
;
transhdrlen
=
0
;
transhdrlen
=
0
;
...
@@ -1423,7 +1424,7 @@ int ip6_push_pending_frames(struct sock *sk)
...
@@ -1423,7 +1424,7 @@ int ip6_push_pending_frames(struct sock *sk)
struct
ipv6hdr
*
hdr
;
struct
ipv6hdr
*
hdr
;
struct
ipv6_txoptions
*
opt
=
np
->
cork
.
opt
;
struct
ipv6_txoptions
*
opt
=
np
->
cork
.
opt
;
struct
rt6_info
*
rt
=
np
->
cork
.
rt
;
struct
rt6_info
*
rt
=
np
->
cork
.
rt
;
struct
flowi
*
fl
=
&
np
->
cork
.
fl
;
struct
flowi
*
fl
=
&
inet
->
cork
.
fl
;
unsigned
char
proto
=
fl
->
proto
;
unsigned
char
proto
=
fl
->
proto
;
int
err
=
0
;
int
err
=
0
;
...
@@ -1487,7 +1488,7 @@ int ip6_push_pending_frames(struct sock *sk)
...
@@ -1487,7 +1488,7 @@ int ip6_push_pending_frames(struct sock *sk)
dst_release
(
&
np
->
cork
.
rt
->
u
.
dst
);
dst_release
(
&
np
->
cork
.
rt
->
u
.
dst
);
np
->
cork
.
rt
=
NULL
;
np
->
cork
.
rt
=
NULL
;
}
}
memset
(
&
np
->
cork
.
fl
,
0
,
sizeof
(
np
->
cork
.
fl
));
memset
(
&
inet
->
cork
.
fl
,
0
,
sizeof
(
inet
->
cork
.
fl
));
return
err
;
return
err
;
error:
error:
goto
out
;
goto
out
;
...
@@ -1512,5 +1513,5 @@ void ip6_flush_pending_frames(struct sock *sk)
...
@@ -1512,5 +1513,5 @@ void ip6_flush_pending_frames(struct sock *sk)
dst_release
(
&
np
->
cork
.
rt
->
u
.
dst
);
dst_release
(
&
np
->
cork
.
rt
->
u
.
dst
);
np
->
cork
.
rt
=
NULL
;
np
->
cork
.
rt
=
NULL
;
}
}
memset
(
&
np
->
cork
.
fl
,
0
,
sizeof
(
np
->
cork
.
fl
));
memset
(
&
inet
->
cork
.
fl
,
0
,
sizeof
(
inet
->
cork
.
fl
));
}
}
net/ipv6/udp.c
View file @
b97edd05
...
@@ -720,8 +720,8 @@ static int udp_v6_push_pending_frames(struct sock *sk, struct udp_opt *up)
...
@@ -720,8 +720,8 @@ static int udp_v6_push_pending_frames(struct sock *sk, struct udp_opt *up)
{
{
struct
sk_buff
*
skb
;
struct
sk_buff
*
skb
;
struct
udphdr
*
uh
;
struct
udphdr
*
uh
;
struct
i
pv6_pinfo
*
np
=
inet6
_sk
(
sk
);
struct
i
net_opt
*
inet
=
inet
_sk
(
sk
);
struct
flowi
*
fl
=
&
np
->
cork
.
fl
;
struct
flowi
*
fl
=
&
inet
->
cork
.
fl
;
int
err
=
0
;
int
err
=
0
;
/* Grab the skbuff where UDP header space exists. */
/* Grab the skbuff where UDP header space exists. */
...
@@ -783,7 +783,7 @@ static int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg
...
@@ -783,7 +783,7 @@ static int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg
struct
in6_addr
*
daddr
;
struct
in6_addr
*
daddr
;
struct
ipv6_txoptions
*
opt
=
NULL
;
struct
ipv6_txoptions
*
opt
=
NULL
;
struct
ip6_flowlabel
*
flowlabel
=
NULL
;
struct
ip6_flowlabel
*
flowlabel
=
NULL
;
struct
flowi
*
fl
=
&
np
->
cork
.
fl
;
struct
flowi
*
fl
=
&
inet
->
cork
.
fl
;
struct
dst_entry
*
dst
;
struct
dst_entry
*
dst
;
int
addr_len
=
msg
->
msg_namelen
;
int
addr_len
=
msg
->
msg_namelen
;
int
ulen
=
len
;
int
ulen
=
len
;
...
@@ -830,7 +830,7 @@ static int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg
...
@@ -830,7 +830,7 @@ static int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg
if
(
sin6
->
sin6_port
==
0
)
if
(
sin6
->
sin6_port
==
0
)
return
-
EINVAL
;
return
-
EINVAL
;
up
->
dport
=
sin6
->
sin6_port
;
fl
->
fl_ip_
dport
=
sin6
->
sin6_port
;
daddr
=
&
sin6
->
sin6_addr
;
daddr
=
&
sin6
->
sin6_addr
;
if
(
np
->
sndflow
)
{
if
(
np
->
sndflow
)
{
...
@@ -859,7 +859,7 @@ static int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg
...
@@ -859,7 +859,7 @@ static int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg
if
(
sk
->
sk_state
!=
TCP_ESTABLISHED
)
if
(
sk
->
sk_state
!=
TCP_ESTABLISHED
)
return
-
EDESTADDRREQ
;
return
-
EDESTADDRREQ
;
up
->
dport
=
inet
->
dport
;
fl
->
fl_ip_
dport
=
inet
->
dport
;
daddr
=
&
np
->
daddr
;
daddr
=
&
np
->
daddr
;
fl
->
fl6_flowlabel
=
np
->
flow_label
;
fl
->
fl6_flowlabel
=
np
->
flow_label
;
}
}
...
@@ -874,7 +874,7 @@ static int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg
...
@@ -874,7 +874,7 @@ static int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg
sin
.
sin_family
=
AF_INET
;
sin
.
sin_family
=
AF_INET
;
sin
.
sin_addr
.
s_addr
=
daddr
->
s6_addr32
[
3
];
sin
.
sin_addr
.
s_addr
=
daddr
->
s6_addr32
[
3
];
sin
.
sin_port
=
up
->
dport
;
sin
.
sin_port
=
inet
->
cork
.
fl
.
fl_ip_
dport
;
msg
->
msg_name
=
(
struct
sockaddr
*
)(
&
sin
);
msg
->
msg_name
=
(
struct
sockaddr
*
)(
&
sin
);
msg
->
msg_namelen
=
sizeof
(
sin
);
msg
->
msg_namelen
=
sizeof
(
sin
);
fl6_sock_release
(
flowlabel
);
fl6_sock_release
(
flowlabel
);
...
@@ -911,7 +911,6 @@ static int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg
...
@@ -911,7 +911,6 @@ static int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg
ipv6_addr_copy
(
&
fl
->
fl6_dst
,
daddr
);
ipv6_addr_copy
(
&
fl
->
fl6_dst
,
daddr
);
if
(
ipv6_addr_any
(
&
fl
->
fl6_src
)
&&
!
ipv6_addr_any
(
&
np
->
saddr
))
if
(
ipv6_addr_any
(
&
fl
->
fl6_src
)
&&
!
ipv6_addr_any
(
&
np
->
saddr
))
ipv6_addr_copy
(
&
fl
->
fl6_src
,
&
np
->
saddr
);
ipv6_addr_copy
(
&
fl
->
fl6_src
,
&
np
->
saddr
);
fl
->
fl_ip_dport
=
up
->
dport
;
fl
->
fl_ip_sport
=
inet
->
sport
;
fl
->
fl_ip_sport
=
inet
->
sport
;
/* merge ip6_build_xmit from ip6_output */
/* merge ip6_build_xmit from ip6_output */
...
...
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