|
18 | 18 | .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
19 | 19 | .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
20 | 20 | .\"
|
21 |
| -.TH PCAP-FILTER @MAN_MISC_INFO@ "9 February 2025" |
| 21 | +.TH PCAP-FILTER @MAN_MISC_INFO@ "22 February 2025" |
22 | 22 | .SH NAME
|
23 | 23 | pcap-filter \- packet filter syntax
|
24 | 24 | .br
|
@@ -415,16 +415,39 @@ True if the packet is an Ethernet broadcast packet.
|
415 | 415 | The \fBether\fP
|
416 | 416 | keyword is optional.
|
417 | 417 | .IP "\fBip broadcast\fR"
|
418 |
| -True if the packet is an IPv4 broadcast packet. |
419 |
| -It checks for both the all-zeroes and all-ones broadcast conventions, |
420 |
| -and looks up the subnet mask on the interface on which the capture is |
421 |
| -being done. |
| 418 | +True if the packet is an IPv4 packet with the host part of the destination |
| 419 | +address being either all-ones or all-zeroes. This primitive requires to |
| 420 | +specify the netmask, which cannot be done in the filter expression; the only |
| 421 | +way to specify a netmask is via the |
| 422 | +.B \%netmask |
| 423 | +argument of the |
| 424 | +.BR \%pcap_compile () |
| 425 | +function. If a netmask has not been specified, an attempt to compile a |
| 426 | +filter expression with this primitive will return an error. |
422 | 427 | .IP
|
423 |
| -If the subnet mask of the interface on which the capture is being done |
424 |
| -is not available, either because the interface on which capture is being |
425 |
| -done has no netmask or because the capture is being done on the Linux |
426 |
| -"any" interface, which can capture on more than one interface, this |
427 |
| -check will not work correctly. |
| 428 | +Note that this primitive ignores the network part of the destination address, |
| 429 | +thus it can match more packets than expected, especially if the interface has |
| 430 | +multiple IPv4 addresses with different netmasks. For example, if the |
| 431 | +interface has addresses 10.1.2.100/29 and 192.168.202.200/24 configured and |
| 432 | +the |
| 433 | +.B \%netmask |
| 434 | +argument corresponds to the first address, its value will be |
| 435 | +.BR \%0xFFFFFFF8 |
| 436 | +and the host mask value will be |
| 437 | +.BR \%0x00000007 . |
| 438 | +This will match the expected two addresses in the first prefix (10.1.2.96 and |
| 439 | +10.1.2.103), as well as 64 addresses in the second prefix (192.168.202.0, |
| 440 | +192.168.202.7, 192.168.202.8, 192.168.202.15, 192.168.202.16 and so on), as |
| 441 | +well as any other IPv4 address with the lowest 3 bits being all-ones or |
| 442 | +all-zeroes (for example: 10.73.74.151, 192.168.50.63, 172.19.0.128) -- in |
| 443 | +other words, 25% of the complete IPv4 address space. This is why in use |
| 444 | +cases that require more precision it would be better to match the required |
| 445 | +address(es) explicitly, for example: |
| 446 | +.in +.5i |
| 447 | +.nf |
| 448 | +\fBip dst host 10.1.2.96 or 10.1.2.103\fR |
| 449 | +.fi |
| 450 | +.in -.5i |
428 | 451 | .IP "\fBether multicast\fR"
|
429 | 452 | True if the packet is an Ethernet multicast packet.
|
430 | 453 | The \fBether\fP
|
|
0 commit comments