summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/socket
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/sentry/socket')
-rw-r--r--pkg/sentry/socket/netfilter/extensions.go18
-rw-r--r--pkg/sentry/socket/netfilter/tcp_matcher.go10
-rw-r--r--pkg/sentry/socket/netfilter/udp_matcher.go10
3 files changed, 19 insertions, 19 deletions
diff --git a/pkg/sentry/socket/netfilter/extensions.go b/pkg/sentry/socket/netfilter/extensions.go
index 5a4cac84c..b5fbb52e4 100644
--- a/pkg/sentry/socket/netfilter/extensions.go
+++ b/pkg/sentry/socket/netfilter/extensions.go
@@ -32,8 +32,8 @@ import (
// - Proto
// - Family
-// matchMarshaler knows how to (un)marshal the matcher named name().
-type matchMarshaler interface {
+// matchMaker knows how to (un)marshal the matcher named name().
+type matchMaker interface {
// name is the matcher name as stored in the xt_entry_match struct.
name() string
@@ -45,19 +45,19 @@ type matchMarshaler interface {
unmarshal(buf []byte, filter iptables.IPHeaderFilter) (iptables.Matcher, error)
}
-var matchMarshalers = map[string]matchMarshaler{}
+var matchMakers = map[string]matchMaker{}
-// registerMatchMarshaler should be called by match extensions to register them
+// registermatchMaker should be called by match extensions to register them
// with the netfilter package.
-func registerMatchMarshaler(mm matchMarshaler) {
- if _, ok := matchMarshalers[mm.name()]; ok {
+func registerMatchMaker(mm matchMaker) {
+ if _, ok := matchMakers[mm.name()]; ok {
panic(fmt.Sprintf("Multiple matches registered with name %q.", mm.name()))
}
- matchMarshalers[mm.name()] = mm
+ matchMakers[mm.name()] = mm
}
func marshalMatcher(matcher iptables.Matcher) []byte {
- matchMaker, ok := matchMarshalers[matcher.Name()]
+ matchMaker, ok := matchMakers[matcher.Name()]
if !ok {
panic(fmt.Errorf("Unknown matcher of type %T.", matcher))
}
@@ -85,7 +85,7 @@ func marshalEntryMatch(name string, data []byte) []byte {
}
func unmarshalMatcher(match linux.XTEntryMatch, filter iptables.IPHeaderFilter, buf []byte) (iptables.Matcher, error) {
- matchMaker, ok := matchMarshalers[match.Name.String()]
+ matchMaker, ok := matchMakers[match.Name.String()]
if !ok {
return nil, fmt.Errorf("unsupported matcher with name %q", match.Name.String())
}
diff --git a/pkg/sentry/socket/netfilter/tcp_matcher.go b/pkg/sentry/socket/netfilter/tcp_matcher.go
index 1646d22f7..6b2f4c31a 100644
--- a/pkg/sentry/socket/netfilter/tcp_matcher.go
+++ b/pkg/sentry/socket/netfilter/tcp_matcher.go
@@ -28,18 +28,18 @@ import (
const matcherNameTCP = "tcp"
func init() {
- registerMatchMarshaler(tcpMarshaler{})
+ registerMatchMaker(tcpMarshaler{})
}
-// tcpMarshaler implements matchMarshaler for TCP matching.
+// tcpMarshaler implements matchMaker for TCP matching.
type tcpMarshaler struct{}
-// name implements matchMarshaler.name.
+// name implements matchMaker.name.
func (tcpMarshaler) name() string {
return matcherNameTCP
}
-// marshal implements matchMarshaler.marshal.
+// marshal implements matchMaker.marshal.
func (tcpMarshaler) marshal(mr iptables.Matcher) []byte {
matcher := mr.(*TCPMatcher)
xttcp := linux.XTTCP{
@@ -52,7 +52,7 @@ func (tcpMarshaler) marshal(mr iptables.Matcher) []byte {
return marshalEntryMatch(matcherNameTCP, binary.Marshal(buf, usermem.ByteOrder, xttcp))
}
-// unmarshal implements matchMarshaler.unmarshal.
+// unmarshal implements matchMaker.unmarshal.
func (tcpMarshaler) unmarshal(buf []byte, filter iptables.IPHeaderFilter) (iptables.Matcher, error) {
if len(buf) < linux.SizeOfXTTCP {
return nil, fmt.Errorf("buf has insufficient size for TCP match: %d", len(buf))
diff --git a/pkg/sentry/socket/netfilter/udp_matcher.go b/pkg/sentry/socket/netfilter/udp_matcher.go
index b6e95bbc5..86aa11696 100644
--- a/pkg/sentry/socket/netfilter/udp_matcher.go
+++ b/pkg/sentry/socket/netfilter/udp_matcher.go
@@ -28,18 +28,18 @@ import (
const matcherNameUDP = "udp"
func init() {
- registerMatchMarshaler(udpMarshaler{})
+ registerMatchMaker(udpMarshaler{})
}
-// udpMarshaler implements matchMarshaler for UDP matching.
+// udpMarshaler implements matchMaker for UDP matching.
type udpMarshaler struct{}
-// name implements matchMarshaler.name.
+// name implements matchMaker.name.
func (udpMarshaler) name() string {
return matcherNameUDP
}
-// marshal implements matchMarshaler.marshal.
+// marshal implements matchMaker.marshal.
func (udpMarshaler) marshal(mr iptables.Matcher) []byte {
matcher := mr.(*UDPMatcher)
xtudp := linux.XTUDP{
@@ -52,7 +52,7 @@ func (udpMarshaler) marshal(mr iptables.Matcher) []byte {
return marshalEntryMatch(matcherNameUDP, binary.Marshal(buf, usermem.ByteOrder, xtudp))
}
-// unmarshal implements matchMarshaler.unmarshal.
+// unmarshal implements matchMaker.unmarshal.
func (udpMarshaler) unmarshal(buf []byte, filter iptables.IPHeaderFilter) (iptables.Matcher, error) {
if len(buf) < linux.SizeOfXTUDP {
return nil, fmt.Errorf("buf has insufficient size for UDP match: %d", len(buf))