func CreateBridge(name string, setMacAddr bool) error {
	if len(name) >= IFNAMSIZ {
		return fmt.Errorf("Interface name %s too long", name)
	}

	s, err := getIfSocket()
	if err != nil {
		return err
	}
	defer syscall.Close(s)

	nameBytePtr, err := syscall.BytePtrFromString(name)
	if err != nil {
		return err
	}
	if _, _, err := syscall.Syscall(syscall.SYS_IOCTL, uintptr(s), SIOC_BRADDBR, uintptr(unsafe.Pointer(nameBytePtr))); err != 0 {
		return err
	}
	if setMacAddr {
		return SetMacAddress(name, randMacAddr())
	}
	return nil
}
func CreateBridge(name string, setMacAddr bool) error {
	if len(name) >= IFNAMSIZ {
		return fmt.Errorf("Interface name %s too long", name)
	}

	s, err := getIfSocket()
	if err != nil {
		return err
	}
	defer syscall.Close(s)

	nameBytePtr, err := syscall.BytePtrFromString(name)
	if err != nil {
		return err
	}
	if _, _, err := syscall.Syscall(syscall.SYS_IOCTL, uintptr(s), SIOC_BRADDBR, uintptr(unsafe.Pointer(nameBytePtr))); err != 0 {
		return err
	}
	if setMacAddr {
		return SetMacAddress(name, randMacAddr())
	}
	return nil
}
func CreateBridge ( name string , setMacAddr bool ) error { if len ( name ) >= IFNAMSIZ { return fmt . Errorf ( " " , name ) } s , err := getIfSocket ( ) if err != nil { return err } defer syscall . Close ( s ) nameBytePtr , err := syscall . BytePtrFromString ( name ) if err != nil { return err } if _ , _ , err := syscall . Syscall ( syscall . SYS_IOCTL , uintptr ( s ) , SIOC_BRADDBR , uintptr ( unsafe . Pointer ( nameBytePtr ) ) ) ; err != 0 { return err } if setMacAddr { return SetMacAddress ( name , randMacAddr ( ) ) } return nil }
// Create the actual bridge device.  This is more backward-compatible than
// netlink.NetworkLinkAdd and works on RHEL 6.
Create the actual bridge device . This is more backward - compatible than netlink . NetworkLinkAdd and works on RHEL 6 .