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
694869b3
Commit
694869b3
authored
Jun 12, 2015
by
Eric W. Biederman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ipv4: Pass struct net through ip_fragment
Signed-off-by:
"Eric W. Biederman"
<
ebiederm@xmission.com
>
parent
c559cd3a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
30 deletions
+26
-30
include/net/ip.h
include/net/ip.h
+2
-2
net/bridge/br_netfilter_hooks.c
net/bridge/br_netfilter_hooks.c
+3
-3
net/ipv4/ip_output.c
net/ipv4/ip_output.c
+20
-24
net/openvswitch/actions.c
net/openvswitch/actions.c
+1
-1
No files found.
include/net/ip.h
View file @
694869b3
...
@@ -109,8 +109,8 @@ int ip_local_deliver(struct sk_buff *skb);
...
@@ -109,8 +109,8 @@ int ip_local_deliver(struct sk_buff *skb);
int
ip_mr_input
(
struct
sk_buff
*
skb
);
int
ip_mr_input
(
struct
sk_buff
*
skb
);
int
ip_output
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
int
ip_output
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
int
ip_mc_output
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
int
ip_mc_output
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
int
ip_do_fragment
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
,
int
ip_do_fragment
(
struct
net
*
net
,
struct
sock
*
sk
,
struct
sk_buff
*
skb
,
int
(
*
output
)(
struct
sock
*
,
struct
sk_buff
*
));
int
(
*
output
)(
struct
net
*
,
struct
sock
*
,
struct
sk_buff
*
));
void
ip_send_check
(
struct
iphdr
*
ip
);
void
ip_send_check
(
struct
iphdr
*
ip
);
int
__ip_local_out
(
struct
sk_buff
*
skb
);
int
__ip_local_out
(
struct
sk_buff
*
skb
);
int
ip_local_out_sk
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
int
ip_local_out_sk
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
);
...
...
net/bridge/br_netfilter_hooks.c
View file @
694869b3
...
@@ -701,7 +701,7 @@ static int br_nf_push_frag_xmit_sk(struct sock *sk, struct sk_buff *skb)
...
@@ -701,7 +701,7 @@ static int br_nf_push_frag_xmit_sk(struct sock *sk, struct sk_buff *skb)
#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV4)
#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV4)
static
int
static
int
br_nf_ip_fragment
(
struct
net
*
net
,
struct
sock
*
sk
,
struct
sk_buff
*
skb
,
br_nf_ip_fragment
(
struct
net
*
net
,
struct
sock
*
sk
,
struct
sk_buff
*
skb
,
int
(
*
output
)(
struct
sock
*
,
struct
sk_buff
*
))
int
(
*
output
)(
struct
net
*
,
struct
sock
*
,
struct
sk_buff
*
))
{
{
unsigned
int
mtu
=
ip_skb_dst_mtu
(
skb
);
unsigned
int
mtu
=
ip_skb_dst_mtu
(
skb
);
struct
iphdr
*
iph
=
ip_hdr
(
skb
);
struct
iphdr
*
iph
=
ip_hdr
(
skb
);
...
@@ -714,7 +714,7 @@ br_nf_ip_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
...
@@ -714,7 +714,7 @@ br_nf_ip_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
return
-
EMSGSIZE
;
return
-
EMSGSIZE
;
}
}
return
ip_do_fragment
(
sk
,
skb
,
output
);
return
ip_do_fragment
(
net
,
sk
,
skb
,
output
);
}
}
#endif
#endif
...
@@ -763,7 +763,7 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff
...
@@ -763,7 +763,7 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff
skb_copy_from_linear_data_offset
(
skb
,
-
data
->
size
,
data
->
mac
,
skb_copy_from_linear_data_offset
(
skb
,
-
data
->
size
,
data
->
mac
,
data
->
size
);
data
->
size
);
return
br_nf_ip_fragment
(
net
,
sk
,
skb
,
br_nf_push_frag_xmit
_sk
);
return
br_nf_ip_fragment
(
net
,
sk
,
skb
,
br_nf_push_frag_xmit
);
}
}
#endif
#endif
#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6)
#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6)
...
...
net/ipv4/ip_output.c
View file @
694869b3
...
@@ -83,9 +83,10 @@
...
@@ -83,9 +83,10 @@
int
sysctl_ip_default_ttl
__read_mostly
=
IPDEFTTL
;
int
sysctl_ip_default_ttl
__read_mostly
=
IPDEFTTL
;
EXPORT_SYMBOL
(
sysctl_ip_default_ttl
);
EXPORT_SYMBOL
(
sysctl_ip_default_ttl
);
static
int
ip_fragment
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
,
static
int
unsigned
int
mtu
,
ip_fragment
(
struct
net
*
net
,
struct
sock
*
sk
,
struct
sk_buff
*
skb
,
int
(
*
output
)(
struct
sock
*
,
struct
sk_buff
*
));
unsigned
int
mtu
,
int
(
*
output
)(
struct
net
*
,
struct
sock
*
,
struct
sk_buff
*
));
/* Generate a checksum for an outgoing IP datagram. */
/* Generate a checksum for an outgoing IP datagram. */
void
ip_send_check
(
struct
iphdr
*
iph
)
void
ip_send_check
(
struct
iphdr
*
iph
)
...
@@ -176,12 +177,11 @@ int ip_build_and_send_pkt(struct sk_buff *skb, const struct sock *sk,
...
@@ -176,12 +177,11 @@ int ip_build_and_send_pkt(struct sk_buff *skb, const struct sock *sk,
}
}
EXPORT_SYMBOL_GPL
(
ip_build_and_send_pkt
);
EXPORT_SYMBOL_GPL
(
ip_build_and_send_pkt
);
static
int
ip_finish_output2
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
static
int
ip_finish_output2
(
struct
net
*
net
,
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
{
{
struct
dst_entry
*
dst
=
skb_dst
(
skb
);
struct
dst_entry
*
dst
=
skb_dst
(
skb
);
struct
rtable
*
rt
=
(
struct
rtable
*
)
dst
;
struct
rtable
*
rt
=
(
struct
rtable
*
)
dst
;
struct
net_device
*
dev
=
dst
->
dev
;
struct
net_device
*
dev
=
dst
->
dev
;
struct
net
*
net
=
dev_net
(
dev
);
unsigned
int
hh_len
=
LL_RESERVED_SPACE
(
dev
);
unsigned
int
hh_len
=
LL_RESERVED_SPACE
(
dev
);
struct
neighbour
*
neigh
;
struct
neighbour
*
neigh
;
u32
nexthop
;
u32
nexthop
;
...
@@ -225,8 +225,8 @@ static int ip_finish_output2(struct sock *sk, struct sk_buff *skb)
...
@@ -225,8 +225,8 @@ static int ip_finish_output2(struct sock *sk, struct sk_buff *skb)
return
-
EINVAL
;
return
-
EINVAL
;
}
}
static
int
ip_finish_output_gso
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
,
static
int
ip_finish_output_gso
(
struct
net
*
net
,
struct
sock
*
sk
,
unsigned
int
mtu
)
struct
sk_buff
*
skb
,
unsigned
int
mtu
)
{
{
netdev_features_t
features
;
netdev_features_t
features
;
struct
sk_buff
*
segs
;
struct
sk_buff
*
segs
;
...
@@ -235,7 +235,7 @@ static int ip_finish_output_gso(struct sock *sk, struct sk_buff *skb,
...
@@ -235,7 +235,7 @@ static int ip_finish_output_gso(struct sock *sk, struct sk_buff *skb,
/* common case: locally created skb or seglen is <= mtu */
/* common case: locally created skb or seglen is <= mtu */
if
(((
IPCB
(
skb
)
->
flags
&
IPSKB_FORWARDED
)
==
0
)
||
if
(((
IPCB
(
skb
)
->
flags
&
IPSKB_FORWARDED
)
==
0
)
||
skb_gso_network_seglen
(
skb
)
<=
mtu
)
skb_gso_network_seglen
(
skb
)
<=
mtu
)
return
ip_finish_output2
(
sk
,
skb
);
return
ip_finish_output2
(
net
,
sk
,
skb
);
/* Slowpath - GSO segment length is exceeding the dst MTU.
/* Slowpath - GSO segment length is exceeding the dst MTU.
*
*
...
@@ -258,7 +258,7 @@ static int ip_finish_output_gso(struct sock *sk, struct sk_buff *skb,
...
@@ -258,7 +258,7 @@ static int ip_finish_output_gso(struct sock *sk, struct sk_buff *skb,
int
err
;
int
err
;
segs
->
next
=
NULL
;
segs
->
next
=
NULL
;
err
=
ip_fragment
(
sk
,
segs
,
mtu
,
ip_finish_output2
);
err
=
ip_fragment
(
net
,
sk
,
segs
,
mtu
,
ip_finish_output2
);
if
(
err
&&
ret
==
0
)
if
(
err
&&
ret
==
0
)
ret
=
err
;
ret
=
err
;
...
@@ -281,12 +281,12 @@ static int ip_finish_output(struct net *net, struct sock *sk, struct sk_buff *sk
...
@@ -281,12 +281,12 @@ static int ip_finish_output(struct net *net, struct sock *sk, struct sk_buff *sk
#endif
#endif
mtu
=
ip_skb_dst_mtu
(
skb
);
mtu
=
ip_skb_dst_mtu
(
skb
);
if
(
skb_is_gso
(
skb
))
if
(
skb_is_gso
(
skb
))
return
ip_finish_output_gso
(
sk
,
skb
,
mtu
);
return
ip_finish_output_gso
(
net
,
sk
,
skb
,
mtu
);
if
(
skb
->
len
>
mtu
||
(
IPCB
(
skb
)
->
flags
&
IPSKB_FRAG_PMTU
))
if
(
skb
->
len
>
mtu
||
(
IPCB
(
skb
)
->
flags
&
IPSKB_FRAG_PMTU
))
return
ip_fragment
(
sk
,
skb
,
mtu
,
ip_finish_output2
);
return
ip_fragment
(
net
,
sk
,
skb
,
mtu
,
ip_finish_output2
);
return
ip_finish_output2
(
sk
,
skb
);
return
ip_finish_output2
(
net
,
sk
,
skb
);
}
}
int
ip_mc_output
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
int
ip_mc_output
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
)
...
@@ -495,20 +495,18 @@ static void ip_copy_metadata(struct sk_buff *to, struct sk_buff *from)
...
@@ -495,20 +495,18 @@ static void ip_copy_metadata(struct sk_buff *to, struct sk_buff *from)
skb_copy_secmark
(
to
,
from
);
skb_copy_secmark
(
to
,
from
);
}
}
static
int
ip_fragment
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
,
static
int
ip_fragment
(
struct
net
*
net
,
struct
sock
*
sk
,
struct
sk_buff
*
skb
,
unsigned
int
mtu
,
unsigned
int
mtu
,
int
(
*
output
)(
struct
sock
*
,
struct
sk_buff
*
))
int
(
*
output
)(
struct
net
*
,
struct
sock
*
,
struct
sk_buff
*
))
{
{
struct
iphdr
*
iph
=
ip_hdr
(
skb
);
struct
iphdr
*
iph
=
ip_hdr
(
skb
);
if
((
iph
->
frag_off
&
htons
(
IP_DF
))
==
0
)
if
((
iph
->
frag_off
&
htons
(
IP_DF
))
==
0
)
return
ip_do_fragment
(
sk
,
skb
,
output
);
return
ip_do_fragment
(
net
,
sk
,
skb
,
output
);
if
(
unlikely
(
!
skb
->
ignore_df
||
if
(
unlikely
(
!
skb
->
ignore_df
||
(
IPCB
(
skb
)
->
frag_max_size
&&
(
IPCB
(
skb
)
->
frag_max_size
&&
IPCB
(
skb
)
->
frag_max_size
>
mtu
)))
{
IPCB
(
skb
)
->
frag_max_size
>
mtu
)))
{
struct
net
*
net
=
dev_net
(
skb_rtable
(
skb
)
->
dst
.
dev
);
IP_INC_STATS
(
net
,
IPSTATS_MIB_FRAGFAILS
);
IP_INC_STATS
(
net
,
IPSTATS_MIB_FRAGFAILS
);
icmp_send
(
skb
,
ICMP_DEST_UNREACH
,
ICMP_FRAG_NEEDED
,
icmp_send
(
skb
,
ICMP_DEST_UNREACH
,
ICMP_FRAG_NEEDED
,
htonl
(
mtu
));
htonl
(
mtu
));
...
@@ -516,7 +514,7 @@ static int ip_fragment(struct sock *sk, struct sk_buff *skb,
...
@@ -516,7 +514,7 @@ static int ip_fragment(struct sock *sk, struct sk_buff *skb,
return
-
EMSGSIZE
;
return
-
EMSGSIZE
;
}
}
return
ip_do_fragment
(
sk
,
skb
,
output
);
return
ip_do_fragment
(
net
,
sk
,
skb
,
output
);
}
}
/*
/*
...
@@ -526,8 +524,8 @@ static int ip_fragment(struct sock *sk, struct sk_buff *skb,
...
@@ -526,8 +524,8 @@ static int ip_fragment(struct sock *sk, struct sk_buff *skb,
* single device frame, and queue such a frame for sending.
* single device frame, and queue such a frame for sending.
*/
*/
int
ip_do_fragment
(
struct
sock
*
sk
,
struct
sk_buff
*
skb
,
int
ip_do_fragment
(
struct
net
*
net
,
struct
sock
*
sk
,
struct
sk_buff
*
skb
,
int
(
*
output
)(
struct
sock
*
,
struct
sk_buff
*
))
int
(
*
output
)(
struct
net
*
,
struct
sock
*
,
struct
sk_buff
*
))
{
{
struct
iphdr
*
iph
;
struct
iphdr
*
iph
;
int
ptr
;
int
ptr
;
...
@@ -537,11 +535,9 @@ int ip_do_fragment(struct sock *sk, struct sk_buff *skb,
...
@@ -537,11 +535,9 @@ int ip_do_fragment(struct sock *sk, struct sk_buff *skb,
int
offset
;
int
offset
;
__be16
not_last_frag
;
__be16
not_last_frag
;
struct
rtable
*
rt
=
skb_rtable
(
skb
);
struct
rtable
*
rt
=
skb_rtable
(
skb
);
struct
net
*
net
;
int
err
=
0
;
int
err
=
0
;
dev
=
rt
->
dst
.
dev
;
dev
=
rt
->
dst
.
dev
;
net
=
dev_net
(
dev
);
/*
/*
* Point into the IP datagram header.
* Point into the IP datagram header.
...
@@ -631,7 +627,7 @@ int ip_do_fragment(struct sock *sk, struct sk_buff *skb,
...
@@ -631,7 +627,7 @@ int ip_do_fragment(struct sock *sk, struct sk_buff *skb,
ip_send_check
(
iph
);
ip_send_check
(
iph
);
}
}
err
=
output
(
sk
,
skb
);
err
=
output
(
net
,
sk
,
skb
);
if
(
!
err
)
if
(
!
err
)
IP_INC_STATS
(
net
,
IPSTATS_MIB_FRAGCREATES
);
IP_INC_STATS
(
net
,
IPSTATS_MIB_FRAGCREATES
);
...
@@ -771,7 +767,7 @@ int ip_do_fragment(struct sock *sk, struct sk_buff *skb,
...
@@ -771,7 +767,7 @@ int ip_do_fragment(struct sock *sk, struct sk_buff *skb,
ip_send_check
(
iph
);
ip_send_check
(
iph
);
err
=
output
(
sk
,
skb2
);
err
=
output
(
net
,
sk
,
skb2
);
if
(
err
)
if
(
err
)
goto
fail
;
goto
fail
;
...
...
net/openvswitch/actions.c
View file @
694869b3
...
@@ -705,7 +705,7 @@ static void ovs_fragment(struct net *net, struct vport *vport,
...
@@ -705,7 +705,7 @@ static void ovs_fragment(struct net *net, struct vport *vport,
skb_dst_set_noref
(
skb
,
&
ovs_dst
);
skb_dst_set_noref
(
skb
,
&
ovs_dst
);
IPCB
(
skb
)
->
frag_max_size
=
mru
;
IPCB
(
skb
)
->
frag_max_size
=
mru
;
ip_do_fragment
(
skb
->
sk
,
skb
,
ovs_vport_output_sk
);
ip_do_fragment
(
net
,
skb
->
sk
,
skb
,
ovs_vport_output
);
refdst_drop
(
orig_dst
);
refdst_drop
(
orig_dst
);
}
else
if
(
ethertype
==
htons
(
ETH_P_IPV6
))
{
}
else
if
(
ethertype
==
htons
(
ETH_P_IPV6
))
{
const
struct
nf_ipv6_ops
*
v6ops
=
nf_get_ipv6_ops
();
const
struct
nf_ipv6_ops
*
v6ops
=
nf_get_ipv6_ops
();
...
...
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