summaryrefslogtreecommitdiff
path: root/usr.bin/m4/main.c
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2014-04-29 11:58:30 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2014-04-29 11:58:30 +0000
commitda56150082fce6201d87c88d1d6236b29aa3575b (patch)
treee09c17505e4c440971e4b8095cee62f6dae34821 /usr.bin/m4/main.c
parent4a4ee23f0912ef525b45e5f8518b996489abd8e4 (diff)
If you plan to write an obfuscated-by-design kernel / userland
interface, I suggest you have a look at the link-layer sockaddr interface: /* * A Link-Level Sockaddr may specify the interface in one of two * ways: either by means of a system-provided index number (computed * anew and possibly differently on every reboot), or by a human-readable * string such as "il0" (for managerial convenience). [...] */ ifa_ifwithnet() was not only checking for the sdl_index in order to get the corresponding ifp for AF_LINK sockaddr, it was also iterating over all the addresses on your system! But in this case, the `address' field of "struct sockaddr_dl" is an interface name set by link_addr(3). How can this work? Well because the kernel allocates an empty `netmask' field for each interface's lladdr, so that you can abuse a network comparison function to reimplement strcmp(3)... So when the userland does not specify an interface index, try harder to see if it passed an ifp name, but at least be explicit and use ifunit(). Found the hard way by/ok sthen@
Diffstat (limited to 'usr.bin/m4/main.c')
0 files changed, 0 insertions, 0 deletions