One of the more difficult aspects of writing Generic filter sets is determining how many bytes into the packet
(the Offset) the value you want to test is. In order to find the Offset value a good understanding of packet
formats is helpful. The following figure depicts a typical packet format structure for purposes of this example.
Destination
Address
6 octets
0
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|Version|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
Time to Live |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
0
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
Data |
| Offset| Reserved
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Observe that the first six bytes of the packet (frame) are used to indicate the destination MAC address and the
next six are used define the source MAC address. So, for example, to write a Generic filter set that would block
all incoming traffic to Mac address 00-00-c8-e3-95 you could create a filter rule like this:
Source
Frame Type
Address
6 octets
1
IHL
|Type of Service|
Identification
Protocol
Destination Address
Options
IP Header Format
Note that one tick mark represents one bit position.
1
Source Port
Sequence Number
Acknowledgment Number
|U|A|P|R|S|F|
|R|C|S|S|Y|I|
|
|G|K|H|T|N|N|
Checksum
Options
TCP Header Format
Note that one tick mark represents one bit position.
Frame Data
2 octets
64 - 1500 octets
2
Total Length
|Flags|
Fragment Offset
|
Header Checksum
Source Address
data
2
|
Destination Port
Window
|
Urgent Pointer
data
CRC
4 octets
3
|
|
|
|
|
|
Padding
|
|
3
|
|
|
|
|
|
|
|
Padding
|
|
Security 8-87