summaryrefslogtreecommitdiff
path: root/pkg/libcontainer/network/loopback.go
blob: 6215061dc2dd25ef7c409fcf162a72161810e837 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package network

import (
	"fmt"
	"github.com/dotcloud/docker/pkg/libcontainer"
)

// Loopback is a network strategy that provides a basic loopback device
type Loopback struct {
}

func (l *Loopback) Create(n *libcontainer.Network, nspid int, context libcontainer.Context) error {
	return nil
}

func (l *Loopback) Initialize(config *libcontainer.Network, context libcontainer.Context) error {
	if err := SetMtu("lo", config.Mtu); err != nil {
		return fmt.Errorf("set lo mtu to %d %s", config.Mtu, err)
	}
	if err := InterfaceUp("lo"); err != nil {
		return fmt.Errorf("lo up %s", err)
	}
	return nil
}