Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
662397fd
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
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看板
提交
662397fd
编写于
2月 27, 2008
作者:
Y
YOSHIFUJI Hideaki
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[IPV6]: Move packet_type{} related bits to af_inet6.c.
Signed-off-by:
N
YOSHIFUJI Hideaki
<
yoshfuji@linux-ipv6.org
>
上级
db1ed684
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
123 addition
and
126 deletion
+123
-126
include/net/ipv6.h
include/net/ipv6.h
+0
-4
net/ipv6/af_inet6.c
net/ipv6/af_inet6.c
+123
-0
net/ipv6/ipv6_sockglue.c
net/ipv6/ipv6_sockglue.c
+0
-122
未找到文件。
include/net/ipv6.h
浏览文件 @
662397fd
...
...
@@ -555,10 +555,6 @@ extern int compat_ipv6_getsockopt(struct sock *sk,
char
__user
*
optval
,
int
__user
*
optlen
);
extern
int
ipv6_packet_init
(
void
);
extern
void
ipv6_packet_cleanup
(
void
);
extern
int
ip6_datagram_connect
(
struct
sock
*
sk
,
struct
sockaddr
*
addr
,
int
addr_len
);
...
...
net/ipv6/af_inet6.c
浏览文件 @
662397fd
...
...
@@ -678,6 +678,129 @@ int ipv6_opt_accepted(struct sock *sk, struct sk_buff *skb)
EXPORT_SYMBOL_GPL
(
ipv6_opt_accepted
);
static
struct
inet6_protocol
*
ipv6_gso_pull_exthdrs
(
struct
sk_buff
*
skb
,
int
proto
)
{
struct
inet6_protocol
*
ops
=
NULL
;
for
(;;)
{
struct
ipv6_opt_hdr
*
opth
;
int
len
;
if
(
proto
!=
NEXTHDR_HOP
)
{
ops
=
rcu_dereference
(
inet6_protos
[
proto
]);
if
(
unlikely
(
!
ops
))
break
;
if
(
!
(
ops
->
flags
&
INET6_PROTO_GSO_EXTHDR
))
break
;
}
if
(
unlikely
(
!
pskb_may_pull
(
skb
,
8
)))
break
;
opth
=
(
void
*
)
skb
->
data
;
len
=
ipv6_optlen
(
opth
);
if
(
unlikely
(
!
pskb_may_pull
(
skb
,
len
)))
break
;
proto
=
opth
->
nexthdr
;
__skb_pull
(
skb
,
len
);
}
return
ops
;
}
static
int
ipv6_gso_send_check
(
struct
sk_buff
*
skb
)
{
struct
ipv6hdr
*
ipv6h
;
struct
inet6_protocol
*
ops
;
int
err
=
-
EINVAL
;
if
(
unlikely
(
!
pskb_may_pull
(
skb
,
sizeof
(
*
ipv6h
))))
goto
out
;
ipv6h
=
ipv6_hdr
(
skb
);
__skb_pull
(
skb
,
sizeof
(
*
ipv6h
));
err
=
-
EPROTONOSUPPORT
;
rcu_read_lock
();
ops
=
ipv6_gso_pull_exthdrs
(
skb
,
ipv6h
->
nexthdr
);
if
(
likely
(
ops
&&
ops
->
gso_send_check
))
{
skb_reset_transport_header
(
skb
);
err
=
ops
->
gso_send_check
(
skb
);
}
rcu_read_unlock
();
out:
return
err
;
}
static
struct
sk_buff
*
ipv6_gso_segment
(
struct
sk_buff
*
skb
,
int
features
)
{
struct
sk_buff
*
segs
=
ERR_PTR
(
-
EINVAL
);
struct
ipv6hdr
*
ipv6h
;
struct
inet6_protocol
*
ops
;
if
(
!
(
features
&
NETIF_F_V6_CSUM
))
features
&=
~
NETIF_F_SG
;
if
(
unlikely
(
skb_shinfo
(
skb
)
->
gso_type
&
~
(
SKB_GSO_UDP
|
SKB_GSO_DODGY
|
SKB_GSO_TCP_ECN
|
SKB_GSO_TCPV6
|
0
)))
goto
out
;
if
(
unlikely
(
!
pskb_may_pull
(
skb
,
sizeof
(
*
ipv6h
))))
goto
out
;
ipv6h
=
ipv6_hdr
(
skb
);
__skb_pull
(
skb
,
sizeof
(
*
ipv6h
));
segs
=
ERR_PTR
(
-
EPROTONOSUPPORT
);
rcu_read_lock
();
ops
=
ipv6_gso_pull_exthdrs
(
skb
,
ipv6h
->
nexthdr
);
if
(
likely
(
ops
&&
ops
->
gso_segment
))
{
skb_reset_transport_header
(
skb
);
segs
=
ops
->
gso_segment
(
skb
,
features
);
}
rcu_read_unlock
();
if
(
unlikely
(
IS_ERR
(
segs
)))
goto
out
;
for
(
skb
=
segs
;
skb
;
skb
=
skb
->
next
)
{
ipv6h
=
ipv6_hdr
(
skb
);
ipv6h
->
payload_len
=
htons
(
skb
->
len
-
skb
->
mac_len
-
sizeof
(
*
ipv6h
));
}
out:
return
segs
;
}
static
struct
packet_type
ipv6_packet_type
=
{
.
type
=
__constant_htons
(
ETH_P_IPV6
),
.
func
=
ipv6_rcv
,
.
gso_send_check
=
ipv6_gso_send_check
,
.
gso_segment
=
ipv6_gso_segment
,
};
static
int
__init
ipv6_packet_init
(
void
)
{
dev_add_pack
(
&
ipv6_packet_type
);
return
0
;
}
static
void
ipv6_packet_cleanup
(
void
)
{
dev_remove_pack
(
&
ipv6_packet_type
);
}
static
int
__init
init_ipv6_mibs
(
void
)
{
if
(
snmp_mib_init
((
void
**
)
ipv6_statistics
,
...
...
net/ipv6/ipv6_sockglue.c
浏览文件 @
662397fd
...
...
@@ -57,118 +57,6 @@
DEFINE_SNMP_STAT
(
struct
ipstats_mib
,
ipv6_statistics
)
__read_mostly
;
static
struct
inet6_protocol
*
ipv6_gso_pull_exthdrs
(
struct
sk_buff
*
skb
,
int
proto
)
{
struct
inet6_protocol
*
ops
=
NULL
;
for
(;;)
{
struct
ipv6_opt_hdr
*
opth
;
int
len
;
if
(
proto
!=
NEXTHDR_HOP
)
{
ops
=
rcu_dereference
(
inet6_protos
[
proto
]);
if
(
unlikely
(
!
ops
))
break
;
if
(
!
(
ops
->
flags
&
INET6_PROTO_GSO_EXTHDR
))
break
;
}
if
(
unlikely
(
!
pskb_may_pull
(
skb
,
8
)))
break
;
opth
=
(
void
*
)
skb
->
data
;
len
=
opth
->
hdrlen
*
8
+
8
;
if
(
unlikely
(
!
pskb_may_pull
(
skb
,
len
)))
break
;
proto
=
opth
->
nexthdr
;
__skb_pull
(
skb
,
len
);
}
return
ops
;
}
static
int
ipv6_gso_send_check
(
struct
sk_buff
*
skb
)
{
struct
ipv6hdr
*
ipv6h
;
struct
inet6_protocol
*
ops
;
int
err
=
-
EINVAL
;
if
(
unlikely
(
!
pskb_may_pull
(
skb
,
sizeof
(
*
ipv6h
))))
goto
out
;
ipv6h
=
ipv6_hdr
(
skb
);
__skb_pull
(
skb
,
sizeof
(
*
ipv6h
));
err
=
-
EPROTONOSUPPORT
;
rcu_read_lock
();
ops
=
ipv6_gso_pull_exthdrs
(
skb
,
ipv6h
->
nexthdr
);
if
(
likely
(
ops
&&
ops
->
gso_send_check
))
{
skb_reset_transport_header
(
skb
);
err
=
ops
->
gso_send_check
(
skb
);
}
rcu_read_unlock
();
out:
return
err
;
}
static
struct
sk_buff
*
ipv6_gso_segment
(
struct
sk_buff
*
skb
,
int
features
)
{
struct
sk_buff
*
segs
=
ERR_PTR
(
-
EINVAL
);
struct
ipv6hdr
*
ipv6h
;
struct
inet6_protocol
*
ops
;
if
(
!
(
features
&
NETIF_F_V6_CSUM
))
features
&=
~
NETIF_F_SG
;
if
(
unlikely
(
skb_shinfo
(
skb
)
->
gso_type
&
~
(
SKB_GSO_UDP
|
SKB_GSO_DODGY
|
SKB_GSO_TCP_ECN
|
SKB_GSO_TCPV6
|
0
)))
goto
out
;
if
(
unlikely
(
!
pskb_may_pull
(
skb
,
sizeof
(
*
ipv6h
))))
goto
out
;
ipv6h
=
ipv6_hdr
(
skb
);
__skb_pull
(
skb
,
sizeof
(
*
ipv6h
));
segs
=
ERR_PTR
(
-
EPROTONOSUPPORT
);
rcu_read_lock
();
ops
=
ipv6_gso_pull_exthdrs
(
skb
,
ipv6h
->
nexthdr
);
if
(
likely
(
ops
&&
ops
->
gso_segment
))
{
skb_reset_transport_header
(
skb
);
segs
=
ops
->
gso_segment
(
skb
,
features
);
}
rcu_read_unlock
();
if
(
unlikely
(
IS_ERR
(
segs
)))
goto
out
;
for
(
skb
=
segs
;
skb
;
skb
=
skb
->
next
)
{
ipv6h
=
ipv6_hdr
(
skb
);
ipv6h
->
payload_len
=
htons
(
skb
->
len
-
skb
->
mac_len
-
sizeof
(
*
ipv6h
));
}
out:
return
segs
;
}
static
struct
packet_type
ipv6_packet_type
=
{
.
type
=
__constant_htons
(
ETH_P_IPV6
),
.
func
=
ipv6_rcv
,
.
gso_send_check
=
ipv6_gso_send_check
,
.
gso_segment
=
ipv6_gso_segment
,
};
struct
ip6_ra_chain
*
ip6_ra_chain
;
DEFINE_RWLOCK
(
ip6_ra_lock
);
...
...
@@ -1132,13 +1020,3 @@ int compat_ipv6_getsockopt(struct sock *sk, int level, int optname,
EXPORT_SYMBOL
(
compat_ipv6_getsockopt
);
#endif
int
__init
ipv6_packet_init
(
void
)
{
dev_add_pack
(
&
ipv6_packet_type
);
return
0
;
}
void
ipv6_packet_cleanup
(
void
)
{
dev_remove_pack
(
&
ipv6_packet_type
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录