- Use getaddrinfo to replace gethostbyname.
- Use getnameinfo with NI_NAMEREQD flag to replace gethostbyaddr.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Warnings Severity Location Code Message Warning usr.sbin/arp/arp_netlink.c: CHMOD1 Invalid Executable - Unit
No Test Coverage - Build Status
Buildable 58173 Build 55061: arc lint + arc unit
Event Timeline
usr.sbin/arp/arp.c | ||
---|---|---|
262–263 | Should I use memset to replace the bzero function? |
This comment was removed by bses30074_gmail.com.
Comment Actions
Revise error code
We should use EAI_AGAIN instead of TRY_AGAIN error code while using getnameinfo.
Comment Actions
The change basically looks good to me, but I added some comments.
usr.sbin/arp/arp.c | ||
---|---|---|
263 | hints = (struct addrinfo){ .ai_family = AF_INET }; is enough for memset() + assignments. | |
618 | sizeof() should be replaced with addr->sin_len. I would recommend to change the type of addr to struct sockaddr, and define struct sockaddr_in *sin = (struct sockaddr_in *)addr at the top of this function to use it as sockaddr_in. This requires additional changes in search() and action_fn, though. | |
usr.sbin/arp/arp_netlink.c | ||
187 | The same as arp.c |