ip addr parser can assert and fail for some IPv6 addresses
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MAAS |
Fix Released
|
Critical
|
LaMont Jones |
Bug Description
Example:
inet6 2601:282:
The parser currently expects everything after an IPv6 address to be in <key> <value> pair format.
Unfortunately, sometimes values which do not match this format can be found in this line. (for example, the word "dynamic" above, with no corresponding value.
For IPv4, the interface name (and alias) is often the last thing on this line, so there is already a special case for this.
Without knowing how "ip addr" outputs this line in all cases, it seems as though the possible fixes are:
- Pass this line though to the data structure without attempting to parse it
- Always truncate "remainder" values if the line is in the format <key> <value> <something-else>
- Add special cases for specific keywords we have seen, such as "dynamic" (if we do this, we should inspect the source to ensure good coverage. but this solution has the disadvantage of requiring maintenance if the output changes in the future.)
Related branches
- Mike Pontillo (community): Approve
- Gavin Panella (community): Needs Information
-
Diff: 46 lines (+17/-3)2 files modifiedsrc/provisioningserver/utils/ipaddr.py (+9/-2)
src/provisioningserver/utils/tests/test_ipaddr.py (+8/-1)
- Andres Rodriguez (community): Approve
-
Diff: 93 lines (+33/-12)2 files modifiedsrc/provisioningserver/utils/ipaddr.py (+7/-6)
src/provisioningserver/utils/tests/test_ipaddr.py (+26/-6)
Changed in maas: | |
status: | Triaged → Fix Committed |
Changed in maas: | |
status: | Fix Committed → Fix Released |
looking at the ip addr output spec, it would seem that other than "scope $SCOPE", everything on that line is of the form "flag".