Exemple #1
0
func NetReconfigure(stn *SandboxNetwork, htn *HostNetwork, childPid int, log *logging.Logger) error {
	if os.Getpid() == 1 {
		panic(errors.New("Cannot use NetReconfigure from child."))
	}
	tenus.DeleteLink(stn.VethHost)
	if err := NetInit(stn, htn, log); err != nil {
		return err
	}
	return NetAttach(stn, htn, childPid)
}
Exemple #2
0
func (stn *SandboxNetwork) Cleanup(log *logging.Logger) {
	if os.Getpid() == 1 {
		panic(errors.New("Cannot use Cleanup from child."))
	}

	if _, err := net.InterfaceByName(stn.VethHost); err != nil {
		log.Info("No veth found to cleanup")
		return
	}

	tenus.DeleteLink(stn.VethHost)
}