Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
9ade2286
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
9ade2286
编写于
3月 12, 2011
作者:
D
David S. Miller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ipv4: Use flowi4 in FIB layer.
Signed-off-by:
N
David S. Miller
<
davem@davemloft.net
>
上级
9d6ec938
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
31 addition
and
30 deletion
+31
-30
net/ipv4/fib_frontend.c
net/ipv4/fib_frontend.c
+20
-20
net/ipv4/fib_rules.c
net/ipv4/fib_rules.c
+4
-3
net/ipv4/fib_semantics.c
net/ipv4/fib_semantics.c
+7
-7
未找到文件。
net/ipv4/fib_frontend.c
浏览文件 @
9ade2286
...
...
@@ -140,7 +140,7 @@ static inline unsigned __inet_dev_addr_type(struct net *net,
const
struct
net_device
*
dev
,
__be32
addr
)
{
struct
flowi
fl
=
{
.
fl4_dst
=
addr
};
struct
flowi
4
fl4
=
{
.
daddr
=
addr
};
struct
fib_result
res
;
unsigned
ret
=
RTN_BROADCAST
;
struct
fib_table
*
local_table
;
...
...
@@ -158,7 +158,7 @@ static inline unsigned __inet_dev_addr_type(struct net *net,
if
(
local_table
)
{
ret
=
RTN_UNICAST
;
rcu_read_lock
();
if
(
!
fib_table_lookup
(
local_table
,
&
fl
.
u
.
ip
4
,
&
res
,
FIB_LOOKUP_NOREF
))
{
if
(
!
fib_table_lookup
(
local_table
,
&
fl4
,
&
res
,
FIB_LOOKUP_NOREF
))
{
if
(
!
dev
||
dev
==
res
.
fi
->
fib_dev
)
ret
=
res
.
type
;
}
...
...
@@ -193,20 +193,20 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
u32
*
itag
,
u32
mark
)
{
struct
in_device
*
in_dev
;
struct
flowi
fl
;
struct
flowi
4
fl4
;
struct
fib_result
res
;
int
no_addr
,
rpf
,
accept_local
;
bool
dev_match
;
int
ret
;
struct
net
*
net
;
fl
.
flowi
_oif
=
0
;
fl
.
flowi
_iif
=
oif
;
fl
.
flowi
_mark
=
mark
;
fl
.
fl4_dst
=
src
;
fl
.
fl4_src
=
dst
;
fl
.
fl
4_tos
=
tos
;
fl
.
fl
4_scope
=
RT_SCOPE_UNIVERSE
;
fl
4
.
flowi4
_oif
=
0
;
fl
4
.
flowi4
_iif
=
oif
;
fl
4
.
flowi4
_mark
=
mark
;
fl
4
.
daddr
=
src
;
fl
4
.
saddr
=
dst
;
fl
4
.
flowi
4_tos
=
tos
;
fl
4
.
flowi
4_scope
=
RT_SCOPE_UNIVERSE
;
no_addr
=
rpf
=
accept_local
=
0
;
in_dev
=
__in_dev_get_rcu
(
dev
);
...
...
@@ -215,14 +215,14 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
rpf
=
IN_DEV_RPFILTER
(
in_dev
);
accept_local
=
IN_DEV_ACCEPT_LOCAL
(
in_dev
);
if
(
mark
&&
!
IN_DEV_SRC_VMARK
(
in_dev
))
fl
.
flowi
_mark
=
0
;
fl
4
.
flowi4
_mark
=
0
;
}
if
(
in_dev
==
NULL
)
goto
e_inval
;
net
=
dev_net
(
dev
);
if
(
fib_lookup
(
net
,
&
fl
.
u
.
ip
4
,
&
res
))
if
(
fib_lookup
(
net
,
&
fl4
,
&
res
))
goto
last_resort
;
if
(
res
.
type
!=
RTN_UNICAST
)
{
if
(
res
.
type
!=
RTN_LOCAL
||
!
accept_local
)
...
...
@@ -253,10 +253,10 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
goto
last_resort
;
if
(
rpf
==
1
)
goto
e_rpf
;
fl
.
flowi
_oif
=
dev
->
ifindex
;
fl
4
.
flowi4
_oif
=
dev
->
ifindex
;
ret
=
0
;
if
(
fib_lookup
(
net
,
&
fl
.
u
.
ip
4
,
&
res
)
==
0
)
{
if
(
fib_lookup
(
net
,
&
fl4
,
&
res
)
==
0
)
{
if
(
res
.
type
==
RTN_UNICAST
)
{
*
spec_dst
=
FIB_RES_PREFSRC
(
res
);
ret
=
FIB_RES_NH
(
res
).
nh_scope
>=
RT_SCOPE_HOST
;
...
...
@@ -796,11 +796,11 @@ static void nl_fib_lookup(struct fib_result_nl *frn, struct fib_table *tb)
{
struct
fib_result
res
;
struct
flowi
fl
=
{
.
flowi_mark
=
frn
->
fl_mark
,
.
fl4_dst
=
frn
->
fl_addr
,
.
fl4_tos
=
frn
->
fl_tos
,
.
fl4_scope
=
frn
->
fl_scope
,
struct
flowi
4
fl4
=
{
.
flowi
4
_mark
=
frn
->
fl_mark
,
.
daddr
=
frn
->
fl_addr
,
.
fl
owi
4_tos
=
frn
->
fl_tos
,
.
fl
owi
4_scope
=
frn
->
fl_scope
,
};
#ifdef CONFIG_IP_MULTIPLE_TABLES
...
...
@@ -813,7 +813,7 @@ static void nl_fib_lookup(struct fib_result_nl *frn, struct fib_table *tb)
frn
->
tb_id
=
tb
->
tb_id
;
rcu_read_lock
();
frn
->
err
=
fib_table_lookup
(
tb
,
&
fl
.
u
.
ip
4
,
&
res
,
FIB_LOOKUP_NOREF
);
frn
->
err
=
fib_table_lookup
(
tb
,
&
fl4
,
&
res
,
FIB_LOOKUP_NOREF
);
if
(
!
frn
->
err
)
{
frn
->
prefixlen
=
res
.
prefixlen
;
...
...
net/ipv4/fib_rules.c
浏览文件 @
9ade2286
...
...
@@ -106,14 +106,15 @@ static int fib4_rule_action(struct fib_rule *rule, struct flowi *flp,
static
int
fib4_rule_match
(
struct
fib_rule
*
rule
,
struct
flowi
*
fl
,
int
flags
)
{
struct
fib4_rule
*
r
=
(
struct
fib4_rule
*
)
rule
;
__be32
daddr
=
fl
->
fl4_dst
;
__be32
saddr
=
fl
->
fl4_src
;
struct
flowi4
*
fl4
=
&
fl
->
u
.
ip4
;
__be32
daddr
=
fl4
->
daddr
;
__be32
saddr
=
fl4
->
saddr
;
if
(((
saddr
^
r
->
src
)
&
r
->
srcmask
)
||
((
daddr
^
r
->
dst
)
&
r
->
dstmask
))
return
0
;
if
(
r
->
tos
&&
(
r
->
tos
!=
fl
->
fl
4_tos
))
if
(
r
->
tos
&&
(
r
->
tos
!=
fl
4
->
flowi
4_tos
))
return
0
;
return
1
;
...
...
net/ipv4/fib_semantics.c
浏览文件 @
9ade2286
...
...
@@ -560,16 +560,16 @@ static int fib_check_nh(struct fib_config *cfg, struct fib_info *fi,
}
rcu_read_lock
();
{
struct
flowi
fl
=
{
.
fl4_dst
=
nh
->
nh_gw
,
.
fl4_scope
=
cfg
->
fc_scope
+
1
,
.
flowi_oif
=
nh
->
nh_oif
,
struct
flowi
4
fl4
=
{
.
daddr
=
nh
->
nh_gw
,
.
fl
owi
4_scope
=
cfg
->
fc_scope
+
1
,
.
flowi
4
_oif
=
nh
->
nh_oif
,
};
/* It is not necessary, but requires a bit of thinking */
if
(
fl
.
fl
4_scope
<
RT_SCOPE_LINK
)
fl
.
fl
4_scope
=
RT_SCOPE_LINK
;
err
=
fib_lookup
(
net
,
&
fl
.
u
.
ip
4
,
&
res
);
if
(
fl
4
.
flowi
4_scope
<
RT_SCOPE_LINK
)
fl
4
.
flowi
4_scope
=
RT_SCOPE_LINK
;
err
=
fib_lookup
(
net
,
&
fl4
,
&
res
);
if
(
err
)
{
rcu_read_unlock
();
return
err
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录