iptables: check revision numbers and support owner matcher v1

This change also replaces use of kernel.Task with a narrower type (IDMapper) in
preparation for a follow-up CL.

PiperOrigin-RevId: 578387814
This commit is contained in:
Kevin Krakauer
2023-10-31 21:17:26 -07:00
committed by gVisor bot
parent 5f75371657
commit 7f08016fb8
13 changed files with 329 additions and 42 deletions
+2 -2
View File
@@ -2311,7 +2311,7 @@ func setSockOptIPv6(t *kernel.Task, s socket.Socket, ep commonEndpoint, name int
return syserr.ErrNoDevice
}
// Stack must be a netstack stack.
return netfilter.SetEntries(t, stk.(*Stack).Stack, optVal, true)
return netfilter.SetEntries(t.Credentials().UserNamespace, stk.(*Stack).Stack, optVal, true)
case linux.IP6T_SO_SET_ADD_COUNTERS:
log.Infof("IP6T_SO_SET_ADD_COUNTERS is not supported")
@@ -2558,7 +2558,7 @@ func setSockOptIP(t *kernel.Task, s socket.Socket, ep commonEndpoint, name int,
return syserr.ErrNoDevice
}
// Stack must be a netstack stack.
return netfilter.SetEntries(t, stk.(*Stack).Stack, optVal, false)
return netfilter.SetEntries(t.Credentials().UserNamespace, stk.(*Stack).Stack, optVal, false)
case linux.IPT_SO_SET_ADD_COUNTERS:
log.Infof("IPT_SO_SET_ADD_COUNTERS is not supported")