Summary: | [carp] Changing advskew to 0 from another value doesn't work | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | Base System | Reporter: | cmb | ||||||||
Component: | kern | Assignee: | freebsd-net (Nobody) <net> | ||||||||
Status: | Closed FIXED | ||||||||||
Severity: | Affects Some People | CC: | garga, loos | ||||||||
Priority: | --- | ||||||||||
Version: | 10.1-RC2 | ||||||||||
Hardware: | Any | ||||||||||
OS: | Any | ||||||||||
Attachments: |
|
Description
cmb
2014-10-28 22:09:31 UTC
Looking into sys/netinet/ip_carp.c at line 1706: if (carpr.carpr_advskew > 0) { if (carpr.carpr_advskew >= 255) { error = EINVAL; break; } sc->sc_advskew = carpr.carpr_advskew; } It silently accepts 0 as a good value (no error returned) but it doesn't set sc->sc_advskew. Is it expected to work this way? Created attachment 151093 [details]
Fix set advskew back to 0
The attached patch make it possible to set advskew back to 0
Created attachment 151123 [details]
2nd attempt, fix also advbase check
There is one more issue, advbase should be >= 1 and <= 255, it makes proper check and also fix default advbase value on ifconfig to 1
Please ignore second patch, it has issues, will send a new one shortly Created attachment 151128 [details]
3rd version - Fix advskew and advbase checks, set default advbase for new entries
This version changes ifconfig to set default advbase to 1 on new entries, and because of that make advbase and advskew checks correct on kernel side
A commit references this bug: Author: loos Date: Tue Jan 6 13:07:14 UTC 2015 New revision: 276751 URL: https://svnweb.freebsd.org/changeset/base/276751 Log: Remove the check that prevent carp(4) advskew to be set to '0'. CARP devices are created with advskew set to '0' and once you set it to any other value in the valid range (0..254) you can't set it back to zero. The code in question is also used to prevent that zeroed values overwrite the CARP defaults when a new CARP device is created. Since advskew already defaults to '0' for newly created devices and the new value is guaranteed to be within the valid range, it is safe to overwrite it here. PR: 194672 Reported by: cmb@pfsense.org In collaboration with: garga Tested by: garga MFC after: 2 weeks Changes: head/sys/netinet/ip_carp.c A commit references this bug: Author: loos Date: Mon Feb 2 11:42:36 UTC 2015 New revision: 278075 URL: https://svnweb.freebsd.org/changeset/base/278075 Log: MFC r276751: Remove the check that prevent carp(4) advskew to be set to '0'. CARP devices are created with advskew set to '0' and once you set it to any other value in the valid range (0..254) you can't set it back to zero. The code in question is also used to prevent that zeroed values overwrite the CARP defaults when a new CARP device is created. Since advskew already defaults to '0' for newly created devices and the new value is guaranteed to be within the valid range, it is safe to overwrite it here. PR: 194672 Reported by: cmb@pfsense.org Changes: _U stable/10/ stable/10/sys/netinet/ip_carp.c The fix was committed to -head and 10-stable. Thanks! |