Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
5c803768
Commit
5c803768
authored
Nov 03, 2004
by
David S. Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[TCP]: Fix tcp_diag build with ipv6 completely disabled.
Signed-off-by:
David S. Miller
<
davem@davemloft.net
>
parent
ba599be9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
net/ipv4/tcp_diag.c
net/ipv4/tcp_diag.c
+14
-0
No files found.
net/ipv4/tcp_diag.c
View file @
5c803768
...
@@ -103,12 +103,14 @@ static int tcpdiag_fill(struct sk_buff *skb, struct sock *sk,
...
@@ -103,12 +103,14 @@ static int tcpdiag_fill(struct sk_buff *skb, struct sock *sk,
r
->
tcpdiag_wqueue
=
0
;
r
->
tcpdiag_wqueue
=
0
;
r
->
tcpdiag_uid
=
0
;
r
->
tcpdiag_uid
=
0
;
r
->
tcpdiag_inode
=
0
;
r
->
tcpdiag_inode
=
0
;
#ifdef CONFIG_IP_TCPDIAG_IPV6
if
(
r
->
tcpdiag_family
==
AF_INET6
)
{
if
(
r
->
tcpdiag_family
==
AF_INET6
)
{
ipv6_addr_copy
((
struct
in6_addr
*
)
r
->
id
.
tcpdiag_src
,
ipv6_addr_copy
((
struct
in6_addr
*
)
r
->
id
.
tcpdiag_src
,
&
tw
->
tw_v6_rcv_saddr
);
&
tw
->
tw_v6_rcv_saddr
);
ipv6_addr_copy
((
struct
in6_addr
*
)
r
->
id
.
tcpdiag_dst
,
ipv6_addr_copy
((
struct
in6_addr
*
)
r
->
id
.
tcpdiag_dst
,
&
tw
->
tw_v6_daddr
);
&
tw
->
tw_v6_daddr
);
}
}
#endif
nlh
->
nlmsg_len
=
skb
->
tail
-
b
;
nlh
->
nlmsg_len
=
skb
->
tail
-
b
;
return
skb
->
len
;
return
skb
->
len
;
}
}
...
@@ -118,6 +120,7 @@ static int tcpdiag_fill(struct sk_buff *skb, struct sock *sk,
...
@@ -118,6 +120,7 @@ static int tcpdiag_fill(struct sk_buff *skb, struct sock *sk,
r
->
id
.
tcpdiag_src
[
0
]
=
inet
->
rcv_saddr
;
r
->
id
.
tcpdiag_src
[
0
]
=
inet
->
rcv_saddr
;
r
->
id
.
tcpdiag_dst
[
0
]
=
inet
->
daddr
;
r
->
id
.
tcpdiag_dst
[
0
]
=
inet
->
daddr
;
#ifdef CONFIG_IP_TCPDIAG_IPV6
if
(
r
->
tcpdiag_family
==
AF_INET6
)
{
if
(
r
->
tcpdiag_family
==
AF_INET6
)
{
struct
ipv6_pinfo
*
np
=
inet6_sk
(
sk
);
struct
ipv6_pinfo
*
np
=
inet6_sk
(
sk
);
...
@@ -126,6 +129,7 @@ static int tcpdiag_fill(struct sk_buff *skb, struct sock *sk,
...
@@ -126,6 +129,7 @@ static int tcpdiag_fill(struct sk_buff *skb, struct sock *sk,
ipv6_addr_copy
((
struct
in6_addr
*
)
r
->
id
.
tcpdiag_dst
,
ipv6_addr_copy
((
struct
in6_addr
*
)
r
->
id
.
tcpdiag_dst
,
&
np
->
daddr
);
&
np
->
daddr
);
}
}
#endif
#define EXPIRES_IN_MS(tmo) ((tmo-jiffies)*1000+HZ-1)/HZ
#define EXPIRES_IN_MS(tmo) ((tmo-jiffies)*1000+HZ-1)/HZ
...
@@ -211,11 +215,13 @@ static int tcpdiag_get_exact(struct sk_buff *in_skb, const struct nlmsghdr *nlh)
...
@@ -211,11 +215,13 @@ static int tcpdiag_get_exact(struct sk_buff *in_skb, const struct nlmsghdr *nlh)
req
->
id
.
tcpdiag_src
[
0
],
req
->
id
.
tcpdiag_sport
,
req
->
id
.
tcpdiag_src
[
0
],
req
->
id
.
tcpdiag_sport
,
req
->
id
.
tcpdiag_if
);
req
->
id
.
tcpdiag_if
);
}
}
#ifdef CONFIG_IP_TCPDIAG_IPV6
else
if
(
req
->
tcpdiag_family
==
AF_INET6
)
{
else
if
(
req
->
tcpdiag_family
==
AF_INET6
)
{
sk
=
tcp_v6_lookup
((
struct
in6_addr
*
)
req
->
id
.
tcpdiag_dst
,
req
->
id
.
tcpdiag_dport
,
sk
=
tcp_v6_lookup
((
struct
in6_addr
*
)
req
->
id
.
tcpdiag_dst
,
req
->
id
.
tcpdiag_dport
,
(
struct
in6_addr
*
)
req
->
id
.
tcpdiag_src
,
req
->
id
.
tcpdiag_sport
,
(
struct
in6_addr
*
)
req
->
id
.
tcpdiag_src
,
req
->
id
.
tcpdiag_sport
,
req
->
id
.
tcpdiag_if
);
req
->
id
.
tcpdiag_if
);
}
}
#endif
else
{
else
{
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -424,12 +430,14 @@ static int tcpdiag_dump_sock(struct sk_buff *skb, struct sock *sk,
...
@@ -424,12 +430,14 @@ static int tcpdiag_dump_sock(struct sk_buff *skb, struct sock *sk,
struct
inet_opt
*
inet
=
inet_sk
(
sk
);
struct
inet_opt
*
inet
=
inet_sk
(
sk
);
entry
.
family
=
sk
->
sk_family
;
entry
.
family
=
sk
->
sk_family
;
#ifdef CONFIG_IP_TCPDIAG_IPV6
if
(
entry
.
family
==
AF_INET6
)
{
if
(
entry
.
family
==
AF_INET6
)
{
struct
ipv6_pinfo
*
np
=
inet6_sk
(
sk
);
struct
ipv6_pinfo
*
np
=
inet6_sk
(
sk
);
entry
.
saddr
=
np
->
rcv_saddr
.
s6_addr32
;
entry
.
saddr
=
np
->
rcv_saddr
.
s6_addr32
;
entry
.
daddr
=
np
->
daddr
.
s6_addr32
;
entry
.
daddr
=
np
->
daddr
.
s6_addr32
;
}
else
}
else
#endif
{
{
entry
.
saddr
=
&
inet
->
rcv_saddr
;
entry
.
saddr
=
&
inet
->
rcv_saddr
;
entry
.
daddr
=
&
inet
->
daddr
;
entry
.
daddr
=
&
inet
->
daddr
;
...
@@ -482,12 +490,14 @@ static int tcpdiag_fill_req(struct sk_buff *skb, struct sock *sk,
...
@@ -482,12 +490,14 @@ static int tcpdiag_fill_req(struct sk_buff *skb, struct sock *sk,
r
->
tcpdiag_wqueue
=
0
;
r
->
tcpdiag_wqueue
=
0
;
r
->
tcpdiag_uid
=
sock_i_uid
(
sk
);
r
->
tcpdiag_uid
=
sock_i_uid
(
sk
);
r
->
tcpdiag_inode
=
0
;
r
->
tcpdiag_inode
=
0
;
#ifdef CONFIG_IP_TCPDIAG_IPV6
if
(
r
->
tcpdiag_family
==
AF_INET6
)
{
if
(
r
->
tcpdiag_family
==
AF_INET6
)
{
ipv6_addr_copy
((
struct
in6_addr
*
)
r
->
id
.
tcpdiag_src
,
ipv6_addr_copy
((
struct
in6_addr
*
)
r
->
id
.
tcpdiag_src
,
&
req
->
af
.
v6_req
.
loc_addr
);
&
req
->
af
.
v6_req
.
loc_addr
);
ipv6_addr_copy
((
struct
in6_addr
*
)
r
->
id
.
tcpdiag_dst
,
ipv6_addr_copy
((
struct
in6_addr
*
)
r
->
id
.
tcpdiag_dst
,
&
req
->
af
.
v6_req
.
rmt_addr
);
&
req
->
af
.
v6_req
.
rmt_addr
);
}
}
#endif
nlh
->
nlmsg_len
=
skb
->
tail
-
b
;
nlh
->
nlmsg_len
=
skb
->
tail
-
b
;
return
skb
->
len
;
return
skb
->
len
;
...
@@ -543,12 +553,16 @@ static int tcpdiag_dump_reqs(struct sk_buff *skb, struct sock *sk,
...
@@ -543,12 +553,16 @@ static int tcpdiag_dump_reqs(struct sk_buff *skb, struct sock *sk,
if
(
bc
)
{
if
(
bc
)
{
entry
.
saddr
=
entry
.
saddr
=
#ifdef CONFIG_IP_TCPDIAG_IPV6
(
entry
.
family
==
AF_INET6
)
?
(
entry
.
family
==
AF_INET6
)
?
req
->
af
.
v6_req
.
loc_addr
.
s6_addr32
:
req
->
af
.
v6_req
.
loc_addr
.
s6_addr32
:
#endif
&
req
->
af
.
v4_req
.
loc_addr
;
&
req
->
af
.
v4_req
.
loc_addr
;
entry
.
daddr
=
entry
.
daddr
=
#ifdef CONFIG_IP_TCPDIAG_IPV6
(
entry
.
family
==
AF_INET6
)
?
(
entry
.
family
==
AF_INET6
)
?
req
->
af
.
v6_req
.
rmt_addr
.
s6_addr32
:
req
->
af
.
v6_req
.
rmt_addr
.
s6_addr32
:
#endif
&
req
->
af
.
v4_req
.
rmt_addr
;
&
req
->
af
.
v4_req
.
rmt_addr
;
entry
.
dport
=
ntohs
(
req
->
rmt_port
);
entry
.
dport
=
ntohs
(
req
->
rmt_port
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment