Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 6338
b: refs/heads/master
c: 505cbfc
h: refs/heads/master
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo authored and David S. Miller committed Aug 29, 2005
1 parent 6cb02a4 commit 0b85ba1
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 92 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b766b305d3f2d8be173e5d9853534ea1afdbabba
refs/heads/master: 505cbfc577f3fa778005e2800b869eca25727d5f
5 changes: 5 additions & 0 deletions trunk/include/linux/ipv6.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ struct inet6_skb_parm {

#define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb))

static inline int inet6_iif(const struct sk_buff *skb)
{
return IP6CB(skb)->iif;
}

struct tcp6_request_sock {
struct tcp_request_sock req;
struct in6_addr loc_addr;
Expand Down
26 changes: 26 additions & 0 deletions trunk/include/net/inet6_hashtables.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* INET An implementation of the TCP/IP protocol suite for the LINUX
* operating system. INET is implemented using the BSD Socket
* interface as the means of communication with the user level.
*
* Authors: Lotsa people, from code originally in tcp
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/

#ifndef _INET6_HASHTABLES_H
#define _INET6_HASHTABLES_H

#include <linux/types.h>

struct in6_addr;
struct inet_hashinfo;

extern struct sock *inet6_lookup(struct inet_hashinfo *hashinfo,
const struct in6_addr *saddr, const u16 sport,
const struct in6_addr *daddr, const u16 dport,
const int dif);
#endif /* _INET6_HASHTABLES_H */
3 changes: 0 additions & 3 deletions trunk/net/ipv4/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -425,9 +425,6 @@ config IP_TCPDIAG

If unsure, say Y.

config IP_TCPDIAG_IPV6
def_bool (IP_TCPDIAG=y && IPV6=y) || (IP_TCPDIAG=m && IPV6)

config IP_TCPDIAG_DCCP
def_bool (IP_TCPDIAG=y && IP_DCCP=y) || (IP_TCPDIAG=m && IP_DCCP)

Expand Down
40 changes: 17 additions & 23 deletions trunk/net/ipv4/tcp_diag.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
#include <net/tcp.h>
#include <net/ipv6.h>
#include <net/inet_common.h>
#include <net/inet_connection_sock.h>
#include <net/inet_hashtables.h>
#include <net/inet_timewait_sock.h>
#include <net/inet6_hashtables.h>

#include <linux/inet.h>
#include <linux/stddef.h>
Expand Down Expand Up @@ -102,7 +106,7 @@ static int tcpdiag_fill(struct sk_buff *skb, struct sock *sk,
r->tcpdiag_wqueue = 0;
r->tcpdiag_uid = 0;
r->tcpdiag_inode = 0;
#ifdef CONFIG_IP_TCPDIAG_IPV6
#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
if (r->tcpdiag_family == AF_INET6) {
const struct tcp6_timewait_sock *tcp6tw = tcp6_twsk(sk);

Expand All @@ -121,7 +125,7 @@ static int tcpdiag_fill(struct sk_buff *skb, struct sock *sk,
r->id.tcpdiag_src[0] = inet->rcv_saddr;
r->id.tcpdiag_dst[0] = inet->daddr;

#ifdef CONFIG_IP_TCPDIAG_IPV6
#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
if (r->tcpdiag_family == AF_INET6) {
struct ipv6_pinfo *np = inet6_sk(sk);

Expand Down Expand Up @@ -196,19 +200,6 @@ static int tcpdiag_fill(struct sk_buff *skb, struct sock *sk,
return -1;
}

#ifdef CONFIG_IP_TCPDIAG_IPV6
extern struct sock *tcp_v6_lookup(struct in6_addr *saddr, u16 sport,
struct in6_addr *daddr, u16 dport,
int dif);
#else
static inline struct sock *tcp_v6_lookup(struct in6_addr *saddr, u16 sport,
struct in6_addr *daddr, u16 dport,
int dif)
{
return NULL;
}
#endif

static int tcpdiag_get_exact(struct sk_buff *in_skb, const struct nlmsghdr *nlh)
{
int err;
Expand All @@ -225,11 +216,14 @@ static int tcpdiag_get_exact(struct sk_buff *in_skb, const struct nlmsghdr *nlh)
req->id.tcpdiag_dport, req->id.tcpdiag_src[0],
req->id.tcpdiag_sport, req->id.tcpdiag_if);
}
#ifdef CONFIG_IP_TCPDIAG_IPV6
#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
else if (req->tcpdiag_family == AF_INET6) {
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,
req->id.tcpdiag_if);
sk = inet6_lookup(hashinfo,
(struct in6_addr*)req->id.tcpdiag_dst,
req->id.tcpdiag_dport,
(struct in6_addr*)req->id.tcpdiag_src,
req->id.tcpdiag_sport,
req->id.tcpdiag_if);
}
#endif
else {
Expand Down Expand Up @@ -440,7 +434,7 @@ static int tcpdiag_dump_sock(struct sk_buff *skb, struct sock *sk,
struct inet_sock *inet = inet_sk(sk);

entry.family = sk->sk_family;
#ifdef CONFIG_IP_TCPDIAG_IPV6
#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
if (entry.family == AF_INET6) {
struct ipv6_pinfo *np = inet6_sk(sk);

Expand Down Expand Up @@ -502,7 +496,7 @@ static int tcpdiag_fill_req(struct sk_buff *skb, struct sock *sk,
r->tcpdiag_wqueue = 0;
r->tcpdiag_uid = sock_i_uid(sk);
r->tcpdiag_inode = 0;
#ifdef CONFIG_IP_TCPDIAG_IPV6
#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
if (r->tcpdiag_family == AF_INET6) {
ipv6_addr_copy((struct in6_addr *)r->id.tcpdiag_src,
&tcp6_rsk(req)->loc_addr);
Expand Down Expand Up @@ -567,13 +561,13 @@ static int tcpdiag_dump_reqs(struct sk_buff *skb, struct sock *sk,

if (bc) {
entry.saddr =
#ifdef CONFIG_IP_TCPDIAG_IPV6
#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
(entry.family == AF_INET6) ?
tcp6_rsk(req)->loc_addr.s6_addr32 :
#endif
&ireq->loc_addr;
entry.daddr =
#ifdef CONFIG_IP_TCPDIAG_IPV6
#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
(entry.family == AF_INET6) ?
tcp6_rsk(req)->rmt_addr.s6_addr32 :
#endif
Expand Down
Loading

0 comments on commit 0b85ba1

Please sign in to comment.