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
9fac4b2d
Commit
9fac4b2d
authored
Apr 09, 2003
by
Rusty Russell
Committed by
Stephen Hemminger
Apr 09, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NETFILTER]: Push skb linearization deeper inside of implementation.
parent
c92eb773
Changes
16
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
68 additions
and
5 deletions
+68
-5
net/bridge/br_forward.c
net/bridge/br_forward.c
+1
-0
net/bridge/br_netfilter.c
net/bridge/br_netfilter.c
+1
-0
net/bridge/netfilter/ebtables.c
net/bridge/netfilter/ebtables.c
+4
-0
net/core/netfilter.c
net/core/netfilter.c
+0
-5
net/ipv4/netfilter/arp_tables.c
net/ipv4/netfilter/arp_tables.c
+4
-0
net/ipv4/netfilter/ip_conntrack_core.c
net/ipv4/netfilter/ip_conntrack_core.c
+4
-0
net/ipv4/netfilter/ip_conntrack_standalone.c
net/ipv4/netfilter/ip_conntrack_standalone.c
+8
-0
net/ipv4/netfilter/ip_fw_compat.c
net/ipv4/netfilter/ip_fw_compat.c
+8
-0
net/ipv4/netfilter/ip_nat_standalone.c
net/ipv4/netfilter/ip_nat_standalone.c
+12
-0
net/ipv4/netfilter/ip_tables.c
net/ipv4/netfilter/ip_tables.c
+4
-0
net/ipv4/netfilter/iptable_filter.c
net/ipv4/netfilter/iptable_filter.c
+4
-0
net/ipv4/netfilter/iptable_mangle.c
net/ipv4/netfilter/iptable_mangle.c
+4
-0
net/ipv6/netfilter/ip6_tables.c
net/ipv6/netfilter/ip6_tables.c
+4
-0
net/ipv6/netfilter/ip6table_mangle.c
net/ipv6/netfilter/ip6table_mangle.c
+4
-0
net/sched/sch_dsmark.c
net/sched/sch_dsmark.c
+1
-0
net/sched/sch_ingress.c
net/sched/sch_ingress.c
+5
-0
No files found.
net/bridge/br_forward.c
View file @
9fac4b2d
...
...
@@ -33,6 +33,7 @@ static inline int should_deliver(struct net_bridge_port *p, struct sk_buff *skb)
int
br_dev_queue_push_xmit
(
struct
sk_buff
*
skb
)
{
#ifdef CONFIG_NETFILTER
/* FIXME: skb bas not been linearized: is this valid?? --RR */
if
(
skb
->
nf_bridge
)
memcpy
(
skb
->
data
-
16
,
skb
->
nf_bridge
->
hh
,
16
);
#endif
...
...
net/bridge/br_netfilter.c
View file @
9fac4b2d
...
...
@@ -467,6 +467,7 @@ static unsigned int br_nf_post_routing(unsigned int hook, struct sk_buff **pskb,
struct
sk_buff
*
skb
=
*
pskb
;
struct
nf_bridge_info
*
nf_bridge
=
(
*
pskb
)
->
nf_bridge
;
/* FIXME: skb as not been linearized. Is this still true? --RR */
/* Be very paranoid. */
if
(
skb
->
mac
.
raw
<
skb
->
head
||
skb
->
mac
.
raw
+
ETH_HLEN
>
skb
->
data
)
{
printk
(
KERN_CRIT
"br_netfilter: Argh!! br_nf_post_routing: "
...
...
net/bridge/netfilter/ebtables.c
View file @
9fac4b2d
...
...
@@ -175,6 +175,10 @@ unsigned int ebt_do_table (unsigned int hook, struct sk_buff **pskb,
char
*
base
;
struct
ebt_table_info
*
private
=
table
->
private
;
/* FIXME: Push down to extensions --RR */
if
(
skb_is_nonlinear
(
*
pskb
)
&&
skb_linearize
(
*
pskb
,
GFP_ATOMIC
)
!=
0
)
return
NF_DROP
;
read_lock_bh
(
&
table
->
lock
);
cb_base
=
COUNTER_BASE
(
private
->
counters
,
private
->
nentries
,
smp_processor_id
());
...
...
net/core/netfilter.c
View file @
9fac4b2d
...
...
@@ -477,11 +477,6 @@ int nf_hook_slow(int pf, unsigned int hook, struct sk_buff *skb,
unsigned
int
verdict
;
int
ret
=
0
;
/* This stopgap cannot be removed until all the hooks are audited. */
if
(
skb_is_nonlinear
(
skb
)
&&
skb_linearize
(
skb
,
GFP_ATOMIC
)
!=
0
)
{
kfree_skb
(
skb
);
return
-
ENOMEM
;
}
if
(
skb
->
ip_summed
==
CHECKSUM_HW
)
{
if
(
outdev
==
NULL
)
{
skb
->
ip_summed
=
CHECKSUM_NONE
;
...
...
net/ipv4/netfilter/arp_tables.c
View file @
9fac4b2d
...
...
@@ -253,6 +253,10 @@ unsigned int arpt_do_table(struct sk_buff **pskb,
const
char
*
indev
,
*
outdev
;
void
*
table_base
;
/* FIXME: Push down to extensions --RR */
if
(
skb_is_nonlinear
(
*
pskb
)
&&
skb_linearize
(
*
pskb
,
GFP_ATOMIC
)
!=
0
)
return
NF_DROP
;
indev
=
in
?
in
->
name
:
nulldevname
;
outdev
=
out
?
out
->
name
:
nulldevname
;
...
...
net/ipv4/netfilter/ip_conntrack_core.c
View file @
9fac4b2d
...
...
@@ -818,6 +818,10 @@ unsigned int ip_conntrack_in(unsigned int hooknum,
if
((
*
pskb
)
->
nfct
)
return
NF_ACCEPT
;
/* FIXME: Push down to extensions --RR */
if
(
skb_is_nonlinear
(
*
pskb
)
&&
skb_linearize
(
*
pskb
,
GFP_ATOMIC
)
!=
0
)
return
NF_DROP
;
/* Gather fragments. */
if
((
*
pskb
)
->
nh
.
iph
->
frag_off
&
htons
(
IP_MF
|
IP_OFFSET
))
{
*
pskb
=
ip_ct_gather_frags
(
*
pskb
);
...
...
net/ipv4/netfilter/ip_conntrack_standalone.c
View file @
9fac4b2d
...
...
@@ -192,6 +192,10 @@ static unsigned int ip_refrag(unsigned int hooknum,
{
struct
rtable
*
rt
=
(
struct
rtable
*
)(
*
pskb
)
->
dst
;
/* FIXME: Push down to extensions --RR */
if
(
skb_is_nonlinear
(
*
pskb
)
&&
skb_linearize
(
*
pskb
,
GFP_ATOMIC
)
!=
0
)
return
NF_DROP
;
/* We've seen it coming out the other side: confirm */
if
(
ip_confirm
(
hooknum
,
pskb
,
in
,
out
,
okfn
)
!=
NF_ACCEPT
)
return
NF_DROP
;
...
...
@@ -213,6 +217,10 @@ static unsigned int ip_conntrack_local(unsigned int hooknum,
const
struct
net_device
*
out
,
int
(
*
okfn
)(
struct
sk_buff
*
))
{
/* FIXME: Push down to extensions --RR */
if
(
skb_is_nonlinear
(
*
pskb
)
&&
skb_linearize
(
*
pskb
,
GFP_ATOMIC
)
!=
0
)
return
NF_DROP
;
/* root is playing with raw sockets. */
if
((
*
pskb
)
->
len
<
sizeof
(
struct
iphdr
)
||
(
*
pskb
)
->
nh
.
iph
->
ihl
*
4
<
sizeof
(
struct
iphdr
))
{
...
...
net/ipv4/netfilter/ip_fw_compat.c
View file @
9fac4b2d
...
...
@@ -75,6 +75,10 @@ fw_in(unsigned int hooknum,
int
ret
=
FW_BLOCK
;
u_int16_t
redirpt
;
/* FIXME: Push down to extensions --RR */
if
(
skb_is_nonlinear
(
*
pskb
)
&&
skb_linearize
(
*
pskb
,
GFP_ATOMIC
)
!=
0
)
return
NF_DROP
;
/* Assume worse case: any hook could change packet */
(
*
pskb
)
->
nfcache
|=
NFC_UNKNOWN
|
NFC_ALTERED
;
if
((
*
pskb
)
->
ip_summed
==
CHECKSUM_HW
)
...
...
@@ -189,6 +193,10 @@ static unsigned int fw_confirm(unsigned int hooknum,
const
struct
net_device
*
out
,
int
(
*
okfn
)(
struct
sk_buff
*
))
{
/* FIXME: Push down to extensions --RR */
if
(
skb_is_nonlinear
(
*
pskb
)
&&
skb_linearize
(
*
pskb
,
GFP_ATOMIC
)
!=
0
)
return
NF_DROP
;
return
ip_conntrack_confirm
(
*
pskb
);
}
...
...
net/ipv4/netfilter/ip_nat_standalone.c
View file @
9fac4b2d
...
...
@@ -71,6 +71,10 @@ ip_nat_fn(unsigned int hooknum,
/* maniptype == SRC for postrouting. */
enum
ip_nat_manip_type
maniptype
=
HOOK2MANIP
(
hooknum
);
/* FIXME: Push down to extensions --RR */
if
(
skb_is_nonlinear
(
*
pskb
)
&&
skb_linearize
(
*
pskb
,
GFP_ATOMIC
)
!=
0
)
return
NF_DROP
;
/* We never see fragments: conntrack defrags on pre-routing
and local-out, and ip_nat_out protects post-routing. */
IP_NF_ASSERT
(
!
((
*
pskb
)
->
nh
.
iph
->
frag_off
...
...
@@ -170,6 +174,10 @@ ip_nat_out(unsigned int hooknum,
const
struct
net_device
*
out
,
int
(
*
okfn
)(
struct
sk_buff
*
))
{
/* FIXME: Push down to extensions --RR */
if
(
skb_is_nonlinear
(
*
pskb
)
&&
skb_linearize
(
*
pskb
,
GFP_ATOMIC
)
!=
0
)
return
NF_DROP
;
/* root is playing with raw sockets. */
if
((
*
pskb
)
->
len
<
sizeof
(
struct
iphdr
)
||
(
*
pskb
)
->
nh
.
iph
->
ihl
*
4
<
sizeof
(
struct
iphdr
))
...
...
@@ -205,6 +213,10 @@ ip_nat_local_fn(unsigned int hooknum,
u_int32_t
saddr
,
daddr
;
unsigned
int
ret
;
/* FIXME: Push down to extensions --RR */
if
(
skb_is_nonlinear
(
*
pskb
)
&&
skb_linearize
(
*
pskb
,
GFP_ATOMIC
)
!=
0
)
return
NF_DROP
;
/* root is playing with raw sockets. */
if
((
*
pskb
)
->
len
<
sizeof
(
struct
iphdr
)
||
(
*
pskb
)
->
nh
.
iph
->
ihl
*
4
<
sizeof
(
struct
iphdr
))
...
...
net/ipv4/netfilter/ip_tables.c
View file @
9fac4b2d
...
...
@@ -271,6 +271,10 @@ ipt_do_table(struct sk_buff **pskb,
void
*
table_base
;
struct
ipt_entry
*
e
,
*
back
;
/* FIXME: Push down to extensions --RR */
if
(
skb_is_nonlinear
(
*
pskb
)
&&
skb_linearize
(
*
pskb
,
GFP_ATOMIC
)
!=
0
)
return
NF_DROP
;
/* Initialization */
ip
=
(
*
pskb
)
->
nh
.
iph
;
protohdr
=
(
u_int32_t
*
)
ip
+
ip
->
ihl
;
...
...
net/ipv4/netfilter/iptable_filter.c
View file @
9fac4b2d
...
...
@@ -107,6 +107,10 @@ ipt_local_out_hook(unsigned int hook,
const
struct
net_device
*
out
,
int
(
*
okfn
)(
struct
sk_buff
*
))
{
/* FIXME: Push down to extensions --RR */
if
(
skb_is_nonlinear
(
*
pskb
)
&&
skb_linearize
(
*
pskb
,
GFP_ATOMIC
)
!=
0
)
return
NF_DROP
;
/* root is playing with raw sockets. */
if
((
*
pskb
)
->
len
<
sizeof
(
struct
iphdr
)
||
(
*
pskb
)
->
nh
.
iph
->
ihl
*
4
<
sizeof
(
struct
iphdr
))
{
...
...
net/ipv4/netfilter/iptable_mangle.c
View file @
9fac4b2d
...
...
@@ -145,6 +145,10 @@ ipt_local_hook(unsigned int hook,
u_int32_t
saddr
,
daddr
;
unsigned
long
nfmark
;
/* FIXME: Push down to extensions --RR */
if
(
skb_is_nonlinear
(
*
pskb
)
&&
skb_linearize
(
*
pskb
,
GFP_ATOMIC
)
!=
0
)
return
NF_DROP
;
/* root is playing with raw sockets. */
if
((
*
pskb
)
->
len
<
sizeof
(
struct
iphdr
)
||
(
*
pskb
)
->
nh
.
iph
->
ihl
*
4
<
sizeof
(
struct
iphdr
))
{
...
...
net/ipv6/netfilter/ip6_tables.c
View file @
9fac4b2d
...
...
@@ -343,6 +343,10 @@ ip6t_do_table(struct sk_buff **pskb,
void
*
table_base
;
struct
ip6t_entry
*
e
,
*
back
;
/* FIXME: Push down to extensions --RR */
if
(
skb_is_nonlinear
(
*
pskb
)
&&
skb_linearize
(
*
pskb
,
GFP_ATOMIC
)
!=
0
)
return
NF_DROP
;
/* Initialization */
ipv6
=
(
*
pskb
)
->
nh
.
ipv6h
;
protohdr
=
(
u_int32_t
*
)((
char
*
)
ipv6
+
IPV6_HDR_LEN
);
...
...
net/ipv6/netfilter/ip6table_mangle.c
View file @
9fac4b2d
...
...
@@ -154,6 +154,10 @@ ip6t_local_hook(unsigned int hook,
}
#endif
/* FIXME: Push down to extensions --RR */
if
(
skb_is_nonlinear
(
*
pskb
)
&&
skb_linearize
(
*
pskb
,
GFP_ATOMIC
)
!=
0
)
return
NF_DROP
;
/* save source/dest address, nfmark, hoplimit, flowlabel, priority, */
memcpy
(
&
saddr
,
&
(
*
pskb
)
->
nh
.
ipv6h
->
saddr
,
sizeof
(
saddr
));
memcpy
(
&
daddr
,
&
(
*
pskb
)
->
nh
.
ipv6h
->
daddr
,
sizeof
(
daddr
));
...
...
net/sched/sch_dsmark.c
View file @
9fac4b2d
...
...
@@ -193,6 +193,7 @@ static int dsmark_enqueue(struct sk_buff *skb,struct Qdisc *sch)
D2PRINTK
(
"dsmark_enqueue(skb %p,sch %p,[qdisc %p])
\n
"
,
skb
,
sch
,
p
);
if
(
p
->
set_tc_index
)
{
/* FIXME: Safe with non-linear skbs? --RR */
switch
(
skb
->
protocol
)
{
case
__constant_htons
(
ETH_P_IP
):
skb
->
tc_index
=
ipv4_get_dsfield
(
skb
->
nh
.
iph
);
...
...
net/sched/sch_ingress.c
View file @
9fac4b2d
...
...
@@ -222,6 +222,11 @@ used on the egress (might slow things for an iota)
*/
if
(
dev
->
qdisc_ingress
)
{
/* FIXME: Push down to ->enqueue functions --RR */
if
(
skb_is_nonlinear
(
*
pskb
)
&&
skb_linearize
(
*
pskb
,
GFP_ATOMIC
)
!=
0
)
return
NF_DROP
;
spin_lock
(
&
dev
->
queue_lock
);
if
((
q
=
dev
->
qdisc_ingress
)
!=
NULL
)
fwres
=
q
->
enqueue
(
skb
,
q
);
...
...
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