~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/trace/events/net_probe_common.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 
  3 #if !defined(_TRACE_NET_PROBE_COMMON_H) || defined(TRACE_HEADER_MULTI_READ)
  4 #define _TRACE_NET_PROBE_COMMON_H
  5 
  6 #define TP_STORE_ADDR_PORTS_V4(__entry, inet, sk)                       \
  7         do {                                                            \
  8                 struct sockaddr_in *v4 = (void *)__entry->saddr;        \
  9                                                                         \
 10                 v4->sin_family = AF_INET;                               \
 11                 v4->sin_port = inet->inet_sport;                        \
 12                 v4->sin_addr.s_addr = inet->inet_saddr;                 \
 13                 v4 = (void *)__entry->daddr;                            \
 14                 v4->sin_family = AF_INET;                               \
 15                 v4->sin_port = inet->inet_dport;                        \
 16                 v4->sin_addr.s_addr = inet->inet_daddr;                 \
 17         } while (0)
 18 
 19 #if IS_ENABLED(CONFIG_IPV6)
 20 
 21 #define TP_STORE_ADDR_PORTS(__entry, inet, sk)                          \
 22         do {                                                            \
 23                 if (sk->sk_family == AF_INET6) {                        \
 24                         struct sockaddr_in6 *v6 = (void *)__entry->saddr; \
 25                                                                         \
 26                         v6->sin6_family = AF_INET6;                     \
 27                         v6->sin6_port = inet->inet_sport;               \
 28                         v6->sin6_addr = inet6_sk(sk)->saddr;            \
 29                         v6 = (void *)__entry->daddr;                    \
 30                         v6->sin6_family = AF_INET6;                     \
 31                         v6->sin6_port = inet->inet_dport;               \
 32                         v6->sin6_addr = sk->sk_v6_daddr;                \
 33                 } else                                                  \
 34                         TP_STORE_ADDR_PORTS_V4(__entry, inet, sk);      \
 35         } while (0)
 36 
 37 #else
 38 
 39 #define TP_STORE_ADDR_PORTS(__entry, inet, sk)          \
 40         TP_STORE_ADDR_PORTS_V4(__entry, inet, sk);
 41 
 42 #endif
 43 
 44 #define TP_STORE_V4MAPPED(__entry, saddr, daddr)                \
 45         do {                                                    \
 46                 struct in6_addr *pin6;                          \
 47                                                                 \
 48                 pin6 = (struct in6_addr *)__entry->saddr_v6;    \
 49                 ipv6_addr_set_v4mapped(saddr, pin6);            \
 50                 pin6 = (struct in6_addr *)__entry->daddr_v6;    \
 51                 ipv6_addr_set_v4mapped(daddr, pin6);            \
 52         } while (0)
 53 
 54 #if IS_ENABLED(CONFIG_IPV6)
 55 #define TP_STORE_ADDRS(__entry, saddr, daddr, saddr6, daddr6)           \
 56         do {                                                            \
 57                 if (sk->sk_family == AF_INET6) {                        \
 58                         struct in6_addr *pin6;                          \
 59                                                                         \
 60                         pin6 = (struct in6_addr *)__entry->saddr_v6;    \
 61                         *pin6 = saddr6;                                 \
 62                         pin6 = (struct in6_addr *)__entry->daddr_v6;    \
 63                         *pin6 = daddr6;                                 \
 64                 } else {                                                \
 65                         TP_STORE_V4MAPPED(__entry, saddr, daddr);       \
 66                 }                                                       \
 67         } while (0)
 68 #else
 69 #define TP_STORE_ADDRS(__entry, saddr, daddr, saddr6, daddr6)   \
 70         TP_STORE_V4MAPPED(__entry, saddr, daddr)
 71 #endif
 72 
 73 #define TP_STORE_ADDR_PORTS_SKB_V4(skb, protoh, entry_saddr, entry_daddr) \
 74         do {                                                            \
 75                 struct sockaddr_in *v4 = (void *)entry_saddr;           \
 76                                                                         \
 77                 v4->sin_family = AF_INET;                               \
 78                 v4->sin_port = protoh->source;                          \
 79                 v4->sin_addr.s_addr = ip_hdr(skb)->saddr;               \
 80                 v4 = (void *)entry_daddr;                               \
 81                 v4->sin_family = AF_INET;                               \
 82                 v4->sin_port = protoh->dest;                            \
 83                 v4->sin_addr.s_addr = ip_hdr(skb)->daddr;               \
 84         } while (0)
 85 
 86 #if IS_ENABLED(CONFIG_IPV6)
 87 
 88 #define TP_STORE_ADDR_PORTS_SKB(skb, protoh, entry_saddr, entry_daddr)  \
 89         do {                                                            \
 90                 const struct iphdr *iph = ip_hdr(skb);                  \
 91                                                                         \
 92                 if (iph->version == 6) {                                \
 93                         struct sockaddr_in6 *v6 = (void *)entry_saddr;  \
 94                                                                         \
 95                         v6->sin6_family = AF_INET6;                     \
 96                         v6->sin6_port = protoh->source;                 \
 97                         v6->sin6_addr = ipv6_hdr(skb)->saddr;           \
 98                         v6 = (void *)entry_daddr;                       \
 99                         v6->sin6_family = AF_INET6;                     \
100                         v6->sin6_port = protoh->dest;                   \
101                         v6->sin6_addr = ipv6_hdr(skb)->daddr;           \
102                 } else                                                  \
103                         TP_STORE_ADDR_PORTS_SKB_V4(skb, protoh,         \
104                                                    entry_saddr,         \
105                                                    entry_daddr);        \
106         } while (0)
107 
108 #else
109 
110 #define TP_STORE_ADDR_PORTS_SKB(skb, protoh, entry_saddr, entry_daddr)  \
111         TP_STORE_ADDR_PORTS_SKB_V4(skb, protoh, entry_saddr, entry_daddr)
112 
113 #endif
114 
115 #endif
116 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php