Understanding Tcpdump filter & bit-masking
问题 I am trying to sniff the http headers by using tcpdump. This filter works well but I can't understand it - (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0) I've googled it but I can't find any useful info Here is the whole tcpdump command sudo tcpdump -A 'dst [dest host] or src [src host] and tcp and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)' -i eth0 回答1: It's not the BPF filter that gets http headers but the "-A" switch on your tcpdump command. Your tcpdump