Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
e6469297
K
Kernel
项目概览
openeuler
/
Kernel
12 个月 前同步成功
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e6469297
编写于
12月 22, 2005
作者:
D
David S. Miller
浏览文件
操作
浏览文件
下载
差异文件
Merge
git://git.skbuff.net/gitroot/yoshfuji/linux-2.6.14+git+ipv6-fix-20051221a
上级
9b78a82c
6b3ae80a
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
120 addition
and
17 deletion
+120
-17
include/linux/ipv6_route.h
include/linux/ipv6_route.h
+1
-0
include/net/if_inet6.h
include/net/if_inet6.h
+1
-0
net/ipv6/addrconf.c
net/ipv6/addrconf.c
+95
-11
net/ipv6/icmp.c
net/ipv6/icmp.c
+14
-2
net/ipv6/route.c
net/ipv6/route.c
+9
-4
未找到文件。
include/linux/ipv6_route.h
浏览文件 @
e6469297
...
...
@@ -18,6 +18,7 @@
fallback, no routers on link */
#define RTF_ADDRCONF 0x00040000
/* addrconf route - RA */
#define RTF_PREFIX_RT 0x00080000
/* A prefix only route - RA */
#define RTF_ANYCAST 0x00100000
/* Anycast */
#define RTF_NONEXTHOP 0x00200000
/* route with no nexthop */
#define RTF_EXPIRES 0x00400000
...
...
include/net/if_inet6.h
浏览文件 @
e6469297
...
...
@@ -24,6 +24,7 @@
#define IF_RA_MANAGED 0x40
#define IF_RA_RCVD 0x20
#define IF_RS_SENT 0x10
#define IF_READY 0x80000000
/* prefix flags */
#define IF_PREFIX_ONLINK 0x01
...
...
net/ipv6/addrconf.c
浏览文件 @
e6469297
...
...
@@ -137,6 +137,7 @@ static int addrconf_ifdown(struct net_device *dev, int how);
static
void
addrconf_dad_start
(
struct
inet6_ifaddr
*
ifp
,
u32
flags
);
static
void
addrconf_dad_timer
(
unsigned
long
data
);
static
void
addrconf_dad_completed
(
struct
inet6_ifaddr
*
ifp
);
static
void
addrconf_dad_run
(
struct
inet6_dev
*
idev
);
static
void
addrconf_rs_timer
(
unsigned
long
data
);
static
void
__ipv6_ifa_notify
(
int
event
,
struct
inet6_ifaddr
*
ifa
);
static
void
ipv6_ifa_notify
(
int
event
,
struct
inet6_ifaddr
*
ifa
);
...
...
@@ -388,6 +389,9 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev)
}
#endif
if
(
netif_carrier_ok
(
dev
))
ndev
->
if_flags
|=
IF_READY
;
write_lock_bh
(
&
addrconf_lock
);
dev
->
ip6_ptr
=
ndev
;
write_unlock_bh
(
&
addrconf_lock
);
...
...
@@ -415,6 +419,7 @@ static struct inet6_dev * ipv6_find_idev(struct net_device *dev)
if
((
idev
=
ipv6_add_dev
(
dev
))
==
NULL
)
return
NULL
;
}
if
(
dev
->
flags
&
IFF_UP
)
ipv6_mc_up
(
idev
);
return
idev
;
...
...
@@ -904,11 +909,18 @@ int ipv6_dev_get_saddr(struct net_device *daddr_dev,
score
.
addr_type
=
__ipv6_addr_type
(
&
ifa
->
addr
);
/* Rule 0: Candidate Source Address (section 4)
/* Rule 0:
* - Tentative Address (RFC2462 section 5.4)
* - A tentative address is not considered
* "assigned to an interface" in the traditional
* sense.
* - Candidate Source Address (section 4)
* - In any case, anycast addresses, multicast
* addresses, and the unspecified address MUST
* NOT be included in a candidate set.
*/
if
(
ifa
->
flags
&
IFA_F_TENTATIVE
)
continue
;
if
(
unlikely
(
score
.
addr_type
==
IPV6_ADDR_ANY
||
score
.
addr_type
&
IPV6_ADDR_MULTICAST
))
{
LIMIT_NETDEBUG
(
KERN_DEBUG
...
...
@@ -1216,10 +1228,8 @@ int ipv6_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2)
/* Gets referenced address, destroys ifaddr */
void
addrconf_dad_
failure
(
struct
inet6_ifaddr
*
ifp
)
void
addrconf_dad_
stop
(
struct
inet6_ifaddr
*
ifp
)
{
if
(
net_ratelimit
())
printk
(
KERN_INFO
"%s: duplicate address detected!
\n
"
,
ifp
->
idev
->
dev
->
name
);
if
(
ifp
->
flags
&
IFA_F_PERMANENT
)
{
spin_lock_bh
(
&
ifp
->
lock
);
addrconf_del_timer
(
ifp
);
...
...
@@ -1245,6 +1255,12 @@ void addrconf_dad_failure(struct inet6_ifaddr *ifp)
ipv6_del_addr
(
ifp
);
}
void
addrconf_dad_failure
(
struct
inet6_ifaddr
*
ifp
)
{
if
(
net_ratelimit
())
printk
(
KERN_INFO
"%s: duplicate address detected!
\n
"
,
ifp
->
idev
->
dev
->
name
);
addrconf_dad_stop
(
ifp
);
}
/* Join to solicited addr multicast group. */
...
...
@@ -2134,9 +2150,42 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event,
{
struct
net_device
*
dev
=
(
struct
net_device
*
)
data
;
struct
inet6_dev
*
idev
=
__in6_dev_get
(
dev
);
int
run_pending
=
0
;
switch
(
event
)
{
case
NETDEV_UP
:
case
NETDEV_CHANGE
:
if
(
event
==
NETDEV_UP
)
{
if
(
!
netif_carrier_ok
(
dev
))
{
/* device is not ready yet. */
printk
(
KERN_INFO
"ADDRCONF(NETDEV_UP): %s: "
"link is not ready
\n
"
,
dev
->
name
);
break
;
}
}
else
{
if
(
!
netif_carrier_ok
(
dev
))
{
/* device is still not ready. */
break
;
}
if
(
idev
)
{
if
(
idev
->
if_flags
&
IF_READY
)
{
/* device is already configured. */
break
;
}
idev
->
if_flags
|=
IF_READY
;
}
printk
(
KERN_INFO
"ADDRCONF(NETDEV_CHANGE): %s: "
"link becomes ready
\n
"
,
dev
->
name
);
run_pending
=
1
;
}
switch
(
dev
->
type
)
{
case
ARPHRD_SIT
:
addrconf_sit_config
(
dev
);
...
...
@@ -2153,6 +2202,9 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event,
break
;
};
if
(
idev
)
{
if
(
run_pending
)
addrconf_dad_run
(
idev
);
/* If the MTU changed during the interface down, when the
interface up, the changed MTU must be reflected in the
idev as well as routers.
...
...
@@ -2187,8 +2239,7 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event,
*/
addrconf_ifdown
(
dev
,
event
!=
NETDEV_DOWN
);
break
;
case
NETDEV_CHANGE
:
break
;
case
NETDEV_CHANGENAME
:
#ifdef CONFIG_SYSCTL
if
(
idev
)
{
...
...
@@ -2269,7 +2320,7 @@ static int addrconf_ifdown(struct net_device *dev, int how)
/* Step 3: clear flags for stateless addrconf */
if
(
how
!=
1
)
idev
->
if_flags
&=
~
(
IF_RS_SENT
|
IF_RA_RCVD
);
idev
->
if_flags
&=
~
(
IF_RS_SENT
|
IF_RA_RCVD
|
IF_READY
);
/* Step 4: clear address list */
#ifdef CONFIG_IPV6_PRIVACY
...
...
@@ -2378,11 +2429,20 @@ static void addrconf_rs_timer(unsigned long data)
/*
* Duplicate Address Detection
*/
static
void
addrconf_dad_kick
(
struct
inet6_ifaddr
*
ifp
)
{
unsigned
long
rand_num
;
struct
inet6_dev
*
idev
=
ifp
->
idev
;
rand_num
=
net_random
()
%
(
idev
->
cnf
.
rtr_solicit_delay
?
:
1
);
ifp
->
probes
=
idev
->
cnf
.
dad_transmits
;
addrconf_mod_timer
(
ifp
,
AC_DAD
,
rand_num
);
}
static
void
addrconf_dad_start
(
struct
inet6_ifaddr
*
ifp
,
u32
flags
)
{
struct
inet6_dev
*
idev
=
ifp
->
idev
;
struct
net_device
*
dev
=
idev
->
dev
;
unsigned
long
rand_num
;
addrconf_join_solict
(
dev
,
&
ifp
->
addr
);
...
...
@@ -2391,7 +2451,6 @@ static void addrconf_dad_start(struct inet6_ifaddr *ifp, u32 flags)
flags
);
net_srandom
(
ifp
->
addr
.
s6_addr32
[
3
]);
rand_num
=
net_random
()
%
(
idev
->
cnf
.
rtr_solicit_delay
?
:
1
);
read_lock_bh
(
&
idev
->
lock
);
if
(
ifp
->
dead
)
...
...
@@ -2408,8 +2467,17 @@ static void addrconf_dad_start(struct inet6_ifaddr *ifp, u32 flags)
return
;
}
ifp
->
probes
=
idev
->
cnf
.
dad_transmits
;
addrconf_mod_timer
(
ifp
,
AC_DAD
,
rand_num
);
if
(
idev
->
if_flags
&
IF_READY
)
addrconf_dad_kick
(
ifp
);
else
{
/*
* If the defice is not ready:
* - keep it tentative if it is a permanent address.
* - otherwise, kill it.
*/
in6_ifa_hold
(
ifp
);
addrconf_dad_stop
(
ifp
);
}
spin_unlock_bh
(
&
ifp
->
lock
);
out:
...
...
@@ -2493,6 +2561,22 @@ static void addrconf_dad_completed(struct inet6_ifaddr *ifp)
}
}
static
void
addrconf_dad_run
(
struct
inet6_dev
*
idev
)
{
struct
inet6_ifaddr
*
ifp
;
read_lock_bh
(
&
idev
->
lock
);
for
(
ifp
=
idev
->
addr_list
;
ifp
;
ifp
=
ifp
->
if_next
)
{
spin_lock_bh
(
&
ifp
->
lock
);
if
(
!
(
ifp
->
flags
&
IFA_F_TENTATIVE
))
{
spin_unlock_bh
(
&
ifp
->
lock
);
continue
;
}
spin_unlock_bh
(
&
ifp
->
lock
);
addrconf_dad_kick
(
ifp
);
}
read_unlock_bh
(
&
idev
->
lock
);
}
#ifdef CONFIG_PROC_FS
struct
if6_iter_state
{
int
bucket
;
...
...
net/ipv6/icmp.c
浏览文件 @
e6469297
...
...
@@ -328,8 +328,10 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
iif
=
skb
->
dev
->
ifindex
;
/*
* Must not send if we know that source is Anycast also.
* for now we don't know that.
* Must not send error if the source does not uniquely
* identify a single node (RFC2463 Section 2.4).
* We check unspecified / multicast addresses here,
* and anycast addresses will be checked later.
*/
if
((
addr_type
==
IPV6_ADDR_ANY
)
||
(
addr_type
&
IPV6_ADDR_MULTICAST
))
{
LIMIT_NETDEBUG
(
KERN_DEBUG
"icmpv6_send: addr_any/mcast source
\n
"
);
...
...
@@ -373,6 +375,16 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
err
=
ip6_dst_lookup
(
sk
,
&
dst
,
&
fl
);
if
(
err
)
goto
out
;
/*
* We won't send icmp if the destination is known
* anycast.
*/
if
(((
struct
rt6_info
*
)
dst
)
->
rt6i_flags
&
RTF_ANYCAST
)
{
LIMIT_NETDEBUG
(
KERN_DEBUG
"icmpv6_send: acast source
\n
"
);
goto
out_dst_release
;
}
if
((
err
=
xfrm_lookup
(
&
dst
,
&
fl
,
sk
,
0
))
<
0
)
goto
out
;
...
...
net/ipv6/route.c
浏览文件 @
e6469297
...
...
@@ -413,11 +413,14 @@ static struct rt6_info *rt6_cow(struct rt6_info *ort, struct in6_addr *daddr,
rt
=
ip6_rt_copy
(
ort
);
if
(
rt
)
{
ipv6_addr_copy
(
&
rt
->
rt6i_dst
.
addr
,
daddr
);
if
(
!
(
rt
->
rt6i_flags
&
RTF_GATEWAY
))
if
(
!
(
rt
->
rt6i_flags
&
RTF_GATEWAY
))
{
if
(
rt
->
rt6i_dst
.
plen
!=
128
&&
ipv6_addr_equal
(
&
rt
->
rt6i_dst
.
addr
,
daddr
))
rt
->
rt6i_flags
|=
RTF_ANYCAST
;
ipv6_addr_copy
(
&
rt
->
rt6i_gateway
,
daddr
);
}
ipv6_addr_copy
(
&
rt
->
rt6i_dst
.
addr
,
daddr
);
rt
->
rt6i_dst
.
plen
=
128
;
rt
->
rt6i_flags
|=
RTF_CACHE
;
rt
->
u
.
dst
.
flags
|=
DST_HOST
;
...
...
@@ -1413,7 +1416,9 @@ struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev,
rt
->
u
.
dst
.
obsolete
=
-
1
;
rt
->
rt6i_flags
=
RTF_UP
|
RTF_NONEXTHOP
;
if
(
!
anycast
)
if
(
anycast
)
rt
->
rt6i_flags
|=
RTF_ANYCAST
;
else
rt
->
rt6i_flags
|=
RTF_LOCAL
;
rt
->
rt6i_nexthop
=
ndisc_get_neigh
(
rt
->
rt6i_dev
,
&
rt
->
rt6i_gateway
);
if
(
rt
->
rt6i_nexthop
==
NULL
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录