Skip to content

Commit

Permalink
feat: support mask
Browse files Browse the repository at this point in the history
  • Loading branch information
mzz2017 committed Jan 8, 2024
1 parent 08afa4b commit 4bc2bb3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions control/control_plane_core.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func (c *controlPlaneCore) delQdisc(ifname string) error {

func (c *controlPlaneCore) addAcceptInputMark() error {
// TODO: Support more than firewalld.
return exec.Command("sh", "-c", "nft list table inet firewalld && nft 'insert rule inet firewalld filter_INPUT mark "+consts.TproxyMarkString+" accept'").Run()
return exec.Command("sh", "-c", "nft list table inet firewalld && nft 'insert rule inet firewalld filter_INPUT mark & "+consts.TproxyMarkString+" == "+consts.TproxyMarkString+" accept'").Run()
}

func (c *controlPlaneCore) delAcceptInputMark() error {
Expand All @@ -205,7 +205,7 @@ func (c *controlPlaneCore) delAcceptInputMark() error {
return err
}
lines := strings.Split(string(output), "\n")
regex := regexp.MustCompile("meta mark " + consts.TproxyMarkString + " accept # handle ([0-9]+)")
regex := regexp.MustCompile("meta mark & " + consts.TproxyMarkString + " == " + consts.TproxyMarkString + " accept # handle ([0-9]+)")
for _, line := range lines {
matches := regex.FindStringSubmatch(line)
if len(matches) >= 2 {
Expand Down

0 comments on commit 4bc2bb3

Please sign in to comment.