| 1 |
/* netfilter.stp - netfilter hook tapset |
| 2 |
* |
| 3 |
* Copyright (C) 2012, 2017-2018 Red Hat Inc. |
| 4 |
* <tapsetdescription> |
| 5 |
* This family of probe points provides a simple way to examine network traffic using the netfilter hooks mechanism. |
| 6 |
* </tapsetdescription> |
| 7 |
*/ |
| 8 |
|
| 9 |
// See the BZ1546179 block comment in tapset/linux/networking.stp for |
| 10 |
// an explanation of the try/catch statements around sk_buff structure |
| 11 |
// accesses. |
| 12 |
|
| 13 |
/* The below functionality is mostly inspired by tcp.stp and networking.stp. */ |
| 14 |
|
| 15 |
%{ |
| 16 |
#include <linux/in.h> |
| 17 |
#include <linux/skbuff.h> |
| 18 |
#include <linux/netfilter_arp.h> |
| 19 |
#include <linux/if_arp.h> |
| 20 |
#include <net/ipv6.h> |
| 21 |
#include <net/llc_pdu.h> |
| 22 |
#include <linux/llc.h> |
| 23 |
%} |
| 24 |
|
| 25 |
# XXX: IPPROTO_* and NF_* constants should be secure globals -- needs PR10607 |
| 26 |
# ... currently we use a hideous copypasta hack which defines them as |
| 27 |
# locals in each probe alias. Blegh |
| 28 |
|
| 29 |
@__private30 function __mac_addr_to_string:string(addr:long) { |
| 30 |
return sprintf("%02x:%02x:%02x:%02x:%02x:%02x", |
| 31 |
kernel_char(addr)&255, kernel_char(addr+1)&255, |
| 32 |
kernel_char(addr+2)&255, kernel_char(addr+3)&255, |
| 33 |
kernel_char(addr+4)&255, kernel_char(addr+5)&255) |
| 34 |
} |
| 35 |
|
| 36 |
@__private30 function __get_mac_addr:string(addr:long) { |
| 37 |
return __mac_addr_to_string(@cast(addr, "struct net_device", "kernel<linux/netdevice.h>")->dev_addr) |
| 38 |
} |
| 39 |
|
| 40 |
@__private30 function __get_skb_arphdr:long(addr:long) |
| 41 |
{ |
| 42 |
// The method is exactly the same as for an IP header: |
| 43 |
return __get_skb_iphdr(addr) |
| 44 |
} |
| 45 |
|
| 46 |
/* returns the bridge header for kernel >= 2.6.21 */ |
| 47 |
@__private30 function __get_skb_brhdr_new:long(skb:long) |
| 48 |
%{ /* pure */ |
| 49 |
struct sk_buff *skb; |
| 50 |
skb = (struct sk_buff *)(uintptr_t)STAP_ARG_skb; |
| 51 |
/* as done by skb_network_header() */ |
| 52 |
#ifdef NET_SKBUFF_DATA_USES_OFFSET |
| 53 |
STAP_RETVALUE = (long)(kread(&(skb->head)) + kread(&(skb->network_header)) + sizeof(struct llc_pdu_un)); |
| 54 |
#else |
| 55 |
STAP_RETVALUE = (long)(kread(&(skb->network_header)) + sizeof(struct llc_pdu_un)); |
| 56 |
#endif |
| 57 |
CATCH_DEREF_FAULT(); |
| 58 |
%} |
| 59 |
|
| 60 |
/* returns the bridge header for a given sk_buff structure */ |
| 61 |
@__private30 function __get_skb_brhdr:long(skb:long) |
| 62 |
{ |
| 63 |
%( kernel_v < "2.6.21" %? |
| 64 |
brhdr = @cast(skb, "sk_buff")->mac->raw + %{ /* pure */ sizeof(struct llc_pdu_un) %} |
| 65 |
return brhdr |
| 66 |
%: |
| 67 |
return __get_skb_brhdr_new(skb) |
| 68 |
%) |
| 69 |
} |
| 70 |
|
| 71 |
/* returns llc_pdu_un for a given sk_buff structure */ |
| 72 |
@__private30 function __get_skb_llc:long(skb:long) |
| 73 |
%{ /* pure */ |
| 74 |
struct sk_buff *skb; |
| 75 |
skb = (struct sk_buff *)(uintptr_t)STAP_ARG_skb; |
| 76 |
/* as done by skb_network_header() */ |
| 77 |
#ifdef NET_SKBUFF_DATA_USES_OFFSET |
| 78 |
STAP_RETVALUE = (long)(kread(&(skb->head)) + kread(&(skb->network_header))); |
| 79 |
#else |
| 80 |
STAP_RETVALUE = (long)kread(&(skb->network_header)); |
| 81 |
#endif |
| 82 |
CATCH_DEREF_FAULT(); |
| 83 |
%} |
| 84 |
|
| 85 |
@__private30 function __ip6_skb_proto:long(addr:long) |
| 86 |
%{ /* pure */ |
| 87 |
struct sk_buff *skb = (struct sk_buff *)(uintptr_t)STAP_ARG_addr; |
| 88 |
struct ipv6hdr *hdr; |
| 89 |
u8 nexthdr; |
| 90 |
|
| 91 |
/* We call deref() here to ensure the memory at the skb location |
| 92 |
* is valid to read, to avoid potential kernel panic calling ipv6_hdr(). */ |
| 93 |
(void)kderef_buffer(NULL, skb, sizeof(struct sk_buff)); |
| 94 |
hdr = ipv6_hdr(skb); |
| 95 |
nexthdr = kread(&(hdr->nexthdr)); |
| 96 |
|
| 97 |
if (ipv6_ext_hdr(nexthdr)) { |
| 98 |
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) |
| 99 |
long result = ipv6_skip_exthdr(skb, sizeof(*hdr), &nexthdr); |
| 100 |
#else |
| 101 |
__be16 frag_offp; |
| 102 |
int extoff = (u8 *)(hdr + 1) - kread(&(skb->data)); |
| 103 |
long result = ipv6_skip_exthdr(skb, extoff, &nexthdr, &frag_offp); |
| 104 |
#endif |
| 105 |
STAP_RETVALUE = result < 0 ? 0 : result; |
| 106 |
} else { |
| 107 |
STAP_RETVALUE = 0; |
| 108 |
} |
| 109 |
CATCH_DEREF_FAULT(); |
| 110 |
%} |
| 111 |
|
| 112 |
private function __skb_nonlinear:long(addr:long) |
| 113 |
%{ /* pure */ |
| 114 |
struct sk_buff *skb = (struct sk_buff *)(uintptr_t)STAP_ARG_addr; |
| 115 |
STAP_RETVALUE = skb_is_nonlinear(skb); |
| 116 |
%} |
| 117 |
|
| 118 |
private function __skb_shinfo:long(addr:long) |
| 119 |
%{ /* pure */ |
| 120 |
struct sk_buff *skb = (struct sk_buff *)(uintptr_t)STAP_ARG_addr; |
| 121 |
STAP_RETVALUE = (uintptr_t)skb_end_pointer(skb); |
| 122 |
%} |
| 123 |
|
| 124 |
private function __skb_frag_size:long(addr:long, frag:long) |
| 125 |
%{ /* pure */ |
| 126 |
struct skb_shared_info *skb_shr = (struct skb_shared_info *)(uintptr_t)STAP_ARG_addr; |
| 127 |
skb_frag_t *skb_frag = &(skb_shr->frags[STAP_ARG_frag]); |
| 128 |
STAP_RETVALUE = skb_frag_size(skb_frag); |
| 129 |
%} |
| 130 |
|
| 131 |
private function __skb_frag_data_addr:long(addr:long, frag:long) |
| 132 |
%{ /* pure */ |
| 133 |
struct skb_shared_info *skb_shr = (struct skb_shared_info *)(uintptr_t)STAP_ARG_addr; |
| 134 |
const skb_frag_t *skb_frag = &skb_shr->frags[STAP_ARG_frag]; |
| 135 |
STAP_RETVALUE = (uintptr_t)skb_frag_address_safe(skb_frag); |
| 136 |
%} |
| 137 |
|
| 138 |
private function __buffer_data:string(skb:long, str:long) |
| 139 |
{ |
| 140 |
length = @cast(skb, "struct sk_buff", "kernel<linux/skbuff.h>")->len |
| 141 |
data_length = @cast(skb, "struct sk_buff", "kernel<linux/skbuff.h>")->data_len |
| 142 |
skb_data = @cast(skb, "struct sk_buff", "kernel<linux/skbuff.h>")->data |
| 143 |
headlen = length - data_length /* skb_headlen() */ |
| 144 |
data = "" |
| 145 |
if (str) { |
| 146 |
data = kernel_buffer_quoted(skb_data, headlen) |
| 147 |
} else { |
| 148 |
data = sprintf("%.*M", headlen, skb_data) |
| 149 |
} |
| 150 |
|
| 151 |
if (__skb_nonlinear(skb)) { |
| 152 |
shinfo = __skb_shinfo(skb) |
| 153 |
nr_frags = @cast(shinfo, "struct skb_shared_info", |
| 154 |
"kernel<linux/skbuff.h>")->nr_frags |
| 155 |
for (i = 0; i < nr_frags; i++) { |
| 156 |
frag_size = __skb_frag_size(shinfo, i) |
| 157 |
frag_data_addr = __skb_frag_data_addr(shinfo, i) |
| 158 |
if (str) { |
| 159 |
data .= kernel_buffer_quoted(frag_data_addr, frag_size) |
| 160 |
} else { |
| 161 |
data .= sprintf("%.*M", frag_size, frag_data_addr) |
| 162 |
} |
| 163 |
} |
| 164 |
} |
| 165 |
return data |
| 166 |
} |
| 167 |
|
| 168 |
@define netfilter_common_setup(pf_name) %( |
| 169 |
pf = @pf_name |
| 170 |
|
| 171 |
/* XXX not relevant for netfilter.arp & netfilter.bridge probes */ |
| 172 |
ipproto_tcp = @const("IPPROTO_TCP") |
| 173 |
ipproto_udp = @const("IPPROTO_UDP") |
| 174 |
|
| 175 |
/* from include/linux/netfilter.h: */ |
| 176 |
nf_drop = 0 |
| 177 |
nf_accept = 1 |
| 178 |
nf_stolen = 2 |
| 179 |
nf_queue = 3 |
| 180 |
nf_repeat = 4 |
| 181 |
nf_stop = 5 |
| 182 |
|
| 183 |
indev = & @cast($in, "struct net_device", "kernel<linux/netdevice.h>") |
| 184 |
outdev = & @cast($out, "struct net_device", "kernel<linux/netdevice.h>") |
| 185 |
indev_name = kernel_string(indev->name, "") |
| 186 |
outdev_name = kernel_string(outdev->name, "") |
| 187 |
|
| 188 |
if (indev) { |
| 189 |
indev_mac_len = indev->addr_len |
| 190 |
in_mac = __get_mac_addr(indev) |
| 191 |
} |
| 192 |
if (outdev) { |
| 193 |
outdev_mac_len = outdev->addr_len |
| 194 |
out_mac = __get_mac_addr(outdev) |
| 195 |
} |
| 196 |
|
| 197 |
try { |
| 198 |
length = @cast($skb, "struct sk_buff", "kernel<linux/skbuff.h>")->len |
| 199 |
} catch { } |
| 200 |
try { data_hex = __buffer_data($skb, 0) } catch { } |
| 201 |
try { data_str = __buffer_data($skb, 1) } catch { } |
| 202 |
%) |
| 203 |
|
| 204 |
@define netfilter_ip4_setup %( |
| 205 |
family = @const("AF_INET") |
| 206 |
try { |
| 207 |
iphdr = __get_skb_iphdr($skb) |
| 208 |
saddr = format_ipaddr(__ip_skb_saddr(iphdr), @const("AF_INET")) |
| 209 |
daddr = format_ipaddr(__ip_skb_daddr(iphdr), @const("AF_INET")) |
| 210 |
protocol = __ip_skb_proto(iphdr) |
| 211 |
} catch { } |
| 212 |
|
| 213 |
try { |
| 214 |
tcphdr = __get_skb_tcphdr($skb) |
| 215 |
if (protocol == ipproto_tcp) { |
| 216 |
dport = __tcp_skb_dport(tcphdr) |
| 217 |
sport = __tcp_skb_sport(tcphdr) |
| 218 |
urg = __tcp_skb_urg(tcphdr) |
| 219 |
ack = __tcp_skb_ack(tcphdr) |
| 220 |
psh = __tcp_skb_psh(tcphdr) |
| 221 |
rst = __tcp_skb_rst(tcphdr) |
| 222 |
syn = __tcp_skb_syn(tcphdr) |
| 223 |
fin = __tcp_skb_fin(tcphdr) |
| 224 |
} |
| 225 |
|
| 226 |
/* udphdr is in the same place where tcphdr would have been */ |
| 227 |
udphdr = & @cast(tcphdr, "udphdr", "kernel<linux/udp.h>") |
| 228 |
if (protocol == ipproto_udp) { |
| 229 |
dport = ntohs(udphdr->dest) |
| 230 |
sport = ntohs(udphdr->source) |
| 231 |
} |
| 232 |
} catch { } |
| 233 |
%) |
| 234 |
|
| 235 |
@define netfilter_ip6_setup %( |
| 236 |
family = @const("AF_INET6") |
| 237 |
try { |
| 238 |
iphdr = &@cast(__get_skb_iphdr($skb), "ipv6hdr", "kernel<linux/ipv6.h>") |
| 239 |
saddr = format_ipaddr(&iphdr->saddr, @const("AF_INET6")) |
| 240 |
daddr = format_ipaddr(&iphdr->daddr, @const("AF_INET6")) |
| 241 |
protocol = __ip6_skb_proto($skb) |
| 242 |
} catch { } |
| 243 |
|
| 244 |
try { |
| 245 |
tcphdr = __get_skb_tcphdr($skb) |
| 246 |
if (protocol == ipproto_tcp) { |
| 247 |
dport = __tcp_skb_dport(tcphdr) |
| 248 |
sport = __tcp_skb_sport(tcphdr) |
| 249 |
urg = __tcp_skb_urg(tcphdr) |
| 250 |
ack = __tcp_skb_ack(tcphdr) |
| 251 |
psh = __tcp_skb_psh(tcphdr) |
| 252 |
rst = __tcp_skb_rst(tcphdr) |
| 253 |
syn = __tcp_skb_syn(tcphdr) |
| 254 |
fin = __tcp_skb_fin(tcphdr) |
| 255 |
} |
| 256 |
|
| 257 |
/* udphdr is in the same place where tcphdr would have been */ |
| 258 |
udphdr = & @cast(tcphdr, "udphdr", "kernel<linux/udp.h>") |
| 259 |
if (protocol == ipproto_udp) { |
| 260 |
dport = ntohs(udphdr->dest) |
| 261 |
sport = ntohs(udphdr->source) |
| 262 |
} |
| 263 |
} catch { } |
| 264 |
%) |
| 265 |
|
| 266 |
/** |
| 267 |
* probe netfilter.ip.pre_routing - Called before an IP packet is routed |
| 268 |
* @pf: Protocol family - either 'ipv4' or 'ipv6' |
| 269 |
* @indev: Address of net_device representing input device, 0 if unknown |
| 270 |
* @outdev: Address of net_device representing output device, 0 if unknown |
| 271 |
* @indev_name: Name of network device packet was received on (if known) |
| 272 |
* @outdev_name: Name of network device packet will be routed to (if known) |
| 273 |
* @length: The length of the packet buffer contents, in bytes |
| 274 |
* @data_str: A string representing the packet buffer contents |
| 275 |
* @data_hex: A hexadecimal string representing the packet buffer contents |
| 276 |
* @iphdr: Address of IP header |
| 277 |
* @protocol: Packet protocol from driver (ipv4 only) |
| 278 |
* @ipproto_tcp: Constant used to signify that the packet protocol is TCP |
| 279 |
* @ipproto_udp: Constant used to signify that the packet protocol is UDP |
| 280 |
* @nf_drop: Constant used to signify a 'drop' verdict |
| 281 |
* @nf_accept: Constant used to signify an 'accept' verdict |
| 282 |
* @nf_stolen: Constant used to signify a 'stolen' verdict |
| 283 |
* @nf_queue: Constant used to signify a 'queue' verdict |
| 284 |
* @nf_repeat: Constant used to signify a 'repeat' verdict |
| 285 |
* @nf_stop: Constant used to signify a 'stop' verdict |
| 286 |
* @family: IP address family |
| 287 |
* @saddr: A string representing the source IP address |
| 288 |
* @daddr: A string representing the destination IP address |
| 289 |
* @sport: TCP or UDP source port (ipv4 only) |
| 290 |
* @dport: TCP or UDP destination port (ipv4 only) |
| 291 |
* @urg: TCP URG flag (if protocol is TCP; ipv4 only) |
| 292 |
* @ack: TCP ACK flag (if protocol is TCP; ipv4 only) |
| 293 |
* @psh: TCP PSH flag (if protocol is TCP; ipv4 only) |
| 294 |
* @rst: TCP RST flag (if protocol is TCP; ipv4 only) |
| 295 |
* @syn: TCP SYN flag (if protocol is TCP; ipv4 only) |
| 296 |
* @fin: TCP FIN flag (if protocol is TCP; ipv4 only) |
| 297 |
*/ |
| 298 |
probe netfilter.ip.pre_routing = netfilter.ipv4.pre_routing, |
| 299 |
netfilter.ipv6.pre_routing |
| 300 |
{ |
| 301 |
} |
| 302 |
|
| 303 |
probe netfilter.ipv4.pre_routing |
| 304 |
= netfilter.hook("NF_INET_PRE_ROUTING").pf("NFPROTO_IPV4") |
| 305 |
{ |
| 306 |
@netfilter_common_setup("ipv4") |
| 307 |
@netfilter_ip4_setup |
| 308 |
} |
| 309 |
|
| 310 |
|
| 311 |
probe netfilter.ipv6.pre_routing |
| 312 |
= netfilter.hook("NF_IP6_PRE_ROUTING").pf("NFPROTO_IPV6") |
| 313 |
{ |
| 314 |
@netfilter_common_setup("ipv6") |
| 315 |
@netfilter_ip6_setup |
| 316 |
} |
| 317 |
|
| 318 |
/** |
| 319 |
* probe netfilter.ip.local_in - Called on an incoming IP packet addressed to the local computer |
| 320 |
* @pf: Protocol family -- either "ipv4" or "ipv6" |
| 321 |
* @indev: Address of net_device representing input device, 0 if unknown |
| 322 |
* @outdev: Address of net_device representing output device, 0 if unknown |
| 323 |
* @indev_name: Name of network device packet was received on (if known) |
| 324 |
* @outdev_name: Name of network device packet will be routed to (if known) |
| 325 |
* @length: The length of the packet buffer contents, in bytes |
| 326 |
* @data_str: A string representing the packet buffer contents |
| 327 |
* @data_hex: A hexadecimal string representing the packet buffer contents |
| 328 |
* @iphdr: Address of IP header |
| 329 |
* @protocol: Packet protocol from driver (ipv4 only) |
| 330 |
* @ipproto_tcp: Constant used to signify that the packet protocol is TCP |
| 331 |
* @ipproto_udp: Constant used to signify that the packet protocol is UDP |
| 332 |
* @nf_drop: Constant used to signify a 'drop' verdict |
| 333 |
* @nf_accept: Constant used to signify an 'accept' verdict |
| 334 |
* @nf_stolen: Constant used to signify a 'stolen' verdict |
| 335 |
* @nf_queue: Constant used to signify a 'queue' verdict |
| 336 |
* @nf_repeat: Constant used to signify a 'repeat' verdict |
| 337 |
* @nf_stop: Constant used to signify a 'stop' verdict |
| 338 |
* @family: IP address family |
| 339 |
* @saddr: A string representing the source IP address |
| 340 |
* @daddr: A string representing the destination IP address |
| 341 |
* @sport: TCP or UDP source port (ipv4 only) |
| 342 |
* @dport: TCP or UDP destination port (ipv4 only) |
| 343 |
* @urg: TCP URG flag (if protocol is TCP; ipv4 only) |
| 344 |
* @ack: TCP ACK flag (if protocol is TCP; ipv4 only) |
| 345 |
* @psh: TCP PSH flag (if protocol is TCP; ipv4 only) |
| 346 |
* @rst: TCP RST flag (if protocol is TCP; ipv4 only) |
| 347 |
* @syn: TCP SYN flag (if protocol is TCP; ipv4 only) |
| 348 |
* @fin: TCP FIN flag (if protocol is TCP; ipv4 only) |
| 349 |
*/ |
| 350 |
probe netfilter.ip.local_in = netfilter.ipv4.local_in, |
| 351 |
netfilter.ipv6.local_in |
| 352 |
{ |
| 353 |
} |
| 354 |
|
| 355 |
probe netfilter.ipv4.local_in |
| 356 |
= netfilter.hook("NF_INET_LOCAL_IN").pf("NFPROTO_IPV4") |
| 357 |
{ |
| 358 |
@netfilter_common_setup("ipv4") |
| 359 |
@netfilter_ip4_setup |
| 360 |
} |
| 361 |
|
| 362 |
|
| 363 |
probe netfilter.ipv6.local_in |
| 364 |
= netfilter.hook("NF_IP6_LOCAL_IN").pf("NFPROTO_IPV6") |
| 365 |
{ |
| 366 |
@netfilter_common_setup("ipv6") |
| 367 |
@netfilter_ip6_setup |
| 368 |
} |
| 369 |
|
| 370 |
/** |
| 371 |
* probe netfilter.ip.forward - Called on an incoming IP packet addressed to some other computer |
| 372 |
* @pf: Protocol family -- either "ipv4" or "ipv6" |
| 373 |
* @indev: Address of net_device representing input device, 0 if unknown |
| 374 |
* @outdev: Address of net_device representing output device, 0 if unknown |
| 375 |
* @indev_name: Name of network device packet was received on (if known) |
| 376 |
* @outdev_name: Name of network device packet will be routed to (if known) |
| 377 |
* @length: The length of the packet buffer contents, in bytes |
| 378 |
* @data_str: A string representing the packet buffer contents |
| 379 |
* @data_hex: A hexadecimal string representing the packet buffer contents |
| 380 |
* @iphdr: Address of IP header |
| 381 |
* @protocol: Packet protocol from driver (ipv4 only) |
| 382 |
* @ipproto_tcp: Constant used to signify that the packet protocol is TCP |
| 383 |
* @ipproto_udp: Constant used to signify that the packet protocol is UDP |
| 384 |
* @nf_drop: Constant used to signify a 'drop' verdict |
| 385 |
* @nf_accept: Constant used to signify an 'accept' verdict |
| 386 |
* @nf_stolen: Constant used to signify a 'stolen' verdict |
| 387 |
* @nf_queue: Constant used to signify a 'queue' verdict |
| 388 |
* @nf_repeat: Constant used to signify a 'repeat' verdict |
| 389 |
* @nf_stop: Constant used to signify a 'stop' verdict |
| 390 |
* @family: IP address family |
| 391 |
* @saddr: A string representing the source IP address |
| 392 |
* @daddr: A string representing the destination IP address |
| 393 |
* @sport: TCP or UDP source port (ipv4 only) |
| 394 |
* @dport: TCP or UDP destination port (ipv4 only) |
| 395 |
* @urg: TCP URG flag (if protocol is TCP; ipv4 only) |
| 396 |
* @ack: TCP ACK flag (if protocol is TCP; ipv4 only) |
| 397 |
* @psh: TCP PSH flag (if protocol is TCP; ipv4 only) |
| 398 |
* @rst: TCP RST flag (if protocol is TCP; ipv4 only) |
| 399 |
* @syn: TCP SYN flag (if protocol is TCP; ipv4 only) |
| 400 |
* @fin: TCP FIN flag (if protocol is TCP; ipv4 only) |
| 401 |
*/ |
| 402 |
probe netfilter.ip.forward = netfilter.ipv4.forward, |
| 403 |
netfilter.ipv6.forward |
| 404 |
{ |
| 405 |
} |
| 406 |
|
| 407 |
probe netfilter.ipv4.forward |
| 408 |
= netfilter.hook("NF_INET_FORWARD").pf("NFPROTO_IPV4") |
| 409 |
{ |
| 410 |
@netfilter_common_setup("ipv4") |
| 411 |
@netfilter_ip4_setup |
| 412 |
} |
| 413 |
|
| 414 |
|
| 415 |
probe netfilter.ipv6.forward |
| 416 |
= netfilter.hook("NF_IP6_FORWARD").pf("NFPROTO_IPV6") |
| 417 |
{ |
| 418 |
@netfilter_common_setup("ipv6") |
| 419 |
@netfilter_ip6_setup |
| 420 |
} |
| 421 |
|
| 422 |
/** |
| 423 |
* probe netfilter.ip.local_out - Called on an outgoing IP packet |
| 424 |
* @pf: Protocol family -- either "ipv4" or "ipv6" |
| 425 |
* @indev: Address of net_device representing input device, 0 if unknown |
| 426 |
* @outdev: Address of net_device representing output device, 0 if unknown |
| 427 |
* @indev_name: Name of network device packet was received on (if known) |
| 428 |
* @outdev_name: Name of network device packet will be routed to (if known) |
| 429 |
* @length: The length of the packet buffer contents, in bytes |
| 430 |
* @data_str: A string representing the packet buffer contents |
| 431 |
* @data_hex: A hexadecimal string representing the packet buffer contents |
| 432 |
* @iphdr: Address of IP header |
| 433 |
* @protocol: Packet protocol from driver (ipv4 only) |
| 434 |
* @ipproto_tcp: Constant used to signify that the packet protocol is TCP |
| 435 |
* @ipproto_udp: Constant used to signify that the packet protocol is UDP |
| 436 |
* @nf_drop: Constant used to signify a 'drop' verdict |
| 437 |
* @nf_accept: Constant used to signify an 'accept' verdict |
| 438 |
* @nf_stolen: Constant used to signify a 'stolen' verdict |
| 439 |
* @nf_queue: Constant used to signify a 'queue' verdict |
| 440 |
* @nf_repeat: Constant used to signify a 'repeat' verdict |
| 441 |
* @nf_stop: Constant used to signify a 'stop' verdict |
| 442 |
* @family: IP address family |
| 443 |
* @saddr: A string representing the source IP address |
| 444 |
* @daddr: A string representing the destination IP address |
| 445 |
* @sport: TCP or UDP source port (ipv4 only) |
| 446 |
* @dport: TCP or UDP destination port (ipv4 only) |
| 447 |
* @urg: TCP URG flag (if protocol is TCP; ipv4 only) |
| 448 |
* @ack: TCP ACK flag (if protocol is TCP; ipv4 only) |
| 449 |
* @psh: TCP PSH flag (if protocol is TCP; ipv4 only) |
| 450 |
* @rst: TCP RST flag (if protocol is TCP; ipv4 only) |
| 451 |
* @syn: TCP SYN flag (if protocol is TCP; ipv4 only) |
| 452 |
* @fin: TCP FIN flag (if protocol is TCP; ipv4 only) |
| 453 |
*/ |
| 454 |
probe netfilter.ip.local_out = netfilter.ipv4.local_out, |
| 455 |
netfilter.ipv6.local_out |
| 456 |
{ |
| 457 |
} |
| 458 |
|
| 459 |
probe netfilter.ipv4.local_out |
| 460 |
= netfilter.hook("NF_INET_LOCAL_OUT").pf("NFPROTO_IPV4") |
| 461 |
{ |
| 462 |
@netfilter_common_setup("ipv4") |
| 463 |
@netfilter_ip4_setup |
| 464 |
} |
| 465 |
|
| 466 |
probe netfilter.ipv6.local_out |
| 467 |
= netfilter.hook("NF_IP6_LOCAL_OUT").pf("NFPROTO_IPV6") |
| 468 |
{ |
| 469 |
@netfilter_common_setup("ipv6") |
| 470 |
@netfilter_ip6_setup |
| 471 |
} |
| 472 |
|
| 473 |
/** |
| 474 |
* probe netfilter.ip.post_routing - Called immediately before an outgoing IP packet leaves the computer |
| 475 |
* @pf: Protocol family -- either "ipv4" or "ipv6" |
| 476 |
* @indev: Address of net_device representing input device, 0 if unknown |
| 477 |
* @outdev: Address of net_device representing output device, 0 if unknown |
| 478 |
* @indev_name: Name of network device packet was received on (if known) |
| 479 |
* @outdev_name: Name of network device packet will be routed to (if known) |
| 480 |
* @length: The length of the packet buffer contents, in bytes |
| 481 |
* @data_str: A string representing the packet buffer contents |
| 482 |
* @data_hex: A hexadecimal string representing the packet buffer contents |
| 483 |
* @iphdr: Address of IP header |
| 484 |
* @protocol: Packet protocol from driver (ipv4 only) |
| 485 |
* @ipproto_tcp: Constant used to signify that the packet protocol is TCP |
| 486 |
* @ipproto_udp: Constant used to signify that the packet protocol is UDP |
| 487 |
* @nf_drop: Constant used to signify a 'drop' verdict |
| 488 |
* @nf_accept: Constant used to signify an 'accept' verdict |
| 489 |
* @nf_stolen: Constant used to signify a 'stolen' verdict |
| 490 |
* @nf_queue: Constant used to signify a 'queue' verdict |
| 491 |
* @nf_repeat: Constant used to signify a 'repeat' verdict |
| 492 |
* @nf_stop: Constant used to signify a 'stop' verdict |
| 493 |
* @family: IP address family |
| 494 |
* @saddr: A string representing the source IP address |
| 495 |
* @daddr: A string representing the destination IP address |
| 496 |
* @sport: TCP or UDP source port (ipv4 only) |
| 497 |
* @dport: TCP or UDP destination port (ipv4 only) |
| 498 |
* @urg: TCP URG flag (if protocol is TCP; ipv4 only) |
| 499 |
* @ack: TCP ACK flag (if protocol is TCP; ipv4 only) |
| 500 |
* @psh: TCP PSH flag (if protocol is TCP; ipv4 only) |
| 501 |
* @rst: TCP RST flag (if protocol is TCP; ipv4 only) |
| 502 |
* @syn: TCP SYN flag (if protocol is TCP; ipv4 only) |
| 503 |
* @fin: TCP FIN flag (if protocol is TCP; ipv4 only) |
| 504 |
*/ |
| 505 |
probe netfilter.ip.post_routing = netfilter.ipv4.post_routing, |
| 506 |
netfilter.ipv6.local_out |
| 507 |
{ |
| 508 |
} |
| 509 |
|
| 510 |
probe netfilter.ipv4.post_routing |
| 511 |
= netfilter.hook("NF_INET_POST_ROUTING").pf("NFPROTO_IPV4") |
| 512 |
{ |
| 513 |
@netfilter_common_setup("ipv4") |
| 514 |
@netfilter_ip4_setup |
| 515 |
} |
| 516 |
|
| 517 |
|
| 518 |
probe netfilter.ipv6.post_routing |
| 519 |
= netfilter.hook("NF_IP6_POST_ROUTING").pf("NFPROTO_IPV6") |
| 520 |
{ |
| 521 |
@netfilter_common_setup("ipv6") |
| 522 |
@netfilter_ip6_setup |
| 523 |
} |
| 524 |
|
| 525 |
@define netfilter_arp_setup %( |
| 526 |
# XXX: include functionality to parse ARP packet contents |
| 527 |
try { |
| 528 |
arphdr = & @cast(__get_skb_arphdr($skb), "struct arphdr", "kernel<linux/if_arp.h>") |
| 529 |
family = @const("NF_ARP") // from linux/netfilter_arp.h |
| 530 |
ar_hrd = ntohs(arphdr->ar_hrd) |
| 531 |
ar_pro = ntohs(arphdr->ar_pro) |
| 532 |
ar_hln = arphdr->ar_hln |
| 533 |
ar_pln = arphdr->ar_pln |
| 534 |
ar_op = ntohs(arphdr->ar_op) |
| 535 |
} catch { } |
| 536 |
|
| 537 |
ar_data = arphdr + 8 |
| 538 |
if (ar_hrd == 0x001 && ar_pro == 0x800) { |
| 539 |
/* additional info available for most common (Ethernet+IP) case: */ |
| 540 |
ar_sha = __mac_addr_to_string(ar_data) |
| 541 |
ar_sip = format_ipaddr(kernel_int(ar_data + 6), @const("AF_INET")) |
| 542 |
ar_tha = __mac_addr_to_string(ar_data + 10) |
| 543 |
ar_tip = format_ipaddr(kernel_int(ar_data + 16), @const("AF_INET")) |
| 544 |
} |
| 545 |
/* XXX support for additional cases? */ |
| 546 |
%) |
| 547 |
|
| 548 |
/** |
| 549 |
* probe netfilter.arp.in -- Called for each incoming ARP packet |
| 550 |
* @pf: Protocol family -- always "arp" |
| 551 |
* @indev: Address of net_device representing input device, 0 if unknown |
| 552 |
* @outdev: Address of net_device representing output device, 0 if unknown |
| 553 |
* @indev_name: Name of network device packet was received on (if known) |
| 554 |
* @outdev_name: Name of network device packet will be routed to (if known) |
| 555 |
* @length: The length of the packet buffer contents, in bytes |
| 556 |
* @data_str: A string representing the packet buffer contents |
| 557 |
* @data_hex: A hexadecimal string representing the packet buffer contents |
| 558 |
* @arphdr: Address of ARP header |
| 559 |
* @ar_hrd: Format of hardware address |
| 560 |
* @ar_pro: Format of protocol address |
| 561 |
* @ar_hln: Length of hardware address |
| 562 |
* @ar_pln: Length of protocol address |
| 563 |
* @ar_op: ARP opcode (command) |
| 564 |
* @ar_data: Address of ARP packet data region (after the header) |
| 565 |
* @ar_sha: Ethernet+IP only (ar_pro==0x800): source hardware (MAC) address |
| 566 |
* @ar_sip: Ethernet+IP only (ar_pro==0x800): source IP address |
| 567 |
* @ar_tha: Ethernet+IP only (ar_pro==0x800): target hardware (MAC) address |
| 568 |
* @ar_tip: Ethernet+IP only (ar_pro==0x800): target IP address |
| 569 |
* @nf_drop: Constant used to signify a 'drop' verdict |
| 570 |
* @nf_accept: Constant used to signify an 'accept' verdict |
| 571 |
* @nf_stolen: Constant used to signify a 'stolen' verdict |
| 572 |
* @nf_queue: Constant used to signify a 'queue' verdict |
| 573 |
* @nf_repeat: Constant used to signify a 'repeat' verdict |
| 574 |
* @nf_stop: Constant used to signify a 'stop' verdict |
| 575 |
*/ |
| 576 |
probe netfilter.arp.in = netfilter.hook("NF_ARP_IN").pf("NFPROTO_ARP") |
| 577 |
{ |
| 578 |
@netfilter_common_setup("arp") |
| 579 |
@netfilter_arp_setup |
| 580 |
} |
| 581 |
|
| 582 |
|
| 583 |
/** |
| 584 |
* probe netfilter.arp.out -- Called for each outgoing ARP packet |
| 585 |
* @pf: Protocol family -- always "arp" |
| 586 |
* @indev: Address of net_device representing input device, 0 if unknown |
| 587 |
* @outdev: Address of net_device representing output device, 0 if unknown |
| 588 |
* @indev_name: Name of network device packet was received on (if known) |
| 589 |
* @outdev_name: Name of network device packet will be routed to (if known) |
| 590 |
* @length: The length of the packet buffer contents, in bytes |
| 591 |
* @data_str: A string representing the packet buffer contents |
| 592 |
* @data_hex: A hexadecimal string representing the packet buffer contents |
| 593 |
* @arphdr: Address of ARP header |
| 594 |
* @ar_hrd: Format of hardware address |
| 595 |
* @ar_pro: Format of protocol address |
| 596 |
* @ar_hln: Length of hardware address |
| 597 |
* @ar_pln: Length of protocol address |
| 598 |
* @ar_op: ARP opcode (command) |
| 599 |
* @ar_data: Address of ARP packet data region (after the header) |
| 600 |
* @ar_sha: Ethernet+IP only (ar_pro==0x800): source hardware (MAC) address |
| 601 |
* @ar_sip: Ethernet+IP only (ar_pro==0x800): source IP address |
| 602 |
* @ar_tha: Ethernet+IP only (ar_pro==0x800): target hardware (MAC) address |
| 603 |
* @ar_tip: Ethernet+IP only (ar_pro==0x800): target IP address |
| 604 |
* @nf_drop: Constant used to signify a 'drop' verdict |
| 605 |
* @nf_accept: Constant used to signify an 'accept' verdict |
| 606 |
* @nf_stolen: Constant used to signify a 'stolen' verdict |
| 607 |
* @nf_queue: Constant used to signify a 'queue' verdict |
| 608 |
* @nf_repeat: Constant used to signify a 'repeat' verdict |
| 609 |
* @nf_stop: Constant used to signify a 'stop' verdict |
| 610 |
*/ |
| 611 |
probe netfilter.arp.out = netfilter.hook("NF_ARP_OUT").pf("NFPROTO_ARP") |
| 612 |
{ |
| 613 |
@netfilter_common_setup("arp") |
| 614 |
@netfilter_arp_setup |
| 615 |
} |
| 616 |
|
| 617 |
/** |
| 618 |
* probe netfilter.arp.forward -- Called for each ARP packet to be forwarded |
| 619 |
* @pf: Protocol family -- always "arp" |
| 620 |
* @indev: Address of net_device representing input device, 0 if unknown |
| 621 |
* @outdev: Address of net_device representing output device, 0 if unknown |
| 622 |
* @indev_name: Name of network device packet was received on (if known) |
| 623 |
* @outdev_name: Name of network device packet will be routed to (if known) |
| 624 |
* @length: The length of the packet buffer contents, in bytes |
| 625 |
* @data_str: A string representing the packet buffer contents |
| 626 |
* @data_hex: A hexadecimal string representing the packet buffer contents |
| 627 |
* @arphdr: Address of ARP header |
| 628 |
* @ar_hrd: Format of hardware address |
| 629 |
* @ar_pro: Format of protocol address |
| 630 |
* @ar_hln: Length of hardware address |
| 631 |
* @ar_pln: Length of protocol address |
| 632 |
* @ar_op: ARP opcode (command) |
| 633 |
* @ar_data: Address of ARP packet data region (after the header) |
| 634 |
* @ar_sha: Ethernet+IP only (ar_pro==0x800): source hardware (MAC) address |
| 635 |
* @ar_sip: Ethernet+IP only (ar_pro==0x800): source IP address |
| 636 |
* @ar_tha: Ethernet+IP only (ar_pro==0x800): target hardware (MAC) address |
| 637 |
* @ar_tip: Ethernet+IP only (ar_pro==0x800): target IP address |
| 638 |
* @nf_drop: Constant used to signify a 'drop' verdict |
| 639 |
* @nf_accept: Constant used to signify an 'accept' verdict |
| 640 |
* @nf_stolen: Constant used to signify a 'stolen' verdict |
| 641 |
* @nf_queue: Constant used to signify a 'queue' verdict |
| 642 |
* @nf_repeat: Constant used to signify a 'repeat' verdict |
| 643 |
* @nf_stop: Constant used to signify a 'stop' verdict |
| 644 |
*/ |
| 645 |
probe netfilter.arp.forward = netfilter.hook("NF_ARP_FORWARD").pf("NFPROTO_ARP") |
| 646 |
{ |
| 647 |
@netfilter_common_setup("arp") |
| 648 |
@netfilter_arp_setup |
| 649 |
} |
| 650 |
|
| 651 |
@define netfilter_bridge_setup %( |
| 652 |
try { |
| 653 |
llcpdu = &@cast(__get_skb_llc($skb), "struct llc_pdu_un", |
| 654 |
"kernel<net/llc_pdu.h>") |
| 655 |
brhdr = __get_skb_brhdr($skb) |
| 656 |
} catch { } |
| 657 |
llcproto_stp = @const("LLC_SAP_BSPAN") // from linux/llc.h |
| 658 |
|
| 659 |
if (llcpdu->dsap == llcproto_stp && llcpdu->ssap == llcproto_stp) { |
| 660 |
protocol = llcproto_stp |
| 661 |
br_prid = ntohs(kernel_short(brhdr)) |
| 662 |
br_vid = kernel_char(brhdr + 2) |
| 663 |
br_type = kernel_char(brhdr + 3) |
| 664 |
br_flags = kernel_char(brhdr + 4) |
| 665 |
br_rid = kernel_long(brhdr + 5) |
| 666 |
br_rmac = __mac_addr_to_string(brhdr + 7) |
| 667 |
br_cost = ntohl(kernel_int(brhdr + 13)) |
| 668 |
br_bid = kernel_long(brhdr + 17) |
| 669 |
br_mac = __mac_addr_to_string(brhdr + 19) |
| 670 |
br_poid = ntohs(kernel_short(brhdr + 25)) |
| 671 |
br_msg = ntohs(kernel_short(brhdr + 27)) |
| 672 |
br_max = ntohs(kernel_short(brhdr + 29)) |
| 673 |
br_htime = ntohs(kernel_short(brhdr + 31)) |
| 674 |
br_fd = ntohs(kernel_short(brhdr + 33)) |
| 675 |
} |
| 676 |
%) |
| 677 |
|
| 678 |
/** |
| 679 |
* probe netfilter.bridge.pre_routing -- Called before a bridging packet is routed |
| 680 |
* @pf: Protocol family -- always "bridge" |
| 681 |
* @indev: Address of net_device representing input device, 0 if unknown |
| 682 |
* @outdev: Address of net_device representing output device, 0 if unknown |
| 683 |
* @indev_name: Name of network device packet was received on (if known) |
| 684 |
* @outdev_name: Name of network device packet will be routed to (if known) |
| 685 |
* @llcpdu: Address of LLC Protocol Data Unit |
| 686 |
* @brhdr: Address of bridge header |
| 687 |
* @llcproto_stp: Constant used to signify Bridge Spanning Tree Protocol packet |
| 688 |
* @protocol: Packet protocol |
| 689 |
* @br_prid: Protocol identifier |
| 690 |
* @br_vid: Protocol version identifier |
| 691 |
* @br_type: BPDU type |
| 692 |
* @br_flags: BPDU flags |
| 693 |
* @br_rid: Identity of root bridge |
| 694 |
* @br_rmac: Root bridge MAC address |
| 695 |
* @br_cost: Total cost from transmitting bridge to root |
| 696 |
* @br_bid: Identity of bridge |
| 697 |
* @br_mac: Bridge MAC address |
| 698 |
* @br_poid: Port identifier |
| 699 |
* @br_msg: Message age in 1/256 secs |
| 700 |
* @br_max: Max age in 1/256 secs |
| 701 |
* @br_htime: Hello time in 1/256 secs |
| 702 |
* @br_fd: Forward delay in 1/256 secs |
| 703 |
* @length: The length of the packet buffer contents, in bytes |
| 704 |
* @data_str: A string representing the packet buffer contents |
| 705 |
* @data_hex: A hexadecimal string representing the packet buffer contents |
| 706 |
* @nf_drop: Constant used to signify a 'drop' verdict |
| 707 |
* @nf_accept: Constant used to signify an 'accept' verdict |
| 708 |
* @nf_stolen: Constant used to signify a 'stolen' verdict |
| 709 |
* @nf_queue: Constant used to signify a 'queue' verdict |
| 710 |
* @nf_repeat: Constant used to signify a 'repeat' verdict |
| 711 |
* @nf_stop: Constant used to signify a 'stop' verdict |
| 712 |
*/ |
| 713 |
probe netfilter.bridge.pre_routing |
| 714 |
= netfilter.hook("NF_BR_PRE_ROUTING").pf("NFPROTO_BRIDGE") |
| 715 |
{ |
| 716 |
@netfilter_common_setup("bridge") |
| 717 |
@netfilter_bridge_setup |
| 718 |
} |
| 719 |
|
| 720 |
/** |
| 721 |
* probe netfilter.bridge.local_in - Called on a bridging packet destined for the local computer |
| 722 |
* @pf: Protocol family -- always "bridge" |
| 723 |
* @indev: Address of net_device representing input device, 0 if unknown |
| 724 |
* @outdev: Address of net_device representing output device, 0 if unknown |
| 725 |
* @indev_name: Name of network device packet was received on (if known) |
| 726 |
* @outdev_name: Name of network device packet will be routed to (if known) |
| 727 |
* @llcpdu: Address of LLC Protocol Data Unit |
| 728 |
* @brhdr: Address of bridge header |
| 729 |
* @llcproto_stp: Constant used to signify Bridge Spanning Tree Protocol packet |
| 730 |
* @protocol: Packet protocol |
| 731 |
* @br_prid: Protocol identifier |
| 732 |
* @br_vid: Protocol version identifier |
| 733 |
* @br_type: BPDU type |
| 734 |
* @br_flags: BPDU flags |
| 735 |
* @br_rid: Identity of root bridge |
| 736 |
* @br_rmac: Root bridge MAC address |
| 737 |
* @br_cost: Total cost from transmitting bridge to root |
| 738 |
* @br_bid: Identity of bridge |
| 739 |
* @br_mac: Bridge MAC address |
| 740 |
* @br_poid: Port identifier |
| 741 |
* @br_msg: Message age in 1/256 secs |
| 742 |
* @br_max: Max age in 1/256 secs |
| 743 |
* @br_htime: Hello time in 1/256 secs |
| 744 |
* @br_fd: Forward delay in 1/256 secs |
| 745 |
* @length: The length of the packet buffer contents, in bytes |
| 746 |
* @data_str: A string representing the packet buffer contents |
| 747 |
* @data_hex: A hexadecimal string representing the packet buffer contents |
| 748 |
* @nf_drop: Constant used to signify a 'drop' verdict |
| 749 |
* @nf_accept: Constant used to signify an 'accept' verdict |
| 750 |
* @nf_stolen: Constant used to signify a 'stolen' verdict |
| 751 |
* @nf_queue: Constant used to signify a 'queue' verdict |
| 752 |
* @nf_repeat: Constant used to signify a 'repeat' verdict |
| 753 |
* @nf_stop: Constant used to signify a 'stop' verdict |
| 754 |
*/ |
| 755 |
probe netfilter.bridge.local_in |
| 756 |
= netfilter.hook("NF_BR_LOCAL_IN").pf("NFPROTO_BRIDGE") |
| 757 |
{ |
| 758 |
@netfilter_common_setup("bridge") |
| 759 |
@netfilter_bridge_setup |
| 760 |
} |
| 761 |
|
| 762 |
/** |
| 763 |
* probe netfilter.bridge.forward - Called on an incoming bridging packet destined for some other computer |
| 764 |
* @pf: Protocol family -- always "bridge" |
| 765 |
* @indev: Address of net_device representing input device, 0 if unknown |
| 766 |
* @outdev: Address of net_device representing output device, 0 if unknown |
| 767 |
* @indev_name: Name of network device packet was received on (if known) |
| 768 |
* @outdev_name: Name of network device packet will be routed to (if known) |
| 769 |
* @llcpdu: Address of LLC Protocol Data Unit |
| 770 |
* @brhdr: Address of bridge header |
| 771 |
* @llcproto_stp: Constant used to signify Bridge Spanning Tree Protocol packet |
| 772 |
* @protocol: Packet protocol |
| 773 |
* @br_prid: Protocol identifier |
| 774 |
* @br_vid: Protocol version identifier |
| 775 |
* @br_type: BPDU type |
| 776 |
* @br_flags: BPDU flags |
| 777 |
* @br_rid: Identity of root bridge |
| 778 |
* @br_rmac: Root bridge MAC address |
| 779 |
* @br_cost: Total cost from transmitting bridge to root |
| 780 |
* @br_bid: Identity of bridge |
| 781 |
* @br_mac: Bridge MAC address |
| 782 |
* @br_poid: Port identifier |
| 783 |
* @br_msg: Message age in 1/256 secs |
| 784 |
* @br_max: Max age in 1/256 secs |
| 785 |
* @br_htime: Hello time in 1/256 secs |
| 786 |
* @br_fd: Forward delay in 1/256 secs |
| 787 |
* @length: The length of the packet buffer contents, in bytes |
| 788 |
* @data_str: A string representing the packet buffer contents |
| 789 |
* @data_hex: A hexadecimal string representing the packet buffer contents |
| 790 |
* @nf_drop: Constant used to signify a 'drop' verdict |
| 791 |
* @nf_accept: Constant used to signify an 'accept' verdict |
| 792 |
* @nf_stolen: Constant used to signify a 'stolen' verdict |
| 793 |
* @nf_queue: Constant used to signify a 'queue' verdict |
| 794 |
* @nf_repeat: Constant used to signify a 'repeat' verdict |
| 795 |
* @nf_stop: Constant used to signify a 'stop' verdict |
| 796 |
*/ |
| 797 |
probe netfilter.bridge.forward |
| 798 |
= netfilter.hook("NF_BR_FORWARD").pf("NFPROTO_BRIDGE") |
| 799 |
{ |
| 800 |
@netfilter_common_setup("bridge") |
| 801 |
@netfilter_bridge_setup |
| 802 |
} |
| 803 |
|
| 804 |
/** |
| 805 |
* probe netfilter.bridge.local_out - Called on a bridging packet coming from a local process |
| 806 |
* @pf: Protocol family -- always "bridge" |
| 807 |
* @indev: Address of net_device representing input device, 0 if unknown |
| 808 |
* @outdev: Address of net_device representing output device, 0 if unknown |
| 809 |
* @indev_name: Name of network device packet was received on (if known) |
| 810 |
* @outdev_name: Name of network device packet will be routed to (if known) |
| 811 |
* @llcpdu: Address of LLC Protocol Data Unit |
| 812 |
* @brhdr: Address of bridge header |
| 813 |
* @llcproto_stp: Constant used to signify Bridge Spanning Tree Protocol packet |
| 814 |
* @protocol: Packet protocol |
| 815 |
* @br_prid: Protocol identifier |
| 816 |
* @br_vid: Protocol version identifier |
| 817 |
* @br_type: BPDU type |
| 818 |
* @br_flags: BPDU flags |
| 819 |
* @br_rid: Identity of root bridge |
| 820 |
* @br_rmac: Root bridge MAC address |
| 821 |
* @br_cost: Total cost from transmitting bridge to root |
| 822 |
* @br_bid: Identity of bridge |
| 823 |
* @br_mac: Bridge MAC address |
| 824 |
* @br_poid: Port identifier |
| 825 |
* @br_msg: Message age in 1/256 secs |
| 826 |
* @br_max: Max age in 1/256 secs |
| 827 |
* @br_htime: Hello time in 1/256 secs |
| 828 |
* @br_fd: Forward delay in 1/256 secs |
| 829 |
* @length: The length of the packet buffer contents, in bytes |
| 830 |
* @data_str: A string representing the packet buffer contents |
| 831 |
* @data_hex: A hexadecimal string representing the packet buffer contents |
| 832 |
* @nf_drop: Constant used to signify a 'drop' verdict |
| 833 |
* @nf_accept: Constant used to signify an 'accept' verdict |
| 834 |
* @nf_stolen: Constant used to signify a 'stolen' verdict |
| 835 |
* @nf_queue: Constant used to signify a 'queue' verdict |
| 836 |
* @nf_repeat: Constant used to signify a 'repeat' verdict |
| 837 |
* @nf_stop: Constant used to signify a 'stop' verdict |
| 838 |
*/ |
| 839 |
probe netfilter.bridge.local_out |
| 840 |
= netfilter.hook("NF_BR_LOCAL_OUT").pf("NFPROTO_BRIDGE") |
| 841 |
{ |
| 842 |
@netfilter_common_setup("bridge") |
| 843 |
@netfilter_bridge_setup |
| 844 |
} |
| 845 |
|
| 846 |
/** |
| 847 |
* probe netfilter.bridge.post_routing -- Called before a bridging packet hits the wire |
| 848 |
* @pf: Protocol family -- always "bridge" |
| 849 |
* @indev: Address of net_device representing input device, 0 if unknown |
| 850 |
* @outdev: Address of net_device representing output device, 0 if unknown |
| 851 |
* @indev_name: Name of network device packet was received on (if known) |
| 852 |
* @outdev_name: Name of network device packet will be routed to (if known) |
| 853 |
* @llcpdu: Address of LLC Protocol Data Unit |
| 854 |
* @brhdr: Address of bridge header |
| 855 |
* @llcproto_stp: Constant used to signify Bridge Spanning Tree Protocol packet |
| 856 |
* @protocol: Packet protocol |
| 857 |
* @br_prid: Protocol identifier |
| 858 |
* @br_vid: Protocol version identifier |
| 859 |
* @br_type: BPDU type |
| 860 |
* @br_flags: BPDU flags |
| 861 |
* @br_rid: Identity of root bridge |
| 862 |
* @br_rmac: Root bridge MAC address |
| 863 |
* @br_cost: Total cost from transmitting bridge to root |
| 864 |
* @br_bid: Identity of bridge |
| 865 |
* @br_mac: Bridge MAC address |
| 866 |
* @br_poid: Port identifier |
| 867 |
* @br_msg: Message age in 1/256 secs |
| 868 |
* @br_max: Max age in 1/256 secs |
| 869 |
* @br_htime: Hello time in 1/256 secs |
| 870 |
* @br_fd: Forward delay in 1/256 secs |
| 871 |
* @length: The length of the packet buffer contents, in bytes |
| 872 |
* @data_str: A string representing the packet buffer contents |
| 873 |
* @data_hex: A hexadecimal string representing the packet buffer contents |
| 874 |
* @nf_drop: Constant used to signify a 'drop' verdict |
| 875 |
* @nf_accept: Constant used to signify an 'accept' verdict |
| 876 |
* @nf_stolen: Constant used to signify a 'stolen' verdict |
| 877 |
* @nf_queue: Constant used to signify a 'queue' verdict |
| 878 |
* @nf_repeat: Constant used to signify a 'repeat' verdict |
| 879 |
* @nf_stop: Constant used to signify a 'stop' verdict |
| 880 |
*/ |
| 881 |
probe netfilter.bridge.post_routing |
| 882 |
= netfilter.hook("NF_BR_POST_ROUTING").pf("NFPROTO_BRIDGE") |
| 883 |
{ |
| 884 |
@netfilter_common_setup("bridge") |
| 885 |
@netfilter_bridge_setup |
| 886 |
} |