- Use getaddrinfo to replace gethostbyname.
- Update choose_ipaddr() function to take a more general parameter. Use struct addrinfo pointer as address list.
Details
Details
I use "nemesis" pkg to simulate rarp packet and use "tcpdump" to capture the send and response rarp packet and it seem work fine.
- Add a simulate MAC on "/etc/ethers" and add hosts.
$ cat /etc/ethers 00:0c:29:02:ba:a1 mytesthost $ cat /etc/hosts 192.168.42.128 mytesthost
- Then simulate with "nemesis" like below output. I also add some output about choose_ipaddr function to see if it output same as before.
// Same output on both revsied and not revised code $ sudo rarpd -a -f -s IP address: 192.168.42.128 $ sudo nemesis arp -d le0 -S 192.168.42.128 -D 192.168.42.255 -h 00:0c:29:02:ba:a1 -m 00:0c:29:02:ba:a1 -R $ sudo tcpdump -i le0 ether proto 0x8035 -vvv tcpdump: listening on le0, link-type EN10MB (Ethernet), snapshot length 262144 bytes 11:25:58.921947 ARP, Ethernet (len 6), IPv4 (len 4), Reverse Request who-is mytesthost tell mytesthost, length 28 11:25:58.922065 ARP, Ethernet (len 6), IPv4 (len 4), Reverse Reply mytesthost at mytesthost, length 28
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 58560 Build 55448: arc lint + arc unit