libnet/iptables: deprecate type IPV#49093
Conversation
| // IPV defines the table string | ||
| type IPV string | ||
|
|
||
| const ( | ||
| // Iptables point ipv4 table | ||
| Iptables IPV = "ipv4" | ||
| // IP6Tables point to ipv6 table | ||
| IP6Tables IPV = "ipv6" | ||
| ) | ||
|
|
There was a problem hiding this comment.
Had a quick peek if I could find consumers of this. I did find one public import in https://github.com/KatharaFramework/NetworkPlugin/blob/8474abd27dcd2c31e90fbffa7d0561aa09549977/bridge/go-src/src/bridge_utils.go
If we want to be on the safe side, we could add aliases and deprecate those;
// IPV defines the table string
//
// Deprecated: use [IPVersion]
type IPV = IPVersion
const (
// Iptables point ipv4 table
//
// Deprecated: use [IPv4].
Iptables IPV = IPv4
// IP6Tables point to ipv6 table
//
// Deprecated: use [IPv6].
IP6Tables IPV = IPv6
)| // select correct IP version for firewalld | ||
| ipv := Iptables | ||
| if iptable.ipVersion == IPv6 { | ||
| ipv = IP6Tables | ||
| } |
There was a problem hiding this comment.
This logic looks to be to handle empty values / defaults; is that still needed? (i.e., is it guaranteed to be always set?)
There was a problem hiding this comment.
is it guaranteed to be always set?
AFAICT, yes it is. *IPTable is always instantiated through GetIptable which takes a version arg used to set the ipVersion field.
|
Failure is a flaky test, tracked in #48882 |
ba8c644 to
e3c8bd3
Compare
The iptables package has two different types to specify the IP version: IPVersion, used by iptables code, and IPV, used by firewalld code. Both are representing the ip version as a string. For iptables, the case doesn't matter because the string is never used as-is. However, for firewalld the case matters. Make the IPV type an alias of IPVersion, and deprecate it. Also change the case used in IPVersion strings to make IPV consts aliases of IPVersion consts. Signed-off-by: Albin Kerouanton <[email protected]>
e3c8bd3 to
27deff4
Compare
- What I did
The iptables package has two different types to specify the IP version: IPVersion, used by iptables code, and IPV, used by firewalld code. Both are representing the ip version as a string.
For iptables, the case doesn't matter because the string is never used as-is. However, for firewalld the case matters.
Make the IPV type an alias of IPVersion, and deprecate it. Also change the case used in IPVersion strings to make IPV consts aliases of IPVersion consts.
- How to verify it
Existing tests.
- Description for the changelog