Bug 189147
Summary: | Incorrect description of inet_network in man page | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | brett.anderson <brett.anderson> |
Component: | man-pages | Assignee: | Ivana Varekova <varekova> |
Status: | CLOSED RAWHIDE | QA Contact: | Ben Levenson <benl> |
Severity: | low | Docs Contact: | |
Priority: | medium | ||
Version: | rawhide | CC: | tommy.reynolds |
Target Milestone: | --- | Keywords: | Reopened |
Target Release: | --- | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2006-06-29 11:02:19 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
brett.anderson@speakeasy.net
2006-04-17 16:48:52 UTC
This bug should be filed against the man-pages package. Changing component and bug owner. The network number is used in both functions inet_network and inet_netof but this number is in different formats. (In reply to comment #2) > The network number is used in both functions inet_network and inet_netof but > this number is in different formats. I think there is some confusion over what a network number is. A network number is not simply an IPv4 internet address. A network number, is the network portion of an IPv4 address. The network number is what you get when you do a bitwise AND of an IP address with a netmask. another way to look at it is that the network number is the first n bytes of an address where your CIDR is /n. See the following for a better understanding of the network number and CIDR masking: http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing The documentation in the man page states that inet_network() extracts the network number, when it is actually extracting an internet address. inet_network() does the same thing as inet_addr except that it returns the address in host byte order instead of network byte order. The description in the man page is incorrect in that it makes it sound as if inet_network() behaves the same as inet_netof() The following code illustrates what I am trying to say: /*****************************************/ struct sockaddr_in addr; unsigned long net1, net2; net1 = inet_network("192.168.0.1"); inet_aton("192.168.0.1", &addr.sin_addr); net2 = inet_netof(addr.sin_addr); pprintf("0x%08lX\n", net1); printf("0x%08lX\n", net2); /*****************************************/ If you run the above code, you can see that inet_network() returns a 32bit internet address in host byte order and inet_netof() returns a network address. If inet_network was to do what the man page description says, it would return the same result as inet_netof(). Please take a closer look at this. If you do, you should see what I am saying. If you have any questions, please let me know. Thanks, Brett Thank you for your bug report. You are right the man page should be changed. The problem should be fixed in man-pages-2.34-1. |