Fix dns_matching example
* The name encoding function was not checking the constraints on domain names properly (<= 253 chars as one byte is needed for the name of the label and one for the terminating 0-len label; <= 63 chars per label). * The name encoding function was erroring when assigning a struct value in the byte array (Python 3.6.3). Refactored to join successive subarrays, and moved the null padding to make it explicit that it is needed by the bpf map key (and not the dns encoding). * Used builtin from argparse to have a list of domains in the command line arguments. * Reset the non-block flag through fcntl directly instead of reconstructing a socket object. * Exit gracefully when triggering SIGINT as hinted.
Showing
Please register or sign in to comment