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
nexedi
linux
Commits
d0da720f
Commit
d0da720f
authored
Jul 11, 2012
by
David S. Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ipv4: Pull redirect instantiation out into a helper function.
Signed-off-by:
David S. Miller
<
davem@davemloft.net
>
parent
d3351b75
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
15 deletions
+22
-15
net/ipv4/route.c
net/ipv4/route.c
+22
-15
No files found.
net/ipv4/route.c
View file @
d0da720f
...
...
@@ -1271,6 +1271,26 @@ static void rt_del(unsigned int hash, struct rtable *rt)
spin_unlock_bh
(
rt_hash_lock_addr
(
hash
));
}
static
void
ip_do_redirect
(
struct
rtable
*
rt
,
__be32
old_gw
,
__be32
new_gw
)
{
struct
neighbour
*
n
;
if
(
rt
->
rt_gateway
!=
old_gw
)
return
;
n
=
ipv4_neigh_lookup
(
&
rt
->
dst
,
NULL
,
&
new_gw
);
if
(
n
)
{
if
(
!
(
n
->
nud_state
&
NUD_VALID
))
{
neigh_event_send
(
n
,
NULL
);
}
else
{
rt
->
rt_gateway
=
new_gw
;
rt
->
rt_flags
|=
RTCF_REDIRECTED
;
call_netevent_notifiers
(
NETEVENT_NEIGH_UPDATE
,
n
);
}
neigh_release
(
n
);
}
}
/* called in rcu_read_lock() section */
void
ip_rt_redirect
(
__be32
old_gw
,
__be32
daddr
,
__be32
new_gw
,
__be32
saddr
,
struct
net_device
*
dev
)
...
...
@@ -1311,8 +1331,6 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw,
rthp
=
&
rt_hash_table
[
hash
].
chain
;
while
((
rt
=
rcu_dereference
(
*
rthp
))
!=
NULL
)
{
struct
neighbour
*
n
;
rthp
=
&
rt
->
dst
.
rt_next
;
if
(
rt
->
rt_key_dst
!=
daddr
||
...
...
@@ -1322,21 +1340,10 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw,
rt_is_expired
(
rt
)
||
!
net_eq
(
dev_net
(
rt
->
dst
.
dev
),
net
)
||
rt
->
dst
.
error
||
rt
->
dst
.
dev
!=
dev
||
rt
->
rt_gateway
!=
old_gw
)
rt
->
dst
.
dev
!=
dev
)
continue
;
n
=
ipv4_neigh_lookup
(
&
rt
->
dst
,
NULL
,
&
new_gw
);
if
(
n
)
{
if
(
!
(
n
->
nud_state
&
NUD_VALID
))
{
neigh_event_send
(
n
,
NULL
);
}
else
{
rt
->
rt_gateway
=
new_gw
;
rt
->
rt_flags
|=
RTCF_REDIRECTED
;
call_netevent_notifiers
(
NETEVENT_NEIGH_UPDATE
,
n
);
}
neigh_release
(
n
);
}
ip_do_redirect
(
rt
,
old_gw
,
new_gw
);
}
}
}
...
...
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