how to bind raw socket to specific interface
const char *opt; opt = “eth0”; const len = strnlen(opt, IFNAMSIZ); if (len == IFNAMSIZ) { fprintf(stderr, “Too long iface name”); return 1; } setsockopt(sd, SOL_SOCKET, SO_BINDTODEVICE, opt, len); First line: set up your variable Second line: tell the program which interface to bind to Lines 3-5: get length of interface name and check if … Read more