netlink/netlink_linux.go
func NetworkLinkUp(iface *net.Interface) error {
	s, err := getNetlinkSocket()
	if err != nil {
		return err
	}
	defer s.Close()

	wb := newNetlinkRequest(syscall.RTM_NEWLINK, syscall.NLM_F_ACK)

	msg := newIfInfomsg(syscall.AF_UNSPEC)
	msg.Index = int32(iface.Index)
	msg.Flags = syscall.IFF_UP
	msg.Change = syscall.IFF_UP
	wb.AddData(msg)

	if err := s.Send(wb); err != nil {
		return err
	}

	return s.HandleAck(wb.Seq)
}
func NetworkLinkUp(iface *net.Interface) error {
	s, err := getNetlinkSocket()
	if err != nil {
		return err
	}
	defer s.Close()

	wb := newNetlinkRequest(syscall.RTM_NEWLINK, syscall.NLM_F_ACK)

	msg := newIfInfomsg(syscall.AF_UNSPEC)
	msg.Index = int32(iface.Index)
	msg.Flags = syscall.IFF_UP
	msg.Change = syscall.IFF_UP
	wb.AddData(msg)

	if err := s.Send(wb); err != nil {
		return err
	}

	return s.HandleAck(wb.Seq)
}
func NetworkLinkUp ( iface * net . Interface ) error { s , err := getNetlinkSocket ( ) if err != nil { return err } defer s . Close ( ) wb := newNetlinkRequest ( syscall . RTM_NEWLINK , syscall . NLM_F_ACK ) msg := newIfInfomsg ( syscall . AF_UNSPEC ) msg . Index = int32 ( iface . Index ) msg . Flags = syscall . IFF_UP msg . Change = syscall . IFF_UP wb . AddData ( msg ) if err := s . Send ( wb ) ; err != nil { return err } return s . HandleAck ( wb . Seq ) }
// Bring up a particular network interface.
// This is identical to running: ip link set dev $name up
Bring up a particular network interface . This is identical to running : ip link set dev $name up