summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/socket/epsocket/stack.go
diff options
context:
space:
mode:
authorFabricio Voznika <fvoznika@google.com>2018-08-08 22:38:41 -0700
committerShentubot <shentubot@google.com>2018-08-08 22:39:58 -0700
commit4e171f7590284c1f4cedf90c92204873961b2e97 (patch)
tree98fef86694288ce258985ce7ff4772ee23566874 /pkg/sentry/socket/epsocket/stack.go
parent48b5b35b2bd46ecd043f95d5f470da71046af760 (diff)
Basic support for ip link/addr and ifconfig
Closes #94 PiperOrigin-RevId: 207997580 Change-Id: I19b426f1586b5ec12f8b0cd5884d5b401d334924
Diffstat (limited to 'pkg/sentry/socket/epsocket/stack.go')
-rw-r--r--pkg/sentry/socket/epsocket/stack.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/pkg/sentry/socket/epsocket/stack.go b/pkg/sentry/socket/epsocket/stack.go
index 12b4b4767..e4ed52fc8 100644
--- a/pkg/sentry/socket/epsocket/stack.go
+++ b/pkg/sentry/socket/epsocket/stack.go
@@ -41,10 +41,16 @@ func (s *Stack) SupportsIPv6() bool {
func (s *Stack) Interfaces() map[int32]inet.Interface {
is := make(map[int32]inet.Interface)
for id, ni := range s.Stack.NICInfo() {
+ var devType uint16
+ if ni.Flags.Loopback {
+ devType = linux.ARPHRD_LOOPBACK
+ }
is[int32(id)] = inet.Interface{
- Name: ni.Name,
- Addr: []byte(ni.LinkAddress),
- // TODO: Other fields.
+ Name: ni.Name,
+ Addr: []byte(ni.LinkAddress),
+ Flags: uint32(nicStateFlagsToLinux(ni.Flags)),
+ DeviceType: devType,
+ MTU: ni.MTU,
}
}
return is