Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Linux-御风守护者
linux
提交
a48eff12
L
linux
项目概览
Linux-御风守护者
/
linux
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a48eff12
编写于
5月 18, 2011
作者:
D
David S. Miller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ipv4: Pass explicit destination address to rt_bind_peer().
Signed-off-by:
N
David S. Miller
<
davem@davemloft.net
>
上级
ed2361e6
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
15 addition
and
15 deletion
+15
-15
include/net/route.h
include/net/route.h
+2
-2
net/ipv4/icmp.c
net/ipv4/icmp.c
+4
-4
net/ipv4/route.c
net/ipv4/route.c
+8
-8
net/ipv4/tcp_ipv4.c
net/ipv4/tcp_ipv4.c
+1
-1
未找到文件。
include/net/route.h
浏览文件 @
a48eff12
...
...
@@ -290,14 +290,14 @@ static inline struct rtable *ip_route_newports(struct flowi4 *fl4, struct rtable
return
rt
;
}
extern
void
rt_bind_peer
(
struct
rtable
*
rt
,
int
create
);
extern
void
rt_bind_peer
(
struct
rtable
*
rt
,
__be32
daddr
,
int
create
);
static
inline
struct
inet_peer
*
rt_get_peer
(
struct
rtable
*
rt
,
__be32
daddr
)
{
if
(
rt
->
peer
)
return
rt
->
peer
;
rt_bind_peer
(
rt
,
0
);
rt_bind_peer
(
rt
,
daddr
,
0
);
return
rt
->
peer
;
}
...
...
net/ipv4/icmp.c
浏览文件 @
a48eff12
...
...
@@ -234,7 +234,7 @@ static inline void icmp_xmit_unlock(struct sock *sk)
*/
static
inline
bool
icmpv4_xrlim_allow
(
struct
net
*
net
,
struct
rtable
*
rt
,
int
type
,
int
code
)
struct
flowi4
*
fl4
,
int
type
,
int
code
)
{
struct
dst_entry
*
dst
=
&
rt
->
dst
;
bool
rc
=
true
;
...
...
@@ -253,7 +253,7 @@ static inline bool icmpv4_xrlim_allow(struct net *net, struct rtable *rt,
/* Limit if icmp type is enabled in ratemask. */
if
((
1
<<
type
)
&
net
->
ipv4
.
sysctl_icmp_ratemask
)
{
if
(
!
rt
->
peer
)
rt_bind_peer
(
rt
,
1
);
rt_bind_peer
(
rt
,
fl4
->
daddr
,
1
);
rc
=
inet_peer_xrlim_allow
(
rt
->
peer
,
net
->
ipv4
.
sysctl_icmp_ratelimit
);
}
...
...
@@ -363,7 +363,7 @@ static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb)
rt
=
ip_route_output_key
(
net
,
&
fl4
);
if
(
IS_ERR
(
rt
))
goto
out_unlock
;
if
(
icmpv4_xrlim_allow
(
net
,
rt
,
icmp_param
->
data
.
icmph
.
type
,
if
(
icmpv4_xrlim_allow
(
net
,
rt
,
&
fl4
,
icmp_param
->
data
.
icmph
.
type
,
icmp_param
->
data
.
icmph
.
code
))
icmp_push_reply
(
icmp_param
,
&
fl4
,
&
ipc
,
&
rt
);
ip_rt_put
(
rt
);
...
...
@@ -603,7 +603,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
if
(
IS_ERR
(
rt
))
goto
out_unlock
;
if
(
!
icmpv4_xrlim_allow
(
net
,
rt
,
type
,
code
))
if
(
!
icmpv4_xrlim_allow
(
net
,
rt
,
&
fl4
,
type
,
code
))
goto
ende
;
/* RFC says return as much as we can without exceeding 576 bytes. */
...
...
net/ipv4/route.c
浏览文件 @
a48eff12
...
...
@@ -156,7 +156,7 @@ static u32 *ipv4_cow_metrics(struct dst_entry *dst, unsigned long old)
u32
*
p
=
NULL
;
if
(
!
rt
->
peer
)
rt_bind_peer
(
rt
,
1
);
rt_bind_peer
(
rt
,
rt
->
rt_dst
,
1
);
peer
=
rt
->
peer
;
if
(
peer
)
{
...
...
@@ -1193,11 +1193,11 @@ static u32 rt_peer_genid(void)
return
atomic_read
(
&
__rt_peer_genid
);
}
void
rt_bind_peer
(
struct
rtable
*
rt
,
int
create
)
void
rt_bind_peer
(
struct
rtable
*
rt
,
__be32
daddr
,
int
create
)
{
struct
inet_peer
*
peer
;
peer
=
inet_getpeer_v4
(
rt
->
rt_dst
,
create
);
peer
=
inet_getpeer_v4
(
daddr
,
create
);
if
(
peer
&&
cmpxchg
(
&
rt
->
peer
,
NULL
,
peer
)
!=
NULL
)
inet_putpeer
(
peer
);
...
...
@@ -1231,7 +1231,7 @@ void __ip_select_ident(struct iphdr *iph, struct dst_entry *dst, int more)
if
(
rt
)
{
if
(
rt
->
peer
==
NULL
)
rt_bind_peer
(
rt
,
1
);
rt_bind_peer
(
rt
,
rt
->
rt_dst
,
1
);
/* If peer is attached to destination, it is never detached,
so that we need not to grab a lock to dereference it.
...
...
@@ -1377,7 +1377,7 @@ void ip_rt_send_redirect(struct sk_buff *skb)
rcu_read_unlock
();
if
(
!
rt
->
peer
)
rt_bind_peer
(
rt
,
1
);
rt_bind_peer
(
rt
,
rt
->
rt_dst
,
1
);
peer
=
rt
->
peer
;
if
(
!
peer
)
{
icmp_send
(
skb
,
ICMP_REDIRECT
,
ICMP_REDIR_HOST
,
rt
->
rt_gateway
);
...
...
@@ -1445,7 +1445,7 @@ static int ip_error(struct sk_buff *skb)
}
if
(
!
rt
->
peer
)
rt_bind_peer
(
rt
,
1
);
rt_bind_peer
(
rt
,
rt
->
rt_dst
,
1
);
peer
=
rt
->
peer
;
send
=
true
;
...
...
@@ -1552,7 +1552,7 @@ static void ip_rt_update_pmtu(struct dst_entry *dst, u32 mtu)
dst_confirm
(
dst
);
if
(
!
rt
->
peer
)
rt_bind_peer
(
rt
,
1
);
rt_bind_peer
(
rt
,
rt
->
rt_dst
,
1
);
peer
=
rt
->
peer
;
if
(
peer
)
{
if
(
mtu
<
ip_rt_min_pmtu
)
...
...
@@ -1609,7 +1609,7 @@ static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie)
struct
inet_peer
*
peer
;
if
(
!
rt
->
peer
)
rt_bind_peer
(
rt
,
0
);
rt_bind_peer
(
rt
,
rt
->
rt_dst
,
0
);
peer
=
rt
->
peer
;
if
(
peer
&&
peer
->
pmtu_expires
)
...
...
net/ipv4/tcp_ipv4.c
浏览文件 @
a48eff12
...
...
@@ -1781,7 +1781,7 @@ struct inet_peer *tcp_v4_get_peer(struct sock *sk, bool *release_it)
*
release_it
=
true
;
}
else
{
if
(
!
rt
->
peer
)
rt_bind_peer
(
rt
,
1
);
rt_bind_peer
(
rt
,
inet
->
inet_daddr
,
1
);
peer
=
rt
->
peer
;
*
release_it
=
false
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录