libnet/iptables: deprecate type IPV#49093
Merged
thaJeztah merged 1 commit intomoby:masterfrom Dec 16, 2024
Merged
Conversation
thaJeztah
reviewed
Dec 14, 2024
Comment on lines
-15
to
-24
| // IPV defines the table string | ||
| type IPV string | ||
|
|
||
| const ( | ||
| // Iptables point ipv4 table | ||
| Iptables IPV = "ipv4" | ||
| // IP6Tables point to ipv6 table | ||
| IP6Tables IPV = "ipv6" | ||
| ) | ||
|
|
Member
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
)
thaJeztah
reviewed
Dec 14, 2024
Comment on lines
-438
to
-442
| // select correct IP version for firewalld | ||
| ipv := Iptables | ||
| if iptable.ipVersion == IPv6 { | ||
| ipv = IP6Tables | ||
| } |
Member
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?)
Member
Author
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.
Member
|
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 <albinker@gmail.com>
e3c8bd3 to
27deff4
Compare
This was referenced Dec 17, 2024
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
- 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