Skip to content

Commit 5558395

Browse files
authored
Merge pull request #54 from kocmo/cgroup-fix
Fix for the regular expression for parsing MatchCGroup
2 parents 209fee8 + 2d3d013 commit 5558395

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

iptables/match.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1376,10 +1376,12 @@ func (mCG *MatchCGroup) LongArgs() []string {
13761376
}
13771377

13781378
func (mCG *MatchCGroup) Parse(main []byte) (int, bool) {
1379+
// For cgroup2 paths, must correctly process params like "cgroup ! /system.slice/systemd-journald.service MARK set 0xdeadbeef"
1380+
//
13791381
// 1. "^cgroup"
1380-
// 2. "( (! )?([ -~]+))?" #1 #2 #3
1382+
// 2. "( (! )?(/[^\s]+))?" #1 #2 #3
13811383
// 3. "( (! )?([0-9]+))?" #4 #5 #6
1382-
pattern := `^cgroup( (! )?([ -~]+))?( (! )?([0-9]+))? *`
1384+
pattern := `^cgroup( (! )?(/[^\s]+))?( (! )?([0-9]+))? *`
13831385
reg := regexp.MustCompile(pattern)
13841386
matches := reg.FindSubmatch(main)
13851387
if len(matches) != 7 {

0 commit comments

Comments
 (0)