The original code had used a fixed-size buffer for ioctl(SIOCGIFCONF),
that might cause the target ifreq spilled from the buffer.
Use the handy getifaddrs(3) to fix the problem.
Differential D35536
arp(8): use getifaddrs(3) instead of ioctl(SIOCGIFCONF) etc. takahiro.kurosawa_gmail.com on Jun 21 2022, 12:31 PM. Authored by Tags None Referenced Files
Subscribers
Details
The original code had used a fixed-size buffer for ioctl(SIOCGIFCONF), Use the handy getifaddrs(3) to fix the problem. Run the following script and check the output of ${arp} -s 198.51.100.200 auto pub #!/bin/sh naddrs=32 arp=/usr/sbin/arp ifconfig epair0 create ifconfig epair0a up ifconfig epair0b up i=1 while [ $i -le $naddrs ] do ifconfig epair0a inet 198.51.100.${i}/25 alias i=$((i+1)) done ifconfig epair0b ether ifconfig epair0b inet 198.51.100.129/25 ${arp} -s 198.51.100.200 auto pub ${arp} -n 198.51.100.200 ifconfig epair0a destroy
Diff Detail
|