-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade to ifupdown2 3.0.0 with a patch to fix using broadcast addresses
In version 3.0.0, If a broadcast address is specified in /etc/network/interfaces, then when ifup is run, it will fail with an error saying `'str' object has no attribute 'packed'`. This appears to be because it expects all attributes for an interface to be "packable" into a compact binary representation. However, it doesn't actually convert the broadcast address into an IPNetwork object (other addresses are handled). Therefore, convert the broadcast address it reads in from a str to an IPNetwork object. Also explicitly specify the scope of the loopback address in /etc/network/interfaces as host scope. Otherwise, it will get added as global scope by default. As part of this, use JSON to parse ip's output instead of text, for robustness. Signed-off-by: Saikrishna Arcot <[email protected]>
- Loading branch information
1 parent
868982c
commit 8941a17
Showing
11 changed files
with
53 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/ifupdown2/patch/0001-fix-broadcast-addr-encoding.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
Fix reading and using broadcast address | ||
|
||
When reading the broadcast address, convert it to an IPNetwork object, | ||
so that it can be encoded/packed later. | ||
|
||
From: Saikrishna Arcot <[email protected]> | ||
--- | ||
ifupdown2/addons/address.py | 6 +++++- | ||
1 file changed, 5 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/ifupdown2/addons/address.py b/ifupdown2/addons/address.py | ||
index 8b99b25..2ca41fc 100644 | ||
--- a/ifupdown2/addons/address.py | ||
+++ b/ifupdown2/addons/address.py | ||
@@ -441,11 +441,15 @@ class address(Addon, moduleBase): | ||
else: | ||
addr_obj = ipnetwork.IPNetwork(addr) | ||
|
||
- for attr_name in ("broadcast", "scope", "preferred-lifetime"): | ||
+ for attr_name in ("scope", "preferred-lifetime"): | ||
attr_value = ifaceobj.get_attr_value_n(attr_name, index) | ||
if attr_value: | ||
addr_attributes[attr_name] = attr_value | ||
|
||
+ broadcast = ifaceobj.get_attr_value_n("broadcast", index) | ||
+ if broadcast: | ||
+ addr_attributes["broadcast"] = ipnetwork.IPNetwork(broadcast) | ||
+ | ||
pointopoint = ifaceobj.get_attr_value_n("pointopoint", index) | ||
try: | ||
if pointopoint: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0001-fix-broadcast-addr-encoding.patch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters