github.com/vishvananda/netlink@v1.3.0/nl/link_linux.go (about)

     1  package nl
     2  
     3  import (
     4  	"bytes"
     5  	"encoding/binary"
     6  	"fmt"
     7  	"unsafe"
     8  )
     9  
    10  const (
    11  	DEFAULT_CHANGE = 0xFFFFFFFF
    12  )
    13  
    14  const (
    15  	IFLA_INFO_UNSPEC = iota
    16  	IFLA_INFO_KIND
    17  	IFLA_INFO_DATA
    18  	IFLA_INFO_XSTATS
    19  	IFLA_INFO_SLAVE_KIND
    20  	IFLA_INFO_SLAVE_DATA
    21  	IFLA_INFO_MAX = IFLA_INFO_SLAVE_DATA
    22  )
    23  
    24  const (
    25  	IFLA_VLAN_UNSPEC = iota
    26  	IFLA_VLAN_ID
    27  	IFLA_VLAN_FLAGS
    28  	IFLA_VLAN_EGRESS_QOS
    29  	IFLA_VLAN_INGRESS_QOS
    30  	IFLA_VLAN_PROTOCOL
    31  	IFLA_VLAN_MAX = IFLA_VLAN_PROTOCOL
    32  )
    33  
    34  const (
    35  	IFLA_NETKIT_UNSPEC = iota
    36  	IFLA_NETKIT_PEER_INFO
    37  	IFLA_NETKIT_PRIMARY
    38  	IFLA_NETKIT_POLICY
    39  	IFLA_NETKIT_PEER_POLICY
    40  	IFLA_NETKIT_MODE
    41  	IFLA_NETKIT_MAX = IFLA_NETKIT_MODE
    42  )
    43  
    44  const (
    45  	VETH_INFO_UNSPEC = iota
    46  	VETH_INFO_PEER
    47  	VETH_INFO_MAX = VETH_INFO_PEER
    48  )
    49  
    50  const (
    51  	IFLA_VXLAN_UNSPEC = iota
    52  	IFLA_VXLAN_ID
    53  	IFLA_VXLAN_GROUP
    54  	IFLA_VXLAN_LINK
    55  	IFLA_VXLAN_LOCAL
    56  	IFLA_VXLAN_TTL
    57  	IFLA_VXLAN_TOS
    58  	IFLA_VXLAN_LEARNING
    59  	IFLA_VXLAN_AGEING
    60  	IFLA_VXLAN_LIMIT
    61  	IFLA_VXLAN_PORT_RANGE
    62  	IFLA_VXLAN_PROXY
    63  	IFLA_VXLAN_RSC
    64  	IFLA_VXLAN_L2MISS
    65  	IFLA_VXLAN_L3MISS
    66  	IFLA_VXLAN_PORT
    67  	IFLA_VXLAN_GROUP6
    68  	IFLA_VXLAN_LOCAL6
    69  	IFLA_VXLAN_UDP_CSUM
    70  	IFLA_VXLAN_UDP_ZERO_CSUM6_TX
    71  	IFLA_VXLAN_UDP_ZERO_CSUM6_RX
    72  	IFLA_VXLAN_REMCSUM_TX
    73  	IFLA_VXLAN_REMCSUM_RX
    74  	IFLA_VXLAN_GBP
    75  	IFLA_VXLAN_REMCSUM_NOPARTIAL
    76  	IFLA_VXLAN_FLOWBASED
    77  	IFLA_VXLAN_MAX = IFLA_VXLAN_FLOWBASED
    78  )
    79  
    80  const (
    81  	BRIDGE_MODE_UNSPEC = iota
    82  	BRIDGE_MODE_HAIRPIN
    83  )
    84  
    85  const (
    86  	IFLA_BRPORT_UNSPEC = iota
    87  	IFLA_BRPORT_STATE
    88  	IFLA_BRPORT_PRIORITY
    89  	IFLA_BRPORT_COST
    90  	IFLA_BRPORT_MODE
    91  	IFLA_BRPORT_GUARD
    92  	IFLA_BRPORT_PROTECT
    93  	IFLA_BRPORT_FAST_LEAVE
    94  	IFLA_BRPORT_LEARNING
    95  	IFLA_BRPORT_UNICAST_FLOOD
    96  	IFLA_BRPORT_PROXYARP
    97  	IFLA_BRPORT_LEARNING_SYNC
    98  	IFLA_BRPORT_PROXYARP_WIFI
    99  	IFLA_BRPORT_ROOT_ID
   100  	IFLA_BRPORT_BRIDGE_ID
   101  	IFLA_BRPORT_DESIGNATED_PORT
   102  	IFLA_BRPORT_DESIGNATED_COST
   103  	IFLA_BRPORT_ID
   104  	IFLA_BRPORT_NO
   105  	IFLA_BRPORT_TOPOLOGY_CHANGE_ACK
   106  	IFLA_BRPORT_CONFIG_PENDING
   107  	IFLA_BRPORT_MESSAGE_AGE_TIMER
   108  	IFLA_BRPORT_FORWARD_DELAY_TIMER
   109  	IFLA_BRPORT_HOLD_TIMER
   110  	IFLA_BRPORT_FLUSH
   111  	IFLA_BRPORT_MULTICAST_ROUTER
   112  	IFLA_BRPORT_PAD
   113  	IFLA_BRPORT_MCAST_FLOOD
   114  	IFLA_BRPORT_MCAST_TO_UCAST
   115  	IFLA_BRPORT_VLAN_TUNNEL
   116  	IFLA_BRPORT_BCAST_FLOOD
   117  	IFLA_BRPORT_GROUP_FWD_MASK
   118  	IFLA_BRPORT_NEIGH_SUPPRESS
   119  	IFLA_BRPORT_ISOLATED
   120  	IFLA_BRPORT_BACKUP_PORT
   121  	IFLA_BRPORT_MRP_RING_OPEN
   122  	IFLA_BRPORT_MRP_IN_OPEN
   123  	IFLA_BRPORT_MCAST_EHT_HOSTS_LIMIT
   124  	IFLA_BRPORT_MCAST_EHT_HOSTS_CNT
   125  	IFLA_BRPORT_LOCKED
   126  	IFLA_BRPORT_MAB
   127  	IFLA_BRPORT_MCAST_N_GROUPS
   128  	IFLA_BRPORT_MCAST_MAX_GROUPS
   129  	IFLA_BRPORT_MAX = IFLA_BRPORT_MCAST_MAX_GROUPS
   130  )
   131  
   132  const (
   133  	IFLA_IPVLAN_UNSPEC = iota
   134  	IFLA_IPVLAN_MODE
   135  	IFLA_IPVLAN_FLAG
   136  	IFLA_IPVLAN_MAX = IFLA_IPVLAN_FLAG
   137  )
   138  
   139  const (
   140  	IFLA_MACVLAN_UNSPEC = iota
   141  	IFLA_MACVLAN_MODE
   142  	IFLA_MACVLAN_FLAGS
   143  	IFLA_MACVLAN_MACADDR_MODE
   144  	IFLA_MACVLAN_MACADDR
   145  	IFLA_MACVLAN_MACADDR_DATA
   146  	IFLA_MACVLAN_MACADDR_COUNT
   147  	IFLA_MACVLAN_BC_QUEUE_LEN
   148  	IFLA_MACVLAN_BC_QUEUE_LEN_USED
   149  	IFLA_MACVLAN_MAX = IFLA_MACVLAN_BC_QUEUE_LEN_USED
   150  )
   151  
   152  const (
   153  	MACVLAN_MODE_PRIVATE  = 1
   154  	MACVLAN_MODE_VEPA     = 2
   155  	MACVLAN_MODE_BRIDGE   = 4
   156  	MACVLAN_MODE_PASSTHRU = 8
   157  	MACVLAN_MODE_SOURCE   = 16
   158  )
   159  
   160  const (
   161  	MACVLAN_MACADDR_ADD = iota
   162  	MACVLAN_MACADDR_DEL
   163  	MACVLAN_MACADDR_FLUSH
   164  	MACVLAN_MACADDR_SET
   165  )
   166  
   167  const (
   168  	IFLA_BOND_UNSPEC = iota
   169  	IFLA_BOND_MODE
   170  	IFLA_BOND_ACTIVE_SLAVE
   171  	IFLA_BOND_MIIMON
   172  	IFLA_BOND_UPDELAY
   173  	IFLA_BOND_DOWNDELAY
   174  	IFLA_BOND_USE_CARRIER
   175  	IFLA_BOND_ARP_INTERVAL
   176  	IFLA_BOND_ARP_IP_TARGET
   177  	IFLA_BOND_ARP_VALIDATE
   178  	IFLA_BOND_ARP_ALL_TARGETS
   179  	IFLA_BOND_PRIMARY
   180  	IFLA_BOND_PRIMARY_RESELECT
   181  	IFLA_BOND_FAIL_OVER_MAC
   182  	IFLA_BOND_XMIT_HASH_POLICY
   183  	IFLA_BOND_RESEND_IGMP
   184  	IFLA_BOND_NUM_PEER_NOTIF
   185  	IFLA_BOND_ALL_SLAVES_ACTIVE
   186  	IFLA_BOND_MIN_LINKS
   187  	IFLA_BOND_LP_INTERVAL
   188  	IFLA_BOND_PACKETS_PER_SLAVE
   189  	IFLA_BOND_AD_LACP_RATE
   190  	IFLA_BOND_AD_SELECT
   191  	IFLA_BOND_AD_INFO
   192  	IFLA_BOND_AD_ACTOR_SYS_PRIO
   193  	IFLA_BOND_AD_USER_PORT_KEY
   194  	IFLA_BOND_AD_ACTOR_SYSTEM
   195  	IFLA_BOND_TLB_DYNAMIC_LB
   196  )
   197  
   198  const (
   199  	IFLA_BOND_AD_INFO_UNSPEC = iota
   200  	IFLA_BOND_AD_INFO_AGGREGATOR
   201  	IFLA_BOND_AD_INFO_NUM_PORTS
   202  	IFLA_BOND_AD_INFO_ACTOR_KEY
   203  	IFLA_BOND_AD_INFO_PARTNER_KEY
   204  	IFLA_BOND_AD_INFO_PARTNER_MAC
   205  )
   206  
   207  const (
   208  	IFLA_BOND_SLAVE_UNSPEC = iota
   209  	IFLA_BOND_SLAVE_STATE
   210  	IFLA_BOND_SLAVE_MII_STATUS
   211  	IFLA_BOND_SLAVE_LINK_FAILURE_COUNT
   212  	IFLA_BOND_SLAVE_PERM_HWADDR
   213  	IFLA_BOND_SLAVE_QUEUE_ID
   214  	IFLA_BOND_SLAVE_AD_AGGREGATOR_ID
   215  	IFLA_BOND_SLAVE_AD_ACTOR_OPER_PORT_STATE
   216  	IFLA_BOND_SLAVE_AD_PARTNER_OPER_PORT_STATE
   217  )
   218  
   219  const (
   220  	IFLA_GENEVE_UNSPEC = iota
   221  	IFLA_GENEVE_ID     // vni
   222  	IFLA_GENEVE_REMOTE
   223  	IFLA_GENEVE_TTL
   224  	IFLA_GENEVE_TOS
   225  	IFLA_GENEVE_PORT // destination port
   226  	IFLA_GENEVE_COLLECT_METADATA
   227  	IFLA_GENEVE_REMOTE6
   228  	IFLA_GENEVE_UDP_CSUM
   229  	IFLA_GENEVE_UDP_ZERO_CSUM6_TX
   230  	IFLA_GENEVE_UDP_ZERO_CSUM6_RX
   231  	IFLA_GENEVE_LABEL
   232  	IFLA_GENEVE_TTL_INHERIT
   233  	IFLA_GENEVE_DF
   234  	IFLA_GENEVE_INNER_PROTO_INHERIT
   235  	IFLA_GENEVE_MAX = IFLA_GENEVE_INNER_PROTO_INHERIT
   236  )
   237  
   238  const (
   239  	IFLA_GRE_UNSPEC = iota
   240  	IFLA_GRE_LINK
   241  	IFLA_GRE_IFLAGS
   242  	IFLA_GRE_OFLAGS
   243  	IFLA_GRE_IKEY
   244  	IFLA_GRE_OKEY
   245  	IFLA_GRE_LOCAL
   246  	IFLA_GRE_REMOTE
   247  	IFLA_GRE_TTL
   248  	IFLA_GRE_TOS
   249  	IFLA_GRE_PMTUDISC
   250  	IFLA_GRE_ENCAP_LIMIT
   251  	IFLA_GRE_FLOWINFO
   252  	IFLA_GRE_FLAGS
   253  	IFLA_GRE_ENCAP_TYPE
   254  	IFLA_GRE_ENCAP_FLAGS
   255  	IFLA_GRE_ENCAP_SPORT
   256  	IFLA_GRE_ENCAP_DPORT
   257  	IFLA_GRE_COLLECT_METADATA
   258  	IFLA_GRE_MAX = IFLA_GRE_COLLECT_METADATA
   259  )
   260  
   261  const (
   262  	GRE_CSUM    = 0x8000
   263  	GRE_ROUTING = 0x4000
   264  	GRE_KEY     = 0x2000
   265  	GRE_SEQ     = 0x1000
   266  	GRE_STRICT  = 0x0800
   267  	GRE_REC     = 0x0700
   268  	GRE_FLAGS   = 0x00F8
   269  	GRE_VERSION = 0x0007
   270  )
   271  
   272  const (
   273  	IFLA_VF_INFO_UNSPEC = iota
   274  	IFLA_VF_INFO
   275  	IFLA_VF_INFO_MAX = IFLA_VF_INFO
   276  )
   277  
   278  const (
   279  	IFLA_VF_UNSPEC = iota
   280  	IFLA_VF_MAC    /* Hardware queue specific attributes */
   281  	IFLA_VF_VLAN
   282  	IFLA_VF_TX_RATE      /* Max TX Bandwidth Allocation */
   283  	IFLA_VF_SPOOFCHK     /* Spoof Checking on/off switch */
   284  	IFLA_VF_LINK_STATE   /* link state enable/disable/auto switch */
   285  	IFLA_VF_RATE         /* Min and Max TX Bandwidth Allocation */
   286  	IFLA_VF_RSS_QUERY_EN /* RSS Redirection Table and Hash Key query
   287  	 * on/off switch
   288  	 */
   289  	IFLA_VF_STATS        /* network device statistics */
   290  	IFLA_VF_TRUST        /* Trust state of VF */
   291  	IFLA_VF_IB_NODE_GUID /* VF Infiniband node GUID */
   292  	IFLA_VF_IB_PORT_GUID /* VF Infiniband port GUID */
   293  	IFLA_VF_VLAN_LIST    /* nested list of vlans, option for QinQ */
   294  
   295  	IFLA_VF_MAX = IFLA_VF_IB_PORT_GUID
   296  )
   297  
   298  const (
   299  	IFLA_VF_VLAN_INFO_UNSPEC = iota
   300  	IFLA_VF_VLAN_INFO        /* VLAN ID, QoS and VLAN protocol */
   301  	__IFLA_VF_VLAN_INFO_MAX
   302  )
   303  
   304  const (
   305  	IFLA_VF_LINK_STATE_AUTO    = iota /* link state of the uplink */
   306  	IFLA_VF_LINK_STATE_ENABLE         /* link always up */
   307  	IFLA_VF_LINK_STATE_DISABLE        /* link always down */
   308  	IFLA_VF_LINK_STATE_MAX     = IFLA_VF_LINK_STATE_DISABLE
   309  )
   310  
   311  const (
   312  	IFLA_VF_STATS_RX_PACKETS = iota
   313  	IFLA_VF_STATS_TX_PACKETS
   314  	IFLA_VF_STATS_RX_BYTES
   315  	IFLA_VF_STATS_TX_BYTES
   316  	IFLA_VF_STATS_BROADCAST
   317  	IFLA_VF_STATS_MULTICAST
   318  	IFLA_VF_STATS_RX_DROPPED
   319  	IFLA_VF_STATS_TX_DROPPED
   320  	IFLA_VF_STATS_MAX = IFLA_VF_STATS_TX_DROPPED
   321  )
   322  
   323  const (
   324  	SizeofVfMac        = 0x24
   325  	SizeofVfVlan       = 0x0c
   326  	SizeofVfVlanInfo   = 0x10
   327  	SizeofVfTxRate     = 0x08
   328  	SizeofVfRate       = 0x0c
   329  	SizeofVfSpoofchk   = 0x08
   330  	SizeofVfLinkState  = 0x08
   331  	SizeofVfRssQueryEn = 0x08
   332  	SizeofVfTrust      = 0x08
   333  	SizeofVfGUID       = 0x10
   334  )
   335  
   336  // struct ifla_vf_mac {
   337  //   __u32 vf;
   338  //   __u8 mac[32]; /* MAX_ADDR_LEN */
   339  // };
   340  
   341  type VfMac struct {
   342  	Vf  uint32
   343  	Mac [32]byte
   344  }
   345  
   346  func (msg *VfMac) Len() int {
   347  	return SizeofVfMac
   348  }
   349  
   350  func DeserializeVfMac(b []byte) *VfMac {
   351  	return (*VfMac)(unsafe.Pointer(&b[0:SizeofVfMac][0]))
   352  }
   353  
   354  func (msg *VfMac) Serialize() []byte {
   355  	return (*(*[SizeofVfMac]byte)(unsafe.Pointer(msg)))[:]
   356  }
   357  
   358  // struct ifla_vf_vlan {
   359  //   __u32 vf;
   360  //   __u32 vlan; /* 0 - 4095, 0 disables VLAN filter */
   361  //   __u32 qos;
   362  // };
   363  
   364  type VfVlan struct {
   365  	Vf   uint32
   366  	Vlan uint32
   367  	Qos  uint32
   368  }
   369  
   370  func (msg *VfVlan) Len() int {
   371  	return SizeofVfVlan
   372  }
   373  
   374  func DeserializeVfVlan(b []byte) *VfVlan {
   375  	return (*VfVlan)(unsafe.Pointer(&b[0:SizeofVfVlan][0]))
   376  }
   377  
   378  func (msg *VfVlan) Serialize() []byte {
   379  	return (*(*[SizeofVfVlan]byte)(unsafe.Pointer(msg)))[:]
   380  }
   381  
   382  func DeserializeVfVlanList(b []byte) ([]*VfVlanInfo, error) {
   383  	var vfVlanInfoList []*VfVlanInfo
   384  	attrs, err := ParseRouteAttr(b)
   385  	if err != nil {
   386  		return nil, err
   387  	}
   388  
   389  	for _, element := range attrs {
   390  		if element.Attr.Type == IFLA_VF_VLAN_INFO {
   391  			vfVlanInfoList = append(vfVlanInfoList, DeserializeVfVlanInfo(element.Value))
   392  		}
   393  	}
   394  
   395  	if len(vfVlanInfoList) == 0 {
   396  		return nil, fmt.Errorf("VF vlan list is defined but no vf vlan info elements were found")
   397  	}
   398  
   399  	return vfVlanInfoList, nil
   400  }
   401  
   402  // struct ifla_vf_vlan_info {
   403  //   __u32 vf;
   404  //   __u32 vlan; /* 0 - 4095, 0 disables VLAN filter */
   405  //   __u32 qos;
   406  //   __be16 vlan_proto; /* VLAN protocol either 802.1Q or 802.1ad */
   407  // };
   408  
   409  type VfVlanInfo struct {
   410  	VfVlan
   411  	VlanProto uint16
   412  }
   413  
   414  func DeserializeVfVlanInfo(b []byte) *VfVlanInfo {
   415  	return &VfVlanInfo{
   416  		*(*VfVlan)(unsafe.Pointer(&b[0:SizeofVfVlan][0])),
   417  		binary.BigEndian.Uint16(b[SizeofVfVlan:SizeofVfVlanInfo]),
   418  	}
   419  }
   420  
   421  func (msg *VfVlanInfo) Serialize() []byte {
   422  	return (*(*[SizeofVfVlanInfo]byte)(unsafe.Pointer(msg)))[:]
   423  }
   424  
   425  // struct ifla_vf_tx_rate {
   426  //   __u32 vf;
   427  //   __u32 rate; /* Max TX bandwidth in Mbps, 0 disables throttling */
   428  // };
   429  
   430  type VfTxRate struct {
   431  	Vf   uint32
   432  	Rate uint32
   433  }
   434  
   435  func (msg *VfTxRate) Len() int {
   436  	return SizeofVfTxRate
   437  }
   438  
   439  func DeserializeVfTxRate(b []byte) *VfTxRate {
   440  	return (*VfTxRate)(unsafe.Pointer(&b[0:SizeofVfTxRate][0]))
   441  }
   442  
   443  func (msg *VfTxRate) Serialize() []byte {
   444  	return (*(*[SizeofVfTxRate]byte)(unsafe.Pointer(msg)))[:]
   445  }
   446  
   447  //struct ifla_vf_stats {
   448  //	__u64 rx_packets;
   449  //	__u64 tx_packets;
   450  //	__u64 rx_bytes;
   451  //	__u64 tx_bytes;
   452  //	__u64 broadcast;
   453  //	__u64 multicast;
   454  //};
   455  
   456  type VfStats struct {
   457  	RxPackets uint64
   458  	TxPackets uint64
   459  	RxBytes   uint64
   460  	TxBytes   uint64
   461  	Multicast uint64
   462  	Broadcast uint64
   463  	RxDropped uint64
   464  	TxDropped uint64
   465  }
   466  
   467  func DeserializeVfStats(b []byte) VfStats {
   468  	var vfstat VfStats
   469  	stats, err := ParseRouteAttr(b)
   470  	if err != nil {
   471  		return vfstat
   472  	}
   473  	var valueVar uint64
   474  	for _, stat := range stats {
   475  		if err := binary.Read(bytes.NewBuffer(stat.Value), NativeEndian(), &valueVar); err != nil {
   476  			break
   477  		}
   478  		switch stat.Attr.Type {
   479  		case IFLA_VF_STATS_RX_PACKETS:
   480  			vfstat.RxPackets = valueVar
   481  		case IFLA_VF_STATS_TX_PACKETS:
   482  			vfstat.TxPackets = valueVar
   483  		case IFLA_VF_STATS_RX_BYTES:
   484  			vfstat.RxBytes = valueVar
   485  		case IFLA_VF_STATS_TX_BYTES:
   486  			vfstat.TxBytes = valueVar
   487  		case IFLA_VF_STATS_MULTICAST:
   488  			vfstat.Multicast = valueVar
   489  		case IFLA_VF_STATS_BROADCAST:
   490  			vfstat.Broadcast = valueVar
   491  		case IFLA_VF_STATS_RX_DROPPED:
   492  			vfstat.RxDropped = valueVar
   493  		case IFLA_VF_STATS_TX_DROPPED:
   494  			vfstat.TxDropped = valueVar
   495  		}
   496  	}
   497  	return vfstat
   498  }
   499  
   500  // struct ifla_vf_rate {
   501  //   __u32 vf;
   502  //   __u32 min_tx_rate; /* Min Bandwidth in Mbps */
   503  //   __u32 max_tx_rate; /* Max Bandwidth in Mbps */
   504  // };
   505  
   506  type VfRate struct {
   507  	Vf        uint32
   508  	MinTxRate uint32
   509  	MaxTxRate uint32
   510  }
   511  
   512  func (msg *VfRate) Len() int {
   513  	return SizeofVfRate
   514  }
   515  
   516  func DeserializeVfRate(b []byte) *VfRate {
   517  	return (*VfRate)(unsafe.Pointer(&b[0:SizeofVfRate][0]))
   518  }
   519  
   520  func (msg *VfRate) Serialize() []byte {
   521  	return (*(*[SizeofVfRate]byte)(unsafe.Pointer(msg)))[:]
   522  }
   523  
   524  // struct ifla_vf_spoofchk {
   525  //   __u32 vf;
   526  //   __u32 setting;
   527  // };
   528  
   529  type VfSpoofchk struct {
   530  	Vf      uint32
   531  	Setting uint32
   532  }
   533  
   534  func (msg *VfSpoofchk) Len() int {
   535  	return SizeofVfSpoofchk
   536  }
   537  
   538  func DeserializeVfSpoofchk(b []byte) *VfSpoofchk {
   539  	return (*VfSpoofchk)(unsafe.Pointer(&b[0:SizeofVfSpoofchk][0]))
   540  }
   541  
   542  func (msg *VfSpoofchk) Serialize() []byte {
   543  	return (*(*[SizeofVfSpoofchk]byte)(unsafe.Pointer(msg)))[:]
   544  }
   545  
   546  // struct ifla_vf_link_state {
   547  //   __u32 vf;
   548  //   __u32 link_state;
   549  // };
   550  
   551  type VfLinkState struct {
   552  	Vf        uint32
   553  	LinkState uint32
   554  }
   555  
   556  func (msg *VfLinkState) Len() int {
   557  	return SizeofVfLinkState
   558  }
   559  
   560  func DeserializeVfLinkState(b []byte) *VfLinkState {
   561  	return (*VfLinkState)(unsafe.Pointer(&b[0:SizeofVfLinkState][0]))
   562  }
   563  
   564  func (msg *VfLinkState) Serialize() []byte {
   565  	return (*(*[SizeofVfLinkState]byte)(unsafe.Pointer(msg)))[:]
   566  }
   567  
   568  // struct ifla_vf_rss_query_en {
   569  //   __u32 vf;
   570  //   __u32 setting;
   571  // };
   572  
   573  type VfRssQueryEn struct {
   574  	Vf      uint32
   575  	Setting uint32
   576  }
   577  
   578  func (msg *VfRssQueryEn) Len() int {
   579  	return SizeofVfRssQueryEn
   580  }
   581  
   582  func DeserializeVfRssQueryEn(b []byte) *VfRssQueryEn {
   583  	return (*VfRssQueryEn)(unsafe.Pointer(&b[0:SizeofVfRssQueryEn][0]))
   584  }
   585  
   586  func (msg *VfRssQueryEn) Serialize() []byte {
   587  	return (*(*[SizeofVfRssQueryEn]byte)(unsafe.Pointer(msg)))[:]
   588  }
   589  
   590  // struct ifla_vf_trust {
   591  //   __u32 vf;
   592  //   __u32 setting;
   593  // };
   594  
   595  type VfTrust struct {
   596  	Vf      uint32
   597  	Setting uint32
   598  }
   599  
   600  func (msg *VfTrust) Len() int {
   601  	return SizeofVfTrust
   602  }
   603  
   604  func DeserializeVfTrust(b []byte) *VfTrust {
   605  	return (*VfTrust)(unsafe.Pointer(&b[0:SizeofVfTrust][0]))
   606  }
   607  
   608  func (msg *VfTrust) Serialize() []byte {
   609  	return (*(*[SizeofVfTrust]byte)(unsafe.Pointer(msg)))[:]
   610  }
   611  
   612  // struct ifla_vf_guid {
   613  //   __u32 vf;
   614  //   __u32 rsvd;
   615  //   __u64 guid;
   616  // };
   617  
   618  type VfGUID struct {
   619  	Vf   uint32
   620  	Rsvd uint32
   621  	GUID uint64
   622  }
   623  
   624  func (msg *VfGUID) Len() int {
   625  	return SizeofVfGUID
   626  }
   627  
   628  func DeserializeVfGUID(b []byte) *VfGUID {
   629  	return (*VfGUID)(unsafe.Pointer(&b[0:SizeofVfGUID][0]))
   630  }
   631  
   632  func (msg *VfGUID) Serialize() []byte {
   633  	return (*(*[SizeofVfGUID]byte)(unsafe.Pointer(msg)))[:]
   634  }
   635  
   636  const (
   637  	XDP_FLAGS_UPDATE_IF_NOEXIST = 1 << iota
   638  	XDP_FLAGS_SKB_MODE
   639  	XDP_FLAGS_DRV_MODE
   640  	XDP_FLAGS_MASK = XDP_FLAGS_UPDATE_IF_NOEXIST | XDP_FLAGS_SKB_MODE | XDP_FLAGS_DRV_MODE
   641  )
   642  
   643  const (
   644  	IFLA_XDP_UNSPEC   = iota
   645  	IFLA_XDP_FD       /* fd of xdp program to attach, or -1 to remove */
   646  	IFLA_XDP_ATTACHED /* read-only bool indicating if prog is attached */
   647  	IFLA_XDP_FLAGS    /* xdp prog related flags */
   648  	IFLA_XDP_PROG_ID  /* xdp prog id */
   649  	IFLA_XDP_MAX      = IFLA_XDP_PROG_ID
   650  )
   651  
   652  // XDP program attach mode (used as dump value for IFLA_XDP_ATTACHED)
   653  const (
   654  	XDP_ATTACHED_NONE = iota
   655  	XDP_ATTACHED_DRV
   656  	XDP_ATTACHED_SKB
   657  	XDP_ATTACHED_HW
   658  )
   659  
   660  const (
   661  	IFLA_IPTUN_UNSPEC = iota
   662  	IFLA_IPTUN_LINK
   663  	IFLA_IPTUN_LOCAL
   664  	IFLA_IPTUN_REMOTE
   665  	IFLA_IPTUN_TTL
   666  	IFLA_IPTUN_TOS
   667  	IFLA_IPTUN_ENCAP_LIMIT
   668  	IFLA_IPTUN_FLOWINFO
   669  	IFLA_IPTUN_FLAGS
   670  	IFLA_IPTUN_PROTO
   671  	IFLA_IPTUN_PMTUDISC
   672  	IFLA_IPTUN_6RD_PREFIX
   673  	IFLA_IPTUN_6RD_RELAY_PREFIX
   674  	IFLA_IPTUN_6RD_PREFIXLEN
   675  	IFLA_IPTUN_6RD_RELAY_PREFIXLEN
   676  	IFLA_IPTUN_ENCAP_TYPE
   677  	IFLA_IPTUN_ENCAP_FLAGS
   678  	IFLA_IPTUN_ENCAP_SPORT
   679  	IFLA_IPTUN_ENCAP_DPORT
   680  	IFLA_IPTUN_COLLECT_METADATA
   681  	IFLA_IPTUN_MAX = IFLA_IPTUN_COLLECT_METADATA
   682  )
   683  
   684  const (
   685  	IFLA_VTI_UNSPEC = iota
   686  	IFLA_VTI_LINK
   687  	IFLA_VTI_IKEY
   688  	IFLA_VTI_OKEY
   689  	IFLA_VTI_LOCAL
   690  	IFLA_VTI_REMOTE
   691  	IFLA_VTI_MAX = IFLA_VTI_REMOTE
   692  )
   693  
   694  const (
   695  	IFLA_VRF_UNSPEC = iota
   696  	IFLA_VRF_TABLE
   697  )
   698  
   699  const (
   700  	IFLA_BR_UNSPEC = iota
   701  	IFLA_BR_FORWARD_DELAY
   702  	IFLA_BR_HELLO_TIME
   703  	IFLA_BR_MAX_AGE
   704  	IFLA_BR_AGEING_TIME
   705  	IFLA_BR_STP_STATE
   706  	IFLA_BR_PRIORITY
   707  	IFLA_BR_VLAN_FILTERING
   708  	IFLA_BR_VLAN_PROTOCOL
   709  	IFLA_BR_GROUP_FWD_MASK
   710  	IFLA_BR_ROOT_ID
   711  	IFLA_BR_BRIDGE_ID
   712  	IFLA_BR_ROOT_PORT
   713  	IFLA_BR_ROOT_PATH_COST
   714  	IFLA_BR_TOPOLOGY_CHANGE
   715  	IFLA_BR_TOPOLOGY_CHANGE_DETECTED
   716  	IFLA_BR_HELLO_TIMER
   717  	IFLA_BR_TCN_TIMER
   718  	IFLA_BR_TOPOLOGY_CHANGE_TIMER
   719  	IFLA_BR_GC_TIMER
   720  	IFLA_BR_GROUP_ADDR
   721  	IFLA_BR_FDB_FLUSH
   722  	IFLA_BR_MCAST_ROUTER
   723  	IFLA_BR_MCAST_SNOOPING
   724  	IFLA_BR_MCAST_QUERY_USE_IFADDR
   725  	IFLA_BR_MCAST_QUERIER
   726  	IFLA_BR_MCAST_HASH_ELASTICITY
   727  	IFLA_BR_MCAST_HASH_MAX
   728  	IFLA_BR_MCAST_LAST_MEMBER_CNT
   729  	IFLA_BR_MCAST_STARTUP_QUERY_CNT
   730  	IFLA_BR_MCAST_LAST_MEMBER_INTVL
   731  	IFLA_BR_MCAST_MEMBERSHIP_INTVL
   732  	IFLA_BR_MCAST_QUERIER_INTVL
   733  	IFLA_BR_MCAST_QUERY_INTVL
   734  	IFLA_BR_MCAST_QUERY_RESPONSE_INTVL
   735  	IFLA_BR_MCAST_STARTUP_QUERY_INTVL
   736  	IFLA_BR_NF_CALL_IPTABLES
   737  	IFLA_BR_NF_CALL_IP6TABLES
   738  	IFLA_BR_NF_CALL_ARPTABLES
   739  	IFLA_BR_VLAN_DEFAULT_PVID
   740  	IFLA_BR_PAD
   741  	IFLA_BR_VLAN_STATS_ENABLED
   742  	IFLA_BR_MCAST_STATS_ENABLED
   743  	IFLA_BR_MCAST_IGMP_VERSION
   744  	IFLA_BR_MCAST_MLD_VERSION
   745  	IFLA_BR_MAX = IFLA_BR_MCAST_MLD_VERSION
   746  )
   747  
   748  const (
   749  	IFLA_GTP_UNSPEC = iota
   750  	IFLA_GTP_FD0
   751  	IFLA_GTP_FD1
   752  	IFLA_GTP_PDP_HASHSIZE
   753  	IFLA_GTP_ROLE
   754  )
   755  
   756  const (
   757  	GTP_ROLE_GGSN = iota
   758  	GTP_ROLE_SGSN
   759  )
   760  
   761  const (
   762  	IFLA_XFRM_UNSPEC = iota
   763  	IFLA_XFRM_LINK
   764  	IFLA_XFRM_IF_ID
   765  
   766  	IFLA_XFRM_MAX = iota - 1
   767  )
   768  
   769  const (
   770  	IFLA_TUN_UNSPEC = iota
   771  	IFLA_TUN_OWNER
   772  	IFLA_TUN_GROUP
   773  	IFLA_TUN_TYPE
   774  	IFLA_TUN_PI
   775  	IFLA_TUN_VNET_HDR
   776  	IFLA_TUN_PERSIST
   777  	IFLA_TUN_MULTI_QUEUE
   778  	IFLA_TUN_NUM_QUEUES
   779  	IFLA_TUN_NUM_DISABLED_QUEUES
   780  	IFLA_TUN_MAX = IFLA_TUN_NUM_DISABLED_QUEUES
   781  )
   782  
   783  const (
   784  	IFLA_IPOIB_UNSPEC = iota
   785  	IFLA_IPOIB_PKEY
   786  	IFLA_IPOIB_MODE
   787  	IFLA_IPOIB_UMCAST
   788  	IFLA_IPOIB_MAX = IFLA_IPOIB_UMCAST
   789  )
   790  
   791  const (
   792  	IFLA_CAN_UNSPEC = iota
   793  	IFLA_CAN_BITTIMING
   794  	IFLA_CAN_BITTIMING_CONST
   795  	IFLA_CAN_CLOCK
   796  	IFLA_CAN_STATE
   797  	IFLA_CAN_CTRLMODE
   798  	IFLA_CAN_RESTART_MS
   799  	IFLA_CAN_RESTART
   800  	IFLA_CAN_BERR_COUNTER
   801  	IFLA_CAN_DATA_BITTIMING
   802  	IFLA_CAN_DATA_BITTIMING_CONST
   803  	IFLA_CAN_TERMINATION
   804  	IFLA_CAN_TERMINATION_CONST
   805  	IFLA_CAN_BITRATE_CONST
   806  	IFLA_CAN_DATA_BITRATE_CONST
   807  	IFLA_CAN_BITRATE_MAX
   808  	IFLA_CAN_MAX = IFLA_CAN_BITRATE_MAX
   809  )
   810  
   811  const (
   812  	IFLA_BAREUDP_UNSPEC = iota
   813  	IFLA_BAREUDP_PORT
   814  	IFLA_BAREUDP_ETHERTYPE
   815  	IFLA_BAREUDP_SRCPORT_MIN
   816  	IFLA_BAREUDP_MULTIPROTO_MODE
   817  	IFLA_BAREUDP_MAX = IFLA_BAREUDP_MULTIPROTO_MODE
   818  )