Bug 60509
Summary: | ifconfig improperly calculates broadcast addr if not provided | ||
---|---|---|---|
Product: | [Retired] Red Hat Linux | Reporter: | Just E <just.e> |
Component: | net-tools | Assignee: | Radek Vokál <rvokal> |
Status: | CLOSED RAWHIDE | QA Contact: | Ben Levenson <benl> |
Severity: | low | Docs Contact: | |
Priority: | medium | ||
Version: | 7.2 | CC: | tmraz |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2004-11-04 14:01:05 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
Just E
2002-02-28 19:25:05 UTC
Perhaps worth a separate bug, but the man page should discuss the default value for broadcast if not provided (as it does for netmask). If what has been described in this defect report is acutally "how it is supposed to work," that should be documented as well so there are no surprises. Thats a good question... I think it depends, but i tend to agree with you that for a given netmask and a given network the network address as well as the broadcast address can and should be automatically calculated and set correctly, except if someone explicitly sets it to something else (for whatever reason). I'll look into it, probably will change the behaviour, not the manpage. Read ya, Phil The code in devinet.c shows that calling SIOCSIFADDR sets class A/B/C defaults for netmask, prefixlen and broadcast; while SIOCSIFNETMASK sets only the prefixlen and netmask, and SIOCSIFBRDADDR sets only the broadcast. In this case, if ifconfig does not do an explicit SIOCSIFBRDADDR the result is a 'stale' class A/B/C entry generated by SIOCSIFADDR that does not match the supplied netmask. I am guessing ifconfig only calls SIOCIFBRDADDR if 'broadcast xxx.xxx.xxx.xxx' is specified on the command line. The likely fix, then, is simply to SIOCIFBRDADDR whenever the provided netmask is not identical to a class A/B/C equivalent. Another symptom of this defect report is when 'broadcast' is supplied on the command line but 'netmask' is not. In such a case, the broadcast and netmask do not correspond. This defect should be amended to include this side-effect as well, as it requires a separate fix. To summarize my thoughts on a solution: 1) ifconfig should explicitly SIOCSIFBRDADDR when a netmask is supplied that does not correspond to the class A/B/C default for the supplied IP address and no broadcast has been supplied. 2) ifconfig should explicitly SIOCSIFNETMASK when a broadcast is supplied that does not correspond to the class A/B/C default for the supplied IP address and no netmask has been supplied. The 1) is debatable but probably should be implemented. The 2) isn't possible to implement because you cannot properly derive a netmask from a broadcast address. Consider: What's the correct netmask for broadcast 1.2.3.7? Is it 255.255.255.252, or 255.255.255.248? Note both are perfectly valid. net-tools-1.60-39 in FC is now calculating broadcast adress when only netmask is provided. The second option as Tom described won't be fixed. In this case netmask has to be set manualy. |