Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
aed5a833
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
160
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
aed5a833
编写于
6月 04, 2008
作者:
D
David S. Miller
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'net-2.6-misc-20080605a' of
git://git.linux-ipv6.org/gitroot/yoshfuji/linux-2.6-fix
上级
a6604471
9596cc82
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
146 addition
and
97 deletion
+146
-97
include/net/addrconf.h
include/net/addrconf.h
+22
-0
include/net/sctp/structs.h
include/net/sctp/structs.h
+2
-1
include/net/transp_v6.h
include/net/transp_v6.h
+2
-1
include/net/udp.h
include/net/udp.h
+1
-0
net/ipv4/tunnel4.c
net/ipv4/tunnel4.c
+1
-1
net/ipv4/udp.c
net/ipv4/udp.c
+2
-1
net/ipv6/addrconf.c
net/ipv6/addrconf.c
+58
-49
net/ipv6/datagram.c
net/ipv6/datagram.c
+24
-21
net/ipv6/ip6_flowlabel.c
net/ipv6/ip6_flowlabel.c
+1
-1
net/ipv6/ipv6_sockglue.c
net/ipv6/ipv6_sockglue.c
+16
-5
net/ipv6/raw.c
net/ipv6/raw.c
+1
-1
net/ipv6/route.c
net/ipv6/route.c
+3
-9
net/ipv6/tunnel6.c
net/ipv6/tunnel6.c
+1
-1
net/ipv6/udp.c
net/ipv6/udp.c
+6
-2
net/sctp/ipv6.c
net/sctp/ipv6.c
+3
-2
net/sctp/protocol.c
net/sctp/protocol.c
+2
-1
net/sctp/transport.c
net/sctp/transport.c
+1
-1
未找到文件。
include/net/addrconf.h
浏览文件 @
aed5a833
...
@@ -94,6 +94,28 @@ extern void addrconf_join_solict(struct net_device *dev,
...
@@ -94,6 +94,28 @@ extern void addrconf_join_solict(struct net_device *dev,
extern
void
addrconf_leave_solict
(
struct
inet6_dev
*
idev
,
extern
void
addrconf_leave_solict
(
struct
inet6_dev
*
idev
,
struct
in6_addr
*
addr
);
struct
in6_addr
*
addr
);
static
inline
unsigned
long
addrconf_timeout_fixup
(
u32
timeout
,
unsigned
unit
)
{
if
(
timeout
==
0xffffffff
)
return
~
0UL
;
/*
* Avoid arithmetic overflow.
* Assuming unit is constant and non-zero, this "if" statement
* will go away on 64bit archs.
*/
if
(
0xfffffffe
>
LONG_MAX
/
unit
&&
timeout
>
LONG_MAX
/
unit
)
return
LONG_MAX
/
unit
;
return
timeout
;
}
static
inline
int
addrconf_finite_timeout
(
unsigned
long
timeout
)
{
return
~
timeout
;
}
/*
/*
* IPv6 Address Label subsystem (addrlabel.c)
* IPv6 Address Label subsystem (addrlabel.c)
*/
*/
...
...
include/net/sctp/structs.h
浏览文件 @
aed5a833
...
@@ -548,7 +548,8 @@ struct sctp_af {
...
@@ -548,7 +548,8 @@ struct sctp_af {
struct
dst_entry
*
(
*
get_dst
)
(
struct
sctp_association
*
asoc
,
struct
dst_entry
*
(
*
get_dst
)
(
struct
sctp_association
*
asoc
,
union
sctp_addr
*
daddr
,
union
sctp_addr
*
daddr
,
union
sctp_addr
*
saddr
);
union
sctp_addr
*
saddr
);
void
(
*
get_saddr
)
(
struct
sctp_association
*
asoc
,
void
(
*
get_saddr
)
(
struct
sctp_sock
*
sk
,
struct
sctp_association
*
asoc
,
struct
dst_entry
*
dst
,
struct
dst_entry
*
dst
,
union
sctp_addr
*
daddr
,
union
sctp_addr
*
daddr
,
union
sctp_addr
*
saddr
);
union
sctp_addr
*
saddr
);
...
...
include/net/transp_v6.h
浏览文件 @
aed5a833
...
@@ -40,7 +40,8 @@ extern int datagram_recv_ctl(struct sock *sk,
...
@@ -40,7 +40,8 @@ extern int datagram_recv_ctl(struct sock *sk,
struct
msghdr
*
msg
,
struct
msghdr
*
msg
,
struct
sk_buff
*
skb
);
struct
sk_buff
*
skb
);
extern
int
datagram_send_ctl
(
struct
msghdr
*
msg
,
extern
int
datagram_send_ctl
(
struct
net
*
net
,
struct
msghdr
*
msg
,
struct
flowi
*
fl
,
struct
flowi
*
fl
,
struct
ipv6_txoptions
*
opt
,
struct
ipv6_txoptions
*
opt
,
int
*
hlimit
,
int
*
tclass
);
int
*
hlimit
,
int
*
tclass
);
...
...
include/net/udp.h
浏览文件 @
aed5a833
...
@@ -135,6 +135,7 @@ extern void udp_err(struct sk_buff *, u32);
...
@@ -135,6 +135,7 @@ extern void udp_err(struct sk_buff *, u32);
extern
int
udp_sendmsg
(
struct
kiocb
*
iocb
,
struct
sock
*
sk
,
extern
int
udp_sendmsg
(
struct
kiocb
*
iocb
,
struct
sock
*
sk
,
struct
msghdr
*
msg
,
size_t
len
);
struct
msghdr
*
msg
,
size_t
len
);
extern
void
udp_flush_pending_frames
(
struct
sock
*
sk
);
extern
int
udp_rcv
(
struct
sk_buff
*
skb
);
extern
int
udp_rcv
(
struct
sk_buff
*
skb
);
extern
int
udp_ioctl
(
struct
sock
*
sk
,
int
cmd
,
unsigned
long
arg
);
extern
int
udp_ioctl
(
struct
sock
*
sk
,
int
cmd
,
unsigned
long
arg
);
...
...
net/ipv4/tunnel4.c
浏览文件 @
aed5a833
...
@@ -97,7 +97,7 @@ static int tunnel64_rcv(struct sk_buff *skb)
...
@@ -97,7 +97,7 @@ static int tunnel64_rcv(struct sk_buff *skb)
{
{
struct
xfrm_tunnel
*
handler
;
struct
xfrm_tunnel
*
handler
;
if
(
!
pskb_may_pull
(
skb
,
sizeof
(
struct
iphdr
)))
if
(
!
pskb_may_pull
(
skb
,
sizeof
(
struct
ip
v6
hdr
)))
goto
drop
;
goto
drop
;
for
(
handler
=
tunnel64_handlers
;
handler
;
handler
=
handler
->
next
)
for
(
handler
=
tunnel64_handlers
;
handler
;
handler
=
handler
->
next
)
...
...
net/ipv4/udp.c
浏览文件 @
aed5a833
...
@@ -420,7 +420,7 @@ void udp_err(struct sk_buff *skb, u32 info)
...
@@ -420,7 +420,7 @@ void udp_err(struct sk_buff *skb, u32 info)
/*
/*
* Throw away all pending data and cancel the corking. Socket is locked.
* Throw away all pending data and cancel the corking. Socket is locked.
*/
*/
static
void
udp_flush_pending_frames
(
struct
sock
*
sk
)
void
udp_flush_pending_frames
(
struct
sock
*
sk
)
{
{
struct
udp_sock
*
up
=
udp_sk
(
sk
);
struct
udp_sock
*
up
=
udp_sk
(
sk
);
...
@@ -430,6 +430,7 @@ static void udp_flush_pending_frames(struct sock *sk)
...
@@ -430,6 +430,7 @@ static void udp_flush_pending_frames(struct sock *sk)
ip_flush_pending_frames
(
sk
);
ip_flush_pending_frames
(
sk
);
}
}
}
}
EXPORT_SYMBOL
(
udp_flush_pending_frames
);
/**
/**
* udp4_hwcsum_outgoing - handle outgoing HW checksumming
* udp4_hwcsum_outgoing - handle outgoing HW checksumming
...
...
net/ipv6/addrconf.c
浏览文件 @
aed5a833
...
@@ -731,8 +731,13 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp)
...
@@ -731,8 +731,13 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp)
onlink
=
-
1
;
onlink
=
-
1
;
spin_lock
(
&
ifa
->
lock
);
spin_lock
(
&
ifa
->
lock
);
lifetime
=
min_t
(
unsigned
long
,
ifa
->
valid_lft
,
0x7fffffffUL
/
HZ
);
lifetime
=
addrconf_timeout_fixup
(
ifa
->
valid_lft
,
HZ
);
/*
* Note: Because this address is
* not permanent, lifetime <
* LONG_MAX / HZ here.
*/
if
(
time_before
(
expires
,
if
(
time_before
(
expires
,
ifa
->
tstamp
+
lifetime
*
HZ
))
ifa
->
tstamp
+
lifetime
*
HZ
))
expires
=
ifa
->
tstamp
+
lifetime
*
HZ
;
expires
=
ifa
->
tstamp
+
lifetime
*
HZ
;
...
@@ -1722,7 +1727,6 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len)
...
@@ -1722,7 +1727,6 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len)
__u32
valid_lft
;
__u32
valid_lft
;
__u32
prefered_lft
;
__u32
prefered_lft
;
int
addr_type
;
int
addr_type
;
unsigned
long
rt_expires
;
struct
inet6_dev
*
in6_dev
;
struct
inet6_dev
*
in6_dev
;
pinfo
=
(
struct
prefix_info
*
)
opt
;
pinfo
=
(
struct
prefix_info
*
)
opt
;
...
@@ -1764,28 +1768,23 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len)
...
@@ -1764,28 +1768,23 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len)
* 2) Configure prefixes with the auto flag set
* 2) Configure prefixes with the auto flag set
*/
*/
if
(
valid_lft
==
INFINITY_LIFE_TIME
)
if
(
pinfo
->
onlink
)
{
rt_expires
=
~
0UL
;
struct
rt6_info
*
rt
;
else
if
(
valid_lft
>=
0x7FFFFFFF
/
HZ
)
{
unsigned
long
rt_expires
;
/* Avoid arithmetic overflow. Really, we could
/* Avoid arithmetic overflow. Really, we could
* save rt_expires in seconds, likely valid_lft,
* save rt_expires in seconds, likely valid_lft,
* but it would require division in fib gc, that it
* but it would require division in fib gc, that it
* not good.
* not good.
*/
*/
rt_expires
=
0x7FFFFFFF
-
(
0x7FFFFFFF
%
HZ
);
if
(
HZ
>
USER_HZ
)
}
else
rt_expires
=
addrconf_timeout_fixup
(
valid_lft
,
HZ
);
rt_expires
=
valid_lft
*
HZ
;
else
rt_expires
=
addrconf_timeout_fixup
(
valid_lft
,
USER_HZ
);
/*
if
(
addrconf_finite_timeout
(
rt_expires
))
* We convert this (in jiffies) to clock_t later.
rt_expires
*=
HZ
;
* Avoid arithmetic overflow there as well.
* Overflow can happen only if HZ < USER_HZ.
*/
if
(
HZ
<
USER_HZ
&&
~
rt_expires
&&
rt_expires
>
0x7FFFFFFF
/
USER_HZ
)
rt_expires
=
0x7FFFFFFF
/
USER_HZ
;
if
(
pinfo
->
onlink
)
{
struct
rt6_info
*
rt
;
rt
=
rt6_lookup
(
dev_net
(
dev
),
&
pinfo
->
prefix
,
NULL
,
rt
=
rt6_lookup
(
dev_net
(
dev
),
&
pinfo
->
prefix
,
NULL
,
dev
->
ifindex
,
1
);
dev
->
ifindex
,
1
);
...
@@ -1794,7 +1793,7 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len)
...
@@ -1794,7 +1793,7 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len)
if
(
valid_lft
==
0
)
{
if
(
valid_lft
==
0
)
{
ip6_del_rt
(
rt
);
ip6_del_rt
(
rt
);
rt
=
NULL
;
rt
=
NULL
;
}
else
if
(
~
rt_expires
)
{
}
else
if
(
addrconf_finite_timeout
(
rt_expires
)
)
{
/* not infinity */
/* not infinity */
rt
->
rt6i_expires
=
jiffies
+
rt_expires
;
rt
->
rt6i_expires
=
jiffies
+
rt_expires
;
rt
->
rt6i_flags
|=
RTF_EXPIRES
;
rt
->
rt6i_flags
|=
RTF_EXPIRES
;
...
@@ -1803,9 +1802,9 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len)
...
@@ -1803,9 +1802,9 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len)
rt
->
rt6i_expires
=
0
;
rt
->
rt6i_expires
=
0
;
}
}
}
else
if
(
valid_lft
)
{
}
else
if
(
valid_lft
)
{
int
flags
=
RTF_ADDRCONF
|
RTF_PREFIX_RT
;
clock_t
expires
=
0
;
clock_t
expires
=
0
;
if
(
~
rt_expires
)
{
int
flags
=
RTF_ADDRCONF
|
RTF_PREFIX_RT
;
if
(
addrconf_finite_timeout
(
rt_expires
))
{
/* not infinity */
/* not infinity */
flags
|=
RTF_EXPIRES
;
flags
|=
RTF_EXPIRES
;
expires
=
jiffies_to_clock_t
(
rt_expires
);
expires
=
jiffies_to_clock_t
(
rt_expires
);
...
@@ -2027,7 +2026,7 @@ int addrconf_set_dstaddr(struct net *net, void __user *arg)
...
@@ -2027,7 +2026,7 @@ int addrconf_set_dstaddr(struct net *net, void __user *arg)
* Manual configuration of address on an interface
* Manual configuration of address on an interface
*/
*/
static
int
inet6_addr_add
(
struct
net
*
net
,
int
ifindex
,
struct
in6_addr
*
pfx
,
static
int
inet6_addr_add
(
struct
net
*
net
,
int
ifindex
,
struct
in6_addr
*
pfx
,
int
plen
,
__u8
ifa_flags
,
__u32
prefered_lft
,
unsigned
int
plen
,
__u8
ifa_flags
,
__u32
prefered_lft
,
__u32
valid_lft
)
__u32
valid_lft
)
{
{
struct
inet6_ifaddr
*
ifp
;
struct
inet6_ifaddr
*
ifp
;
...
@@ -2036,9 +2035,13 @@ static int inet6_addr_add(struct net *net, int ifindex, struct in6_addr *pfx,
...
@@ -2036,9 +2035,13 @@ static int inet6_addr_add(struct net *net, int ifindex, struct in6_addr *pfx,
int
scope
;
int
scope
;
u32
flags
;
u32
flags
;
clock_t
expires
;
clock_t
expires
;
unsigned
long
timeout
;
ASSERT_RTNL
();
ASSERT_RTNL
();
if
(
plen
>
128
)
return
-
EINVAL
;
/* check the lifetime */
/* check the lifetime */
if
(
!
valid_lft
||
prefered_lft
>
valid_lft
)
if
(
!
valid_lft
||
prefered_lft
>
valid_lft
)
return
-
EINVAL
;
return
-
EINVAL
;
...
@@ -2052,22 +2055,23 @@ static int inet6_addr_add(struct net *net, int ifindex, struct in6_addr *pfx,
...
@@ -2052,22 +2055,23 @@ static int inet6_addr_add(struct net *net, int ifindex, struct in6_addr *pfx,
scope
=
ipv6_addr_scope
(
pfx
);
scope
=
ipv6_addr_scope
(
pfx
);
if
(
valid_lft
==
INFINITY_LIFE_TIME
)
{
timeout
=
addrconf_timeout_fixup
(
valid_lft
,
HZ
);
ifa_flags
|=
IFA_F_PERMANENT
;
if
(
addrconf_finite_timeout
(
timeout
))
{
flags
=
0
;
expires
=
jiffies_to_clock_t
(
timeout
*
HZ
);
expires
=
0
;
valid_lft
=
timeout
;
}
else
{
if
(
valid_lft
>=
0x7FFFFFFF
/
HZ
)
valid_lft
=
0x7FFFFFFF
/
HZ
;
flags
=
RTF_EXPIRES
;
flags
=
RTF_EXPIRES
;
expires
=
jiffies_to_clock_t
(
valid_lft
*
HZ
);
}
else
{
expires
=
0
;
flags
=
0
;
ifa_flags
|=
IFA_F_PERMANENT
;
}
}
if
(
prefered_lft
==
0
)
timeout
=
addrconf_timeout_fixup
(
prefered_lft
,
HZ
);
ifa_flags
|=
IFA_F_DEPRECATED
;
if
(
addrconf_finite_timeout
(
timeout
))
{
else
if
((
prefered_lft
>=
0x7FFFFFFF
/
HZ
)
&&
if
(
timeout
==
0
)
(
prefered_lft
!=
INFINITY_LIFE_TIME
))
ifa_flags
|=
IFA_F_DEPRECATED
;
prefered_lft
=
0x7FFFFFFF
/
HZ
;
prefered_lft
=
timeout
;
}
ifp
=
ipv6_add_addr
(
idev
,
pfx
,
plen
,
scope
,
ifa_flags
);
ifp
=
ipv6_add_addr
(
idev
,
pfx
,
plen
,
scope
,
ifa_flags
);
...
@@ -2095,12 +2099,15 @@ static int inet6_addr_add(struct net *net, int ifindex, struct in6_addr *pfx,
...
@@ -2095,12 +2099,15 @@ static int inet6_addr_add(struct net *net, int ifindex, struct in6_addr *pfx,
}
}
static
int
inet6_addr_del
(
struct
net
*
net
,
int
ifindex
,
struct
in6_addr
*
pfx
,
static
int
inet6_addr_del
(
struct
net
*
net
,
int
ifindex
,
struct
in6_addr
*
pfx
,
int
plen
)
unsigned
int
plen
)
{
{
struct
inet6_ifaddr
*
ifp
;
struct
inet6_ifaddr
*
ifp
;
struct
inet6_dev
*
idev
;
struct
inet6_dev
*
idev
;
struct
net_device
*
dev
;
struct
net_device
*
dev
;
if
(
plen
>
128
)
return
-
EINVAL
;
dev
=
__dev_get_by_index
(
net
,
ifindex
);
dev
=
__dev_get_by_index
(
net
,
ifindex
);
if
(
!
dev
)
if
(
!
dev
)
return
-
ENODEV
;
return
-
ENODEV
;
...
@@ -3169,26 +3176,28 @@ static int inet6_addr_modify(struct inet6_ifaddr *ifp, u8 ifa_flags,
...
@@ -3169,26 +3176,28 @@ static int inet6_addr_modify(struct inet6_ifaddr *ifp, u8 ifa_flags,
{
{
u32
flags
;
u32
flags
;
clock_t
expires
;
clock_t
expires
;
unsigned
long
timeout
;
if
(
!
valid_lft
||
(
prefered_lft
>
valid_lft
))
if
(
!
valid_lft
||
(
prefered_lft
>
valid_lft
))
return
-
EINVAL
;
return
-
EINVAL
;
if
(
valid_lft
==
INFINITY_LIFE_TIME
)
{
timeout
=
addrconf_timeout_fixup
(
valid_lft
,
HZ
);
ifa_flags
|=
IFA_F_PERMANENT
;
if
(
addrconf_finite_timeout
(
timeout
))
{
flags
=
0
;
expires
=
jiffies_to_clock_t
(
timeout
*
HZ
);
expires
=
0
;
valid_lft
=
timeout
;
}
else
{
if
(
valid_lft
>=
0x7FFFFFFF
/
HZ
)
valid_lft
=
0x7FFFFFFF
/
HZ
;
flags
=
RTF_EXPIRES
;
flags
=
RTF_EXPIRES
;
expires
=
jiffies_to_clock_t
(
valid_lft
*
HZ
);
}
else
{
expires
=
0
;
flags
=
0
;
ifa_flags
|=
IFA_F_PERMANENT
;
}
}
if
(
prefered_lft
==
0
)
timeout
=
addrconf_timeout_fixup
(
prefered_lft
,
HZ
);
ifa_flags
|=
IFA_F_DEPRECATED
;
if
(
addrconf_finite_timeout
(
timeout
))
{
else
if
((
prefered_lft
>=
0x7FFFFFFF
/
HZ
)
&&
if
(
timeout
==
0
)
(
prefered_lft
!=
INFINITY_LIFE_TIME
))
ifa_flags
|=
IFA_F_DEPRECATED
;
prefered_lft
=
0x7FFFFFFF
/
HZ
;
prefered_lft
=
timeout
;
}
spin_lock_bh
(
&
ifp
->
lock
);
spin_lock_bh
(
&
ifp
->
lock
);
ifp
->
flags
=
(
ifp
->
flags
&
~
(
IFA_F_DEPRECATED
|
IFA_F_PERMANENT
|
IFA_F_NODAD
|
IFA_F_HOMEADDRESS
))
|
ifa_flags
;
ifp
->
flags
=
(
ifp
->
flags
&
~
(
IFA_F_DEPRECATED
|
IFA_F_PERMANENT
|
IFA_F_NODAD
|
IFA_F_HOMEADDRESS
))
|
ifa_flags
;
...
...
net/ipv6/datagram.c
浏览文件 @
aed5a833
...
@@ -496,7 +496,8 @@ int datagram_recv_ctl(struct sock *sk, struct msghdr *msg, struct sk_buff *skb)
...
@@ -496,7 +496,8 @@ int datagram_recv_ctl(struct sock *sk, struct msghdr *msg, struct sk_buff *skb)
return
0
;
return
0
;
}
}
int
datagram_send_ctl
(
struct
msghdr
*
msg
,
struct
flowi
*
fl
,
int
datagram_send_ctl
(
struct
net
*
net
,
struct
msghdr
*
msg
,
struct
flowi
*
fl
,
struct
ipv6_txoptions
*
opt
,
struct
ipv6_txoptions
*
opt
,
int
*
hlimit
,
int
*
tclass
)
int
*
hlimit
,
int
*
tclass
)
{
{
...
@@ -509,7 +510,6 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl,
...
@@ -509,7 +510,6 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl,
for
(
cmsg
=
CMSG_FIRSTHDR
(
msg
);
cmsg
;
cmsg
=
CMSG_NXTHDR
(
msg
,
cmsg
))
{
for
(
cmsg
=
CMSG_FIRSTHDR
(
msg
);
cmsg
;
cmsg
=
CMSG_NXTHDR
(
msg
,
cmsg
))
{
int
addr_type
;
int
addr_type
;
struct
net_device
*
dev
=
NULL
;
if
(
!
CMSG_OK
(
msg
,
cmsg
))
{
if
(
!
CMSG_OK
(
msg
,
cmsg
))
{
err
=
-
EINVAL
;
err
=
-
EINVAL
;
...
@@ -522,6 +522,9 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl,
...
@@ -522,6 +522,9 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl,
switch
(
cmsg
->
cmsg_type
)
{
switch
(
cmsg
->
cmsg_type
)
{
case
IPV6_PKTINFO
:
case
IPV6_PKTINFO
:
case
IPV6_2292PKTINFO
:
case
IPV6_2292PKTINFO
:
{
struct
net_device
*
dev
=
NULL
;
if
(
cmsg
->
cmsg_len
<
CMSG_LEN
(
sizeof
(
struct
in6_pktinfo
)))
{
if
(
cmsg
->
cmsg_len
<
CMSG_LEN
(
sizeof
(
struct
in6_pktinfo
)))
{
err
=
-
EINVAL
;
err
=
-
EINVAL
;
goto
exit_f
;
goto
exit_f
;
...
@@ -535,32 +538,32 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl,
...
@@ -535,32 +538,32 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl,
fl
->
oif
=
src_info
->
ipi6_ifindex
;
fl
->
oif
=
src_info
->
ipi6_ifindex
;
}
}
addr_type
=
ipv6_addr_type
(
&
src_info
->
ipi6_addr
);
addr_type
=
__
ipv6_addr_type
(
&
src_info
->
ipi6_addr
);
if
(
addr_type
==
IPV6_ADDR_ANY
)
if
(
fl
->
oif
)
{
break
;
dev
=
dev_get_by_index
(
net
,
fl
->
oif
);
if
(
!
dev
)
return
-
ENODEV
;
}
else
if
(
addr_type
&
IPV6_ADDR_LINKLOCAL
)
return
-
EINVAL
;
if
(
addr_type
&
IPV6_ADDR_LINKLOCAL
)
{
if
(
addr_type
!=
IPV6_ADDR_ANY
)
{
if
(
!
src_info
->
ipi6_ifindex
)
int
strict
=
__ipv6_addr_src_scope
(
addr_type
)
<=
IPV6_ADDR_SCOPE_LINKLOCAL
;
return
-
EINVAL
;
if
(
!
ipv6_chk_addr
(
net
,
&
src_info
->
ipi6_addr
,
else
{
strict
?
dev
:
NULL
,
0
))
dev
=
dev_get_by_index
(
&
init_net
,
src_info
->
ipi6_ifindex
);
err
=
-
EINVAL
;
if
(
!
dev
)
else
return
-
ENODEV
;
ipv6_addr_copy
(
&
fl
->
fl6_src
,
&
src_info
->
ipi6_addr
);
}
}
if
(
!
ipv6_chk_addr
(
&
init_net
,
&
src_info
->
ipi6_addr
,
dev
,
0
))
{
if
(
dev
)
dev_put
(
dev
);
err
=
-
EINVAL
;
goto
exit_f
;
}
}
if
(
dev
)
if
(
dev
)
dev_put
(
dev
);
dev_put
(
dev
);
ipv6_addr_copy
(
&
fl
->
fl6_src
,
&
src_info
->
ipi6_addr
);
if
(
err
)
goto
exit_f
;
break
;
break
;
}
case
IPV6_FLOWINFO
:
case
IPV6_FLOWINFO
:
if
(
cmsg
->
cmsg_len
<
CMSG_LEN
(
4
))
{
if
(
cmsg
->
cmsg_len
<
CMSG_LEN
(
4
))
{
...
...
net/ipv6/ip6_flowlabel.c
浏览文件 @
aed5a833
...
@@ -354,7 +354,7 @@ fl_create(struct net *net, struct in6_flowlabel_req *freq, char __user *optval,
...
@@ -354,7 +354,7 @@ fl_create(struct net *net, struct in6_flowlabel_req *freq, char __user *optval,
msg
.
msg_control
=
(
void
*
)(
fl
->
opt
+
1
);
msg
.
msg_control
=
(
void
*
)(
fl
->
opt
+
1
);
flowi
.
oif
=
0
;
flowi
.
oif
=
0
;
err
=
datagram_send_ctl
(
&
msg
,
&
flowi
,
fl
->
opt
,
&
junk
,
&
junk
);
err
=
datagram_send_ctl
(
net
,
&
msg
,
&
flowi
,
fl
->
opt
,
&
junk
,
&
junk
);
if
(
err
)
if
(
err
)
goto
done
;
goto
done
;
err
=
-
EINVAL
;
err
=
-
EINVAL
;
...
...
net/ipv6/ipv6_sockglue.c
浏览文件 @
aed5a833
...
@@ -161,9 +161,17 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
...
@@ -161,9 +161,17 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
struct
ipv6_txoptions
*
opt
;
struct
ipv6_txoptions
*
opt
;
struct
sk_buff
*
pktopt
;
struct
sk_buff
*
pktopt
;
if
(
sk
->
sk_protocol
!=
IPPROTO_UDP
&&
if
(
sk
->
sk_type
==
SOCK_RAW
)
sk
->
sk_protocol
!=
IPPROTO_UDPLITE
&&
break
;
sk
->
sk_protocol
!=
IPPROTO_TCP
)
if
(
sk
->
sk_protocol
==
IPPROTO_UDP
||
sk
->
sk_protocol
==
IPPROTO_UDPLITE
)
{
struct
udp_sock
*
up
=
udp_sk
(
sk
);
if
(
up
->
pending
==
AF_INET6
)
{
retv
=
-
EBUSY
;
break
;
}
}
else
if
(
sk
->
sk_protocol
!=
IPPROTO_TCP
)
break
;
break
;
if
(
sk
->
sk_state
!=
TCP_ESTABLISHED
)
{
if
(
sk
->
sk_state
!=
TCP_ESTABLISHED
)
{
...
@@ -416,7 +424,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
...
@@ -416,7 +424,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
msg
.
msg_controllen
=
optlen
;
msg
.
msg_controllen
=
optlen
;
msg
.
msg_control
=
(
void
*
)(
opt
+
1
);
msg
.
msg_control
=
(
void
*
)(
opt
+
1
);
retv
=
datagram_send_ctl
(
&
msg
,
&
fl
,
opt
,
&
junk
,
&
junk
);
retv
=
datagram_send_ctl
(
net
,
&
msg
,
&
fl
,
opt
,
&
junk
,
&
junk
);
if
(
retv
)
if
(
retv
)
goto
done
;
goto
done
;
update:
update:
...
@@ -832,7 +840,7 @@ static int ipv6_getsockopt_sticky(struct sock *sk, struct ipv6_txoptions *opt,
...
@@ -832,7 +840,7 @@ static int ipv6_getsockopt_sticky(struct sock *sk, struct ipv6_txoptions *opt,
len
=
min_t
(
unsigned
int
,
len
,
ipv6_optlen
(
hdr
));
len
=
min_t
(
unsigned
int
,
len
,
ipv6_optlen
(
hdr
));
if
(
copy_to_user
(
optval
,
hdr
,
len
))
if
(
copy_to_user
(
optval
,
hdr
,
len
))
return
-
EFAULT
;
return
-
EFAULT
;
return
ipv6_optlen
(
hdr
)
;
return
len
;
}
}
static
int
do_ipv6_getsockopt
(
struct
sock
*
sk
,
int
level
,
int
optname
,
static
int
do_ipv6_getsockopt
(
struct
sock
*
sk
,
int
level
,
int
optname
,
...
@@ -975,6 +983,9 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
...
@@ -975,6 +983,9 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
len
=
ipv6_getsockopt_sticky
(
sk
,
np
->
opt
,
len
=
ipv6_getsockopt_sticky
(
sk
,
np
->
opt
,
optname
,
optval
,
len
);
optname
,
optval
,
len
);
release_sock
(
sk
);
release_sock
(
sk
);
/* check if ipv6_getsockopt_sticky() returns err code */
if
(
len
<
0
)
return
len
;
return
put_user
(
len
,
optlen
);
return
put_user
(
len
,
optlen
);
}
}
...
...
net/ipv6/raw.c
浏览文件 @
aed5a833
...
@@ -813,7 +813,7 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
...
@@ -813,7 +813,7 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
memset
(
opt
,
0
,
sizeof
(
struct
ipv6_txoptions
));
memset
(
opt
,
0
,
sizeof
(
struct
ipv6_txoptions
));
opt
->
tot_len
=
sizeof
(
struct
ipv6_txoptions
);
opt
->
tot_len
=
sizeof
(
struct
ipv6_txoptions
);
err
=
datagram_send_ctl
(
msg
,
&
fl
,
opt
,
&
hlimit
,
&
tclass
);
err
=
datagram_send_ctl
(
sock_net
(
sk
),
msg
,
&
fl
,
opt
,
&
hlimit
,
&
tclass
);
if
(
err
<
0
)
{
if
(
err
<
0
)
{
fl6_sock_release
(
flowlabel
);
fl6_sock_release
(
flowlabel
);
return
err
;
return
err
;
...
...
net/ipv6/route.c
浏览文件 @
aed5a833
...
@@ -446,7 +446,7 @@ int rt6_route_rcv(struct net_device *dev, u8 *opt, int len,
...
@@ -446,7 +446,7 @@ int rt6_route_rcv(struct net_device *dev, u8 *opt, int len,
struct
route_info
*
rinfo
=
(
struct
route_info
*
)
opt
;
struct
route_info
*
rinfo
=
(
struct
route_info
*
)
opt
;
struct
in6_addr
prefix_buf
,
*
prefix
;
struct
in6_addr
prefix_buf
,
*
prefix
;
unsigned
int
pref
;
unsigned
int
pref
;
u
32
lifetime
;
u
nsigned
long
lifetime
;
struct
rt6_info
*
rt
;
struct
rt6_info
*
rt
;
if
(
len
<
sizeof
(
struct
route_info
))
{
if
(
len
<
sizeof
(
struct
route_info
))
{
...
@@ -472,13 +472,7 @@ int rt6_route_rcv(struct net_device *dev, u8 *opt, int len,
...
@@ -472,13 +472,7 @@ int rt6_route_rcv(struct net_device *dev, u8 *opt, int len,
if
(
pref
==
ICMPV6_ROUTER_PREF_INVALID
)
if
(
pref
==
ICMPV6_ROUTER_PREF_INVALID
)
pref
=
ICMPV6_ROUTER_PREF_MEDIUM
;
pref
=
ICMPV6_ROUTER_PREF_MEDIUM
;
lifetime
=
ntohl
(
rinfo
->
lifetime
);
lifetime
=
addrconf_timeout_fixup
(
ntohl
(
rinfo
->
lifetime
),
HZ
);
if
(
lifetime
==
0xffffffff
)
{
/* infinity */
}
else
if
(
lifetime
>
0x7fffffff
/
HZ
-
1
)
{
/* Avoid arithmetic overflow */
lifetime
=
0x7fffffff
/
HZ
-
1
;
}
if
(
rinfo
->
length
==
3
)
if
(
rinfo
->
length
==
3
)
prefix
=
(
struct
in6_addr
*
)
rinfo
->
prefix
;
prefix
=
(
struct
in6_addr
*
)
rinfo
->
prefix
;
...
@@ -506,7 +500,7 @@ int rt6_route_rcv(struct net_device *dev, u8 *opt, int len,
...
@@ -506,7 +500,7 @@ int rt6_route_rcv(struct net_device *dev, u8 *opt, int len,
(
rt
->
rt6i_flags
&
~
RTF_PREF_MASK
)
|
RTF_PREF
(
pref
);
(
rt
->
rt6i_flags
&
~
RTF_PREF_MASK
)
|
RTF_PREF
(
pref
);
if
(
rt
)
{
if
(
rt
)
{
if
(
lifetime
==
0xffffffff
)
{
if
(
!
addrconf_finite_timeout
(
lifetime
)
)
{
rt
->
rt6i_flags
&=
~
RTF_EXPIRES
;
rt
->
rt6i_flags
&=
~
RTF_EXPIRES
;
}
else
{
}
else
{
rt
->
rt6i_expires
=
jiffies
+
HZ
*
lifetime
;
rt
->
rt6i_expires
=
jiffies
+
HZ
*
lifetime
;
...
...
net/ipv6/tunnel6.c
浏览文件 @
aed5a833
...
@@ -109,7 +109,7 @@ static int tunnel46_rcv(struct sk_buff *skb)
...
@@ -109,7 +109,7 @@ static int tunnel46_rcv(struct sk_buff *skb)
{
{
struct
xfrm6_tunnel
*
handler
;
struct
xfrm6_tunnel
*
handler
;
if
(
!
pskb_may_pull
(
skb
,
sizeof
(
struct
ip
v6
hdr
)))
if
(
!
pskb_may_pull
(
skb
,
sizeof
(
struct
iphdr
)))
goto
drop
;
goto
drop
;
for
(
handler
=
tunnel46_handlers
;
handler
;
handler
=
handler
->
next
)
for
(
handler
=
tunnel46_handlers
;
handler
;
handler
=
handler
->
next
)
...
...
net/ipv6/udp.c
浏览文件 @
aed5a833
...
@@ -534,7 +534,9 @@ static void udp_v6_flush_pending_frames(struct sock *sk)
...
@@ -534,7 +534,9 @@ static void udp_v6_flush_pending_frames(struct sock *sk)
{
{
struct
udp_sock
*
up
=
udp_sk
(
sk
);
struct
udp_sock
*
up
=
udp_sk
(
sk
);
if
(
up
->
pending
)
{
if
(
up
->
pending
==
AF_INET
)
udp_flush_pending_frames
(
sk
);
else
if
(
up
->
pending
)
{
up
->
len
=
0
;
up
->
len
=
0
;
up
->
pending
=
0
;
up
->
pending
=
0
;
ip6_flush_pending_frames
(
sk
);
ip6_flush_pending_frames
(
sk
);
...
@@ -731,7 +733,7 @@ int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk,
...
@@ -731,7 +733,7 @@ int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk,
memset
(
opt
,
0
,
sizeof
(
struct
ipv6_txoptions
));
memset
(
opt
,
0
,
sizeof
(
struct
ipv6_txoptions
));
opt
->
tot_len
=
sizeof
(
*
opt
);
opt
->
tot_len
=
sizeof
(
*
opt
);
err
=
datagram_send_ctl
(
msg
,
&
fl
,
opt
,
&
hlimit
,
&
tclass
);
err
=
datagram_send_ctl
(
sock_net
(
sk
),
msg
,
&
fl
,
opt
,
&
hlimit
,
&
tclass
);
if
(
err
<
0
)
{
if
(
err
<
0
)
{
fl6_sock_release
(
flowlabel
);
fl6_sock_release
(
flowlabel
);
return
err
;
return
err
;
...
@@ -848,12 +850,14 @@ int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk,
...
@@ -848,12 +850,14 @@ int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk,
}
else
{
}
else
{
dst_release
(
dst
);
dst_release
(
dst
);
}
}
dst
=
NULL
;
}
}
if
(
err
>
0
)
if
(
err
>
0
)
err
=
np
->
recverr
?
net_xmit_errno
(
err
)
:
0
;
err
=
np
->
recverr
?
net_xmit_errno
(
err
)
:
0
;
release_sock
(
sk
);
release_sock
(
sk
);
out:
out:
dst_release
(
dst
);
fl6_sock_release
(
flowlabel
);
fl6_sock_release
(
flowlabel
);
if
(
!
err
)
if
(
!
err
)
return
len
;
return
len
;
...
...
net/sctp/ipv6.c
浏览文件 @
aed5a833
...
@@ -299,7 +299,8 @@ static inline int sctp_v6_addr_match_len(union sctp_addr *s1,
...
@@ -299,7 +299,8 @@ static inline int sctp_v6_addr_match_len(union sctp_addr *s1,
/* Fills in the source address(saddr) based on the destination address(daddr)
/* Fills in the source address(saddr) based on the destination address(daddr)
* and asoc's bind address list.
* and asoc's bind address list.
*/
*/
static
void
sctp_v6_get_saddr
(
struct
sctp_association
*
asoc
,
static
void
sctp_v6_get_saddr
(
struct
sctp_sock
*
sk
,
struct
sctp_association
*
asoc
,
struct
dst_entry
*
dst
,
struct
dst_entry
*
dst
,
union
sctp_addr
*
daddr
,
union
sctp_addr
*
daddr
,
union
sctp_addr
*
saddr
)
union
sctp_addr
*
saddr
)
...
@@ -318,7 +319,7 @@ static void sctp_v6_get_saddr(struct sctp_association *asoc,
...
@@ -318,7 +319,7 @@ static void sctp_v6_get_saddr(struct sctp_association *asoc,
if
(
!
asoc
)
{
if
(
!
asoc
)
{
ipv6_dev_get_saddr
(
dst
?
ip6_dst_idev
(
dst
)
->
dev
:
NULL
,
ipv6_dev_get_saddr
(
dst
?
ip6_dst_idev
(
dst
)
->
dev
:
NULL
,
&
daddr
->
v6
.
sin6_addr
,
&
daddr
->
v6
.
sin6_addr
,
inet6_sk
(
asoc
->
base
.
sk
)
->
srcprefs
,
inet6_sk
(
&
sk
->
inet
.
sk
)
->
srcprefs
,
&
saddr
->
v6
.
sin6_addr
);
&
saddr
->
v6
.
sin6_addr
);
SCTP_DEBUG_PRINTK
(
"saddr from ipv6_get_saddr: "
NIP6_FMT
"
\n
"
,
SCTP_DEBUG_PRINTK
(
"saddr from ipv6_get_saddr: "
NIP6_FMT
"
\n
"
,
NIP6
(
saddr
->
v6
.
sin6_addr
));
NIP6
(
saddr
->
v6
.
sin6_addr
));
...
...
net/sctp/protocol.c
浏览文件 @
aed5a833
...
@@ -519,7 +519,8 @@ static struct dst_entry *sctp_v4_get_dst(struct sctp_association *asoc,
...
@@ -519,7 +519,8 @@ static struct dst_entry *sctp_v4_get_dst(struct sctp_association *asoc,
/* For v4, the source address is cached in the route entry(dst). So no need
/* For v4, the source address is cached in the route entry(dst). So no need
* to cache it separately and hence this is an empty routine.
* to cache it separately and hence this is an empty routine.
*/
*/
static
void
sctp_v4_get_saddr
(
struct
sctp_association
*
asoc
,
static
void
sctp_v4_get_saddr
(
struct
sctp_sock
*
sk
,
struct
sctp_association
*
asoc
,
struct
dst_entry
*
dst
,
struct
dst_entry
*
dst
,
union
sctp_addr
*
daddr
,
union
sctp_addr
*
daddr
,
union
sctp_addr
*
saddr
)
union
sctp_addr
*
saddr
)
...
...
net/sctp/transport.c
浏览文件 @
aed5a833
...
@@ -291,7 +291,7 @@ void sctp_transport_route(struct sctp_transport *transport,
...
@@ -291,7 +291,7 @@ void sctp_transport_route(struct sctp_transport *transport,
if
(
saddr
)
if
(
saddr
)
memcpy
(
&
transport
->
saddr
,
saddr
,
sizeof
(
union
sctp_addr
));
memcpy
(
&
transport
->
saddr
,
saddr
,
sizeof
(
union
sctp_addr
));
else
else
af
->
get_saddr
(
asoc
,
dst
,
daddr
,
&
transport
->
saddr
);
af
->
get_saddr
(
opt
,
asoc
,
dst
,
daddr
,
&
transport
->
saddr
);
transport
->
dst
=
dst
;
transport
->
dst
=
dst
;
if
((
transport
->
param_flags
&
SPP_PMTUD_DISABLE
)
&&
transport
->
pathmtu
)
{
if
((
transport
->
param_flags
&
SPP_PMTUD_DISABLE
)
&&
transport
->
pathmtu
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录