|
@@ -681,7 +681,7 @@ func NetworkChangeName(iface *net.Interface, newName string) error {
|
|
|
|
|
|
// Add a new VETH pair link on the host
|
|
// Add a new VETH pair link on the host
|
|
// This is identical to running: ip link add name $name type veth peer name $peername
|
|
// This is identical to running: ip link add name $name type veth peer name $peername
|
|
-func NetworkCreateVethPair(name1, name2 string) error {
|
|
|
|
|
|
+func NetworkCreateVethPair(name1, name2 string, txQueueLen int) error {
|
|
s, err := getNetlinkSocket()
|
|
s, err := getNetlinkSocket()
|
|
if err != nil {
|
|
if err != nil {
|
|
return err
|
|
return err
|
|
@@ -696,6 +696,11 @@ func NetworkCreateVethPair(name1, name2 string) error {
|
|
nameData := newRtAttr(syscall.IFLA_IFNAME, zeroTerminated(name1))
|
|
nameData := newRtAttr(syscall.IFLA_IFNAME, zeroTerminated(name1))
|
|
wb.AddData(nameData)
|
|
wb.AddData(nameData)
|
|
|
|
|
|
|
|
+ txqLen := make([]byte, 4)
|
|
|
|
+ native.PutUint32(txqLen, uint32(txQueueLen))
|
|
|
|
+ txqData := newRtAttr(syscall.IFLA_TXQLEN, txqLen)
|
|
|
|
+ wb.AddData(txqData)
|
|
|
|
+
|
|
nest1 := newRtAttr(syscall.IFLA_LINKINFO, nil)
|
|
nest1 := newRtAttr(syscall.IFLA_LINKINFO, nil)
|
|
newRtAttrChild(nest1, IFLA_INFO_KIND, zeroTerminated("veth"))
|
|
newRtAttrChild(nest1, IFLA_INFO_KIND, zeroTerminated("veth"))
|
|
nest2 := newRtAttrChild(nest1, IFLA_INFO_DATA, nil)
|
|
nest2 := newRtAttrChild(nest1, IFLA_INFO_DATA, nil)
|
|
@@ -704,6 +709,10 @@ func NetworkCreateVethPair(name1, name2 string) error {
|
|
newIfInfomsgChild(nest3, syscall.AF_UNSPEC)
|
|
newIfInfomsgChild(nest3, syscall.AF_UNSPEC)
|
|
newRtAttrChild(nest3, syscall.IFLA_IFNAME, zeroTerminated(name2))
|
|
newRtAttrChild(nest3, syscall.IFLA_IFNAME, zeroTerminated(name2))
|
|
|
|
|
|
|
|
+ txqLen2 := make([]byte, 4)
|
|
|
|
+ native.PutUint32(txqLen2, uint32(txQueueLen))
|
|
|
|
+ newRtAttrChild(nest3, syscall.IFLA_TXQLEN, txqLen2)
|
|
|
|
+
|
|
wb.AddData(nest1)
|
|
wb.AddData(nest1)
|
|
|
|
|
|
if err := s.Send(wb); err != nil {
|
|
if err := s.Send(wb); err != nil {
|