Page MenuHomeFreeBSD

Porting utility getaddrinfo from NetBSD
ClosedPublic

Authored by lohithbsd_gmail.com on Jan 28 2017, 5:47 AM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 23 2024, 10:46 PM
Unknown Object (File)
Jan 31 2024, 5:09 AM
Unknown Object (File)
Jan 31 2024, 5:09 AM
Unknown Object (File)
Jan 13 2024, 6:49 AM
Unknown Object (File)
Dec 21 2023, 10:12 PM
Unknown Object (File)
Dec 20 2023, 12:43 AM
Unknown Object (File)
Dec 11 2023, 1:51 AM
Unknown Object (File)
Nov 30 2023, 5:15 PM

Details

Summary

This revision is to port useful utility getaddrinfo from netbsd to FreeBSD head

Test Plan

Ported and tested on FreeBSD head

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 7948
Build 8092: arc lint + arc unit

Event Timeline

lohithbsd_gmail.com retitled this revision from to Porting utility getaddrinfo from NetBSD.
lohithbsd_gmail.com updated this object.
lohithbsd_gmail.com edited the test plan for this revision. (Show Details)
lohithbsd_gmail.com added a reviewer: hiren.
hiren edited edge metadata.

I'd appreciate another pair of eyes on this.

This revision is now accepted and ready to land.Jan 31 2017, 7:34 PM

I plan to review and commit this, but I don't have time right now. (Practically all of my FreeBSD time is through work, and I'm way too busy this week.)

I'm curious, you plan to add this code into FreeBSD base tree, not into the contrib section. Do we need to have all these #ifdefs in such case? I doubt that we have all such HAVE_XXX macros defined in our environment. Also we already have removed AppleTalk support from the tree.

hiren requested changes to this revision.Jan 31 2017, 7:58 PM
hiren edited edge metadata.
In D9365#194220, @ae wrote:

I'm curious, you plan to add this code into FreeBSD base tree, not into the contrib section. Do we need to have all these #ifdefs in such case? I doubt that we have all such HAVE_XXX macros defined in our environment. Also we already have removed AppleTalk support from the tree.

Good points. Is there any preference one way or another? I see we have $src/lib/libnetbsd so I thought this could live there?

I'll work with @lohithbsd_gmail.com to see how he compiled/tested things and get unneeded macros removed and upload the new patch.

This revision now requires changes to proceed.Jan 31 2017, 7:58 PM
In D9365#194224, @hiren wrote:
In D9365#194220, @ae wrote:

I'm curious, you plan to add this code into FreeBSD base tree, not into the contrib section. Do we need to have all these #ifdefs in such case? I doubt that we have all such HAVE_XXX macros defined in our environment. Also we already have removed AppleTalk support from the tree.

Good points. Is there any preference one way or another? I see we have $src/lib/libnetbsd so I thought this could live there?

I'll work with @lohithbsd_gmail.com to see how he compiled/tested things and get unneeded macros removed and upload the new patch.

Thanks a lot for the review comments. I had removed some of the #ifdefs for compiling, will go through all the #ifdefs and remove whichever is not required and will remove APPLE TALK related code.

wblock added inline comments.
usr.bin/getaddrinfo/getaddrinfo.1
48

(For this and following comments, I realize you didn't write this, but will comment on areas that are questionable anyway. It might be nice to relay these upstream even if this does not go in contrib.)

Does "as if" mean it does not use getaddrinfo(1), just is a workalike? This should state clearly exactly what the situation is.

51

"formats" can be read as a noun, so clarify.

routine, then formats them and prints them to standard output.
53

s/lines of/lines with/

64

This whole sentence is redundant and weird. (Some lines in replacement might be too long and need wrapping because of Phabricator's phabulousness.)

Depending on the settings in
.Xr nsswitch.conf 5 ,
.Nm
might query DNS for answers.
However, it is not intended to be a general-purpose DNS query utility.
Use
.Xr drill 1
for that.
74

s/The following/These/

121
Protocols are numeric or symbolic as listed in
125
Services are symbolic or numeric with an optional
128

Negative logic.

If a service is not specified, a hostname is required.
usr.bin/getaddrinfo/getaddrinfo.c
146

igor says there is empty whitespace on this line, looks like a couple of tabs.

usr.bin/getaddrinfo/getaddrinfo.1
48

No, it uses getaddrinfo(3). This utility prints information that you can obtain with getaddrinfo(3) function in a user-friendly format.

usr.bin/getaddrinfo/getaddrinfo.1
48

That's a much better description!

utility resolves host and service names to socket addresses with
.Xr getaddrinfo 3
and prints them to standard output in a user-friendly format.
lohithbsd_gmail.com added inline comments.
usr.bin/getaddrinfo/getaddrinfo.1
48

Yes. I didn't write this. Thanks for the review comments, have taken care all of them!

lohithbsd_gmail.com edited edge metadata.

Removed the Apple Nettalk related code. And addressed all the MAN page review comments.

It seems that the 'R' format character of sockaddr_snprintf() function has become useless. In the rest looks good for me.

In D9365#205183, @ae wrote:

It seems that the 'R' format character of sockaddr_snprintf() function has become useless. In the rest looks good for me.

Since this is a library function that might have other callers in the future, I recommend keeping it in order to maintain API compatibility.

This revision was automatically updated to reflect the committed changes.