Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
52eeeb84
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看板
提交
52eeeb84
编写于
3月 15, 2008
作者:
Y
YOSHIFUJI Hideaki
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[IPV6]: Unify ip6_onlink() and ipip6_onlink().
Both are identical, let's create ipv6_chk_prefix() and use it in both places.
上级
6294e000
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
31 addition
and
50 deletion
+31
-50
include/net/addrconf.h
include/net/addrconf.h
+4
-0
net/ipv6/addrconf.c
net/ipv6/addrconf.c
+25
-0
net/ipv6/anycast.c
net/ipv6/anycast.c
+1
-24
net/ipv6/sit.c
net/ipv6/sit.c
+1
-26
未找到文件。
include/net/addrconf.h
浏览文件 @
52eeeb84
...
...
@@ -71,6 +71,10 @@ extern int ipv6_chk_addr(struct net *net,
extern
int
ipv6_chk_home_addr
(
struct
net
*
net
,
struct
in6_addr
*
addr
);
#endif
extern
int
ipv6_chk_prefix
(
struct
in6_addr
*
addr
,
struct
net_device
*
dev
);
extern
struct
inet6_ifaddr
*
ipv6_get_ifaddr
(
struct
net
*
net
,
struct
in6_addr
*
addr
,
struct
net_device
*
dev
,
...
...
net/ipv6/addrconf.c
浏览文件 @
52eeeb84
...
...
@@ -1249,6 +1249,31 @@ int ipv6_chk_same_addr(struct net *net, const struct in6_addr *addr,
return
ifp
!=
NULL
;
}
int
ipv6_chk_prefix
(
struct
in6_addr
*
addr
,
struct
net_device
*
dev
)
{
struct
inet6_dev
*
idev
;
struct
inet6_ifaddr
*
ifa
;
int
onlink
;
onlink
=
0
;
rcu_read_lock
();
idev
=
__in6_dev_get
(
dev
);
if
(
idev
)
{
read_lock_bh
(
&
idev
->
lock
);
for
(
ifa
=
idev
->
addr_list
;
ifa
;
ifa
=
ifa
->
if_next
)
{
onlink
=
ipv6_prefix_equal
(
addr
,
&
ifa
->
addr
,
ifa
->
prefix_len
);
if
(
onlink
)
break
;
}
read_unlock_bh
(
&
idev
->
lock
);
}
rcu_read_unlock
();
return
onlink
;
}
EXPORT_SYMBOL
(
ipv6_chk_prefix
);
struct
inet6_ifaddr
*
ipv6_get_ifaddr
(
struct
net
*
net
,
struct
in6_addr
*
addr
,
struct
net_device
*
dev
,
int
strict
)
{
...
...
net/ipv6/anycast.c
浏览文件 @
52eeeb84
...
...
@@ -48,29 +48,6 @@ static int ipv6_dev_ac_dec(struct net_device *dev, struct in6_addr *addr);
/* Big ac list lock for all the sockets */
static
DEFINE_RWLOCK
(
ipv6_sk_ac_lock
);
static
int
ip6_onlink
(
struct
in6_addr
*
addr
,
struct
net_device
*
dev
)
{
struct
inet6_dev
*
idev
;
struct
inet6_ifaddr
*
ifa
;
int
onlink
;
onlink
=
0
;
rcu_read_lock
();
idev
=
__in6_dev_get
(
dev
);
if
(
idev
)
{
read_lock_bh
(
&
idev
->
lock
);
for
(
ifa
=
idev
->
addr_list
;
ifa
;
ifa
=
ifa
->
if_next
)
{
onlink
=
ipv6_prefix_equal
(
addr
,
&
ifa
->
addr
,
ifa
->
prefix_len
);
if
(
onlink
)
break
;
}
read_unlock_bh
(
&
idev
->
lock
);
}
rcu_read_unlock
();
return
onlink
;
}
/*
* socket join an anycast group
...
...
@@ -142,7 +119,7 @@ int ipv6_sock_ac_join(struct sock *sk, int ifindex, struct in6_addr *addr)
* This obviates the need for propagating anycast routes while
* still allowing some non-router anycast participation.
*/
if
(
!
ip
6_onlink
(
addr
,
dev
))
{
if
(
!
ip
v6_chk_prefix
(
addr
,
dev
))
{
if
(
ishost
)
err
=
-
EADDRNOTAVAIL
;
if
(
err
)
...
...
net/ipv6/sit.c
浏览文件 @
52eeeb84
...
...
@@ -344,31 +344,6 @@ ipip6_tunnel_del_prl(struct ip_tunnel *t, struct ip_tunnel_prl *a)
return
0
;
}
/* copied directly from anycast.c */
static
int
ipip6_onlink
(
struct
in6_addr
*
addr
,
struct
net_device
*
dev
)
{
struct
inet6_dev
*
idev
;
struct
inet6_ifaddr
*
ifa
;
int
onlink
;
onlink
=
0
;
rcu_read_lock
();
idev
=
__in6_dev_get
(
dev
);
if
(
idev
)
{
read_lock_bh
(
&
idev
->
lock
);
for
(
ifa
=
idev
->
addr_list
;
ifa
;
ifa
=
ifa
->
if_next
)
{
onlink
=
ipv6_prefix_equal
(
addr
,
&
ifa
->
addr
,
ifa
->
prefix_len
);
if
(
onlink
)
break
;
}
read_unlock_bh
(
&
idev
->
lock
);
}
rcu_read_unlock
();
return
onlink
;
}
static
int
isatap_chksrc
(
struct
sk_buff
*
skb
,
struct
iphdr
*
iph
,
struct
ip_tunnel
*
t
)
{
...
...
@@ -386,7 +361,7 @@ isatap_chksrc(struct sk_buff *skb, struct iphdr *iph, struct ip_tunnel *t)
struct
in6_addr
*
addr6
=
&
ipv6_hdr
(
skb
)
->
saddr
;
if
(
ipv6_addr_is_isatap
(
addr6
)
&&
(
addr6
->
s6_addr32
[
3
]
==
iph
->
saddr
)
&&
ip
ip6_onlink
(
addr6
,
t
->
dev
))
ip
v6_chk_prefix
(
addr6
,
t
->
dev
))
skb
->
ndisc_nodetype
=
NDISC_NODETYPE_HOST
;
else
ok
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录