No ability to discern IPv4 vs IPv6 rules through Python
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ufw |
Fix Released
|
Wishlist
|
Jamie Strandboge | ||
ufw (Ubuntu) |
Fix Released
|
Wishlist
|
Unassigned |
Bug Description
Version: ufw 0.36
Ubuntu Version: 20.04.3 LTS
There doesn't appear to be a Python method for accessing IPv4 and IPv6 rules in a distinguishable manner.
In the source code (root/src/
def get_rules(self):
'''Return list of all rules'''
return self.rules + self.rules6
The issue with this is that the returned list doesn't contain an indication of what IP version each item corresponds to and would display something like the following.
1 allow 22/tcp
2 allow 80
3 allow 443
4 allow 22/tcp
5 allow 80
6 allow 443
I don't currently see a way to distinguish between IPv4 and IPv6 rules other than accessing the lists in the backend object directly (but I don't think this is best practice). E.g.:
rules_ipv4 = backend.rules
rules_ipv6 = backend.rules6
One possible fix would be to add functions that return only the IPv4 or IPv6 rules. E.g.:
def get_rules_
'''Return list of all ipv4 rules'''
return self.rules
def get_rules_
'''Return list of all ipv6 rules'''
return self.rules6
I now realize that I may have submitted this bug to the wrong location. Should I submit this to the UFW source site (https:/ /launchpad. net/ufw) or is it alright to keep it here?