libCNI upgraded to v1.1.2
This was all work done previously by @hswong3i in https://github.com/weaveworks/weave/pull/3939 All credit to them
This commit is contained in:
1 parent
2f49b8455a
commit
1bb1f02b1d
167 files changed
+15015
-3146
No files matched your search
+410
-1
@@ -1,6 +1,7 @@
|
||||
package nl
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
@@ -64,6 +65,15 @@ const (
|
||||
TCA_PRIO_MAX = TCA_PRIO_MQ
|
||||
)
|
||||
|
||||
const (
|
||||
TCA_STATS_UNSPEC = iota
|
||||
TCA_STATS_BASIC
|
||||
TCA_STATS_RATE_EST
|
||||
TCA_STATS_QUEUE
|
||||
TCA_STATS_APP
|
||||
TCA_STATS_MAX = TCA_STATS_APP
|
||||
)
|
||||
|
||||
const (
|
||||
SizeofTcMsg = 0x14
|
||||
SizeofTcActionMsg = 0x04
|
||||
@@ -79,8 +89,15 @@ const (
|
||||
SizeofTcU32Key = 0x10
|
||||
SizeofTcU32Sel = 0x10 // without keys
|
||||
SizeofTcGen = 0x14
|
||||
SizeofTcConnmark = SizeofTcGen + 0x04
|
||||
SizeofTcCsum = SizeofTcGen + 0x04
|
||||
SizeofTcMirred = SizeofTcGen + 0x08
|
||||
SizeofTcTunnelKey = SizeofTcGen + 0x04
|
||||
SizeofTcSkbEdit = SizeofTcGen
|
||||
SizeofTcPolice = 2*SizeofTcRateSpec + 0x20
|
||||
SizeofTcSfqQopt = 0x0b
|
||||
SizeofTcSfqRedStats = 0x18
|
||||
SizeofTcSfqQoptV1 = SizeofTcSfqQopt + SizeofTcSfqRedStats + 0x1c
|
||||
)
|
||||
|
||||
// struct tcmsg {
|
||||
@@ -412,6 +429,57 @@ func (x *TcHtbGlob) Serialize() []byte {
|
||||
return (*(*[SizeofTcHtbGlob]byte)(unsafe.Pointer(x)))[:]
|
||||
}
|
||||
|
||||
// HFSC
|
||||
|
||||
type Curve struct {
|
||||
m1 uint32
|
||||
d uint32
|
||||
m2 uint32
|
||||
}
|
||||
|
||||
type HfscCopt struct {
|
||||
Rsc Curve
|
||||
Fsc Curve
|
||||
Usc Curve
|
||||
}
|
||||
|
||||
func (c *Curve) Attrs() (uint32, uint32, uint32) {
|
||||
return c.m1, c.d, c.m2
|
||||
}
|
||||
|
||||
func (c *Curve) Set(m1 uint32, d uint32, m2 uint32) {
|
||||
c.m1 = m1
|
||||
c.d = d
|
||||
c.m2 = m2
|
||||
}
|
||||
|
||||
func DeserializeHfscCurve(b []byte) *Curve {
|
||||
return &Curve{
|
||||
m1: binary.LittleEndian.Uint32(b[0:4]),
|
||||
d: binary.LittleEndian.Uint32(b[4:8]),
|
||||
m2: binary.LittleEndian.Uint32(b[8:12]),
|
||||
}
|
||||
}
|
||||
|
||||
func SerializeHfscCurve(c *Curve) (b []byte) {
|
||||
t := make([]byte, binary.MaxVarintLen32)
|
||||
binary.LittleEndian.PutUint32(t, c.m1)
|
||||
b = append(b, t[:4]...)
|
||||
binary.LittleEndian.PutUint32(t, c.d)
|
||||
b = append(b, t[:4]...)
|
||||
binary.LittleEndian.PutUint32(t, c.m2)
|
||||
b = append(b, t[:4]...)
|
||||
return b
|
||||
}
|
||||
|
||||
type TcHfscOpt struct {
|
||||
Defcls uint16
|
||||
}
|
||||
|
||||
func (x *TcHfscOpt) Serialize() []byte {
|
||||
return (*(*[2]byte)(unsafe.Pointer(x)))[:]
|
||||
}
|
||||
|
||||
const (
|
||||
TCA_U32_UNSPEC = iota
|
||||
TCA_U32_CLASSID
|
||||
@@ -586,11 +654,77 @@ const (
|
||||
TCA_BPF_FD
|
||||
TCA_BPF_NAME
|
||||
TCA_BPF_FLAGS
|
||||
TCA_BPF_MAX = TCA_BPF_FLAGS
|
||||
TCA_BPF_FLAGS_GEN
|
||||
TCA_BPF_TAG
|
||||
TCA_BPF_ID
|
||||
TCA_BPF_MAX = TCA_BPF_ID
|
||||
)
|
||||
|
||||
type TcBpf TcGen
|
||||
|
||||
const (
|
||||
TCA_ACT_CONNMARK = 14
|
||||
)
|
||||
|
||||
const (
|
||||
TCA_CONNMARK_UNSPEC = iota
|
||||
TCA_CONNMARK_PARMS
|
||||
TCA_CONNMARK_TM
|
||||
TCA_CONNMARK_MAX = TCA_CONNMARK_TM
|
||||
)
|
||||
|
||||
// struct tc_connmark {
|
||||
// tc_gen;
|
||||
// __u16 zone;
|
||||
// };
|
||||
|
||||
type TcConnmark struct {
|
||||
TcGen
|
||||
Zone uint16
|
||||
}
|
||||
|
||||
func (msg *TcConnmark) Len() int {
|
||||
return SizeofTcConnmark
|
||||
}
|
||||
|
||||
func DeserializeTcConnmark(b []byte) *TcConnmark {
|
||||
return (*TcConnmark)(unsafe.Pointer(&b[0:SizeofTcConnmark][0]))
|
||||
}
|
||||
|
||||
func (x *TcConnmark) Serialize() []byte {
|
||||
return (*(*[SizeofTcConnmark]byte)(unsafe.Pointer(x)))[:]
|
||||
}
|
||||
|
||||
const (
|
||||
TCA_CSUM_UNSPEC = iota
|
||||
TCA_CSUM_PARMS
|
||||
TCA_CSUM_TM
|
||||
TCA_CSUM_PAD
|
||||
TCA_CSUM_MAX = TCA_CSUM_PAD
|
||||
)
|
||||
|
||||
// struct tc_csum {
|
||||
// tc_gen;
|
||||
// __u32 update_flags;
|
||||
// }
|
||||
|
||||
type TcCsum struct {
|
||||
TcGen
|
||||
UpdateFlags uint32
|
||||
}
|
||||
|
||||
func (msg *TcCsum) Len() int {
|
||||
return SizeofTcCsum
|
||||
}
|
||||
|
||||
func DeserializeTcCsum(b []byte) *TcCsum {
|
||||
return (*TcCsum)(unsafe.Pointer(&b[0:SizeofTcCsum][0]))
|
||||
}
|
||||
|
||||
func (x *TcCsum) Serialize() []byte {
|
||||
return (*(*[SizeofTcCsum]byte)(unsafe.Pointer(x)))[:]
|
||||
}
|
||||
|
||||
const (
|
||||
TCA_ACT_MIRRED = 8
|
||||
)
|
||||
@@ -626,6 +760,69 @@ func (x *TcMirred) Serialize() []byte {
|
||||
return (*(*[SizeofTcMirred]byte)(unsafe.Pointer(x)))[:]
|
||||
}
|
||||
|
||||
const (
|
||||
TCA_TUNNEL_KEY_UNSPEC = iota
|
||||
TCA_TUNNEL_KEY_TM
|
||||
TCA_TUNNEL_KEY_PARMS
|
||||
TCA_TUNNEL_KEY_ENC_IPV4_SRC
|
||||
TCA_TUNNEL_KEY_ENC_IPV4_DST
|
||||
TCA_TUNNEL_KEY_ENC_IPV6_SRC
|
||||
TCA_TUNNEL_KEY_ENC_IPV6_DST
|
||||
TCA_TUNNEL_KEY_ENC_KEY_ID
|
||||
TCA_TUNNEL_KEY_PAD
|
||||
TCA_TUNNEL_KEY_ENC_DST_PORT
|
||||
TCA_TUNNEL_KEY_NO_CSUM
|
||||
TCA_TUNNEL_KEY_ENC_OPTS
|
||||
TCA_TUNNEL_KEY_ENC_TOS
|
||||
TCA_TUNNEL_KEY_ENC_TTL
|
||||
TCA_TUNNEL_KEY_MAX
|
||||
)
|
||||
|
||||
type TcTunnelKey struct {
|
||||
TcGen
|
||||
Action int32
|
||||
}
|
||||
|
||||
func (x *TcTunnelKey) Len() int {
|
||||
return SizeofTcTunnelKey
|
||||
}
|
||||
|
||||
func DeserializeTunnelKey(b []byte) *TcTunnelKey {
|
||||
return (*TcTunnelKey)(unsafe.Pointer(&b[0:SizeofTcTunnelKey][0]))
|
||||
}
|
||||
|
||||
func (x *TcTunnelKey) Serialize() []byte {
|
||||
return (*(*[SizeofTcTunnelKey]byte)(unsafe.Pointer(x)))[:]
|
||||
}
|
||||
|
||||
const (
|
||||
TCA_SKBEDIT_UNSPEC = iota
|
||||
TCA_SKBEDIT_TM
|
||||
TCA_SKBEDIT_PARMS
|
||||
TCA_SKBEDIT_PRIORITY
|
||||
TCA_SKBEDIT_QUEUE_MAPPING
|
||||
TCA_SKBEDIT_MARK
|
||||
TCA_SKBEDIT_PAD
|
||||
TCA_SKBEDIT_PTYPE
|
||||
TCA_SKBEDIT_MAX = TCA_SKBEDIT_MARK
|
||||
)
|
||||
|
||||
type TcSkbEdit struct {
|
||||
TcGen
|
||||
}
|
||||
|
||||
func (x *TcSkbEdit) Len() int {
|
||||
return SizeofTcSkbEdit
|
||||
}
|
||||
|
||||
func DeserializeSkbEdit(b []byte) *TcSkbEdit {
|
||||
return (*TcSkbEdit)(unsafe.Pointer(&b[0:SizeofTcSkbEdit][0]))
|
||||
}
|
||||
|
||||
func (x *TcSkbEdit) Serialize() []byte {
|
||||
return (*(*[SizeofTcSkbEdit]byte)(unsafe.Pointer(x)))[:]
|
||||
}
|
||||
|
||||
// struct tc_police {
|
||||
// __u32 index;
|
||||
// int action;
|
||||
@@ -708,3 +905,215 @@ const (
|
||||
TCA_FQ_CODEL_DROP_BATCH_SIZE
|
||||
TCA_FQ_CODEL_MEMORY_LIMIT
|
||||
)
|
||||
|
||||
const (
|
||||
TCA_HFSC_UNSPEC = iota
|
||||
TCA_HFSC_RSC
|
||||
TCA_HFSC_FSC
|
||||
TCA_HFSC_USC
|
||||
)
|
||||
|
||||
const (
|
||||
TCA_FLOWER_UNSPEC = iota
|
||||
TCA_FLOWER_CLASSID
|
||||
TCA_FLOWER_INDEV
|
||||
TCA_FLOWER_ACT
|
||||
TCA_FLOWER_KEY_ETH_DST /* ETH_ALEN */
|
||||
TCA_FLOWER_KEY_ETH_DST_MASK /* ETH_ALEN */
|
||||
TCA_FLOWER_KEY_ETH_SRC /* ETH_ALEN */
|
||||
TCA_FLOWER_KEY_ETH_SRC_MASK /* ETH_ALEN */
|
||||
TCA_FLOWER_KEY_ETH_TYPE /* be16 */
|
||||
TCA_FLOWER_KEY_IP_PROTO /* u8 */
|
||||
TCA_FLOWER_KEY_IPV4_SRC /* be32 */
|
||||
TCA_FLOWER_KEY_IPV4_SRC_MASK /* be32 */
|
||||
TCA_FLOWER_KEY_IPV4_DST /* be32 */
|
||||
TCA_FLOWER_KEY_IPV4_DST_MASK /* be32 */
|
||||
TCA_FLOWER_KEY_IPV6_SRC /* struct in6_addr */
|
||||
TCA_FLOWER_KEY_IPV6_SRC_MASK /* struct in6_addr */
|
||||
TCA_FLOWER_KEY_IPV6_DST /* struct in6_addr */
|
||||
TCA_FLOWER_KEY_IPV6_DST_MASK /* struct in6_addr */
|
||||
TCA_FLOWER_KEY_TCP_SRC /* be16 */
|
||||
TCA_FLOWER_KEY_TCP_DST /* be16 */
|
||||
TCA_FLOWER_KEY_UDP_SRC /* be16 */
|
||||
TCA_FLOWER_KEY_UDP_DST /* be16 */
|
||||
|
||||
TCA_FLOWER_FLAGS
|
||||
TCA_FLOWER_KEY_VLAN_ID /* be16 */
|
||||
TCA_FLOWER_KEY_VLAN_PRIO /* u8 */
|
||||
TCA_FLOWER_KEY_VLAN_ETH_TYPE /* be16 */
|
||||
|
||||
TCA_FLOWER_KEY_ENC_KEY_ID /* be32 */
|
||||
TCA_FLOWER_KEY_ENC_IPV4_SRC /* be32 */
|
||||
TCA_FLOWER_KEY_ENC_IPV4_SRC_MASK /* be32 */
|
||||
TCA_FLOWER_KEY_ENC_IPV4_DST /* be32 */
|
||||
TCA_FLOWER_KEY_ENC_IPV4_DST_MASK /* be32 */
|
||||
TCA_FLOWER_KEY_ENC_IPV6_SRC /* struct in6_addr */
|
||||
TCA_FLOWER_KEY_ENC_IPV6_SRC_MASK /* struct in6_addr */
|
||||
TCA_FLOWER_KEY_ENC_IPV6_DST /* struct in6_addr */
|
||||
TCA_FLOWER_KEY_ENC_IPV6_DST_MASK /* struct in6_addr */
|
||||
|
||||
TCA_FLOWER_KEY_TCP_SRC_MASK /* be16 */
|
||||
TCA_FLOWER_KEY_TCP_DST_MASK /* be16 */
|
||||
TCA_FLOWER_KEY_UDP_SRC_MASK /* be16 */
|
||||
TCA_FLOWER_KEY_UDP_DST_MASK /* be16 */
|
||||
TCA_FLOWER_KEY_SCTP_SRC_MASK /* be16 */
|
||||
TCA_FLOWER_KEY_SCTP_DST_MASK /* be16 */
|
||||
|
||||
TCA_FLOWER_KEY_SCTP_SRC /* be16 */
|
||||
TCA_FLOWER_KEY_SCTP_DST /* be16 */
|
||||
|
||||
TCA_FLOWER_KEY_ENC_UDP_SRC_PORT /* be16 */
|
||||
TCA_FLOWER_KEY_ENC_UDP_SRC_PORT_MASK /* be16 */
|
||||
TCA_FLOWER_KEY_ENC_UDP_DST_PORT /* be16 */
|
||||
TCA_FLOWER_KEY_ENC_UDP_DST_PORT_MASK /* be16 */
|
||||
|
||||
TCA_FLOWER_KEY_FLAGS /* be32 */
|
||||
TCA_FLOWER_KEY_FLAGS_MASK /* be32 */
|
||||
|
||||
TCA_FLOWER_KEY_ICMPV4_CODE /* u8 */
|
||||
TCA_FLOWER_KEY_ICMPV4_CODE_MASK /* u8 */
|
||||
TCA_FLOWER_KEY_ICMPV4_TYPE /* u8 */
|
||||
TCA_FLOWER_KEY_ICMPV4_TYPE_MASK /* u8 */
|
||||
TCA_FLOWER_KEY_ICMPV6_CODE /* u8 */
|
||||
TCA_FLOWER_KEY_ICMPV6_CODE_MASK /* u8 */
|
||||
TCA_FLOWER_KEY_ICMPV6_TYPE /* u8 */
|
||||
TCA_FLOWER_KEY_ICMPV6_TYPE_MASK /* u8 */
|
||||
|
||||
TCA_FLOWER_KEY_ARP_SIP /* be32 */
|
||||
TCA_FLOWER_KEY_ARP_SIP_MASK /* be32 */
|
||||
TCA_FLOWER_KEY_ARP_TIP /* be32 */
|
||||
TCA_FLOWER_KEY_ARP_TIP_MASK /* be32 */
|
||||
TCA_FLOWER_KEY_ARP_OP /* u8 */
|
||||
TCA_FLOWER_KEY_ARP_OP_MASK /* u8 */
|
||||
TCA_FLOWER_KEY_ARP_SHA /* ETH_ALEN */
|
||||
TCA_FLOWER_KEY_ARP_SHA_MASK /* ETH_ALEN */
|
||||
TCA_FLOWER_KEY_ARP_THA /* ETH_ALEN */
|
||||
TCA_FLOWER_KEY_ARP_THA_MASK /* ETH_ALEN */
|
||||
|
||||
TCA_FLOWER_KEY_MPLS_TTL /* u8 - 8 bits */
|
||||
TCA_FLOWER_KEY_MPLS_BOS /* u8 - 1 bit */
|
||||
TCA_FLOWER_KEY_MPLS_TC /* u8 - 3 bits */
|
||||
TCA_FLOWER_KEY_MPLS_LABEL /* be32 - 20 bits */
|
||||
|
||||
TCA_FLOWER_KEY_TCP_FLAGS /* be16 */
|
||||
TCA_FLOWER_KEY_TCP_FLAGS_MASK /* be16 */
|
||||
|
||||
TCA_FLOWER_KEY_IP_TOS /* u8 */
|
||||
TCA_FLOWER_KEY_IP_TOS_MASK /* u8 */
|
||||
TCA_FLOWER_KEY_IP_TTL /* u8 */
|
||||
TCA_FLOWER_KEY_IP_TTL_MASK /* u8 */
|
||||
|
||||
TCA_FLOWER_KEY_CVLAN_ID /* be16 */
|
||||
TCA_FLOWER_KEY_CVLAN_PRIO /* u8 */
|
||||
TCA_FLOWER_KEY_CVLAN_ETH_TYPE /* be16 */
|
||||
|
||||
TCA_FLOWER_KEY_ENC_IP_TOS /* u8 */
|
||||
TCA_FLOWER_KEY_ENC_IP_TOS_MASK /* u8 */
|
||||
TCA_FLOWER_KEY_ENC_IP_TTL /* u8 */
|
||||
TCA_FLOWER_KEY_ENC_IP_TTL_MASK /* u8 */
|
||||
|
||||
TCA_FLOWER_KEY_ENC_OPTS
|
||||
TCA_FLOWER_KEY_ENC_OPTS_MASK
|
||||
|
||||
__TCA_FLOWER_MAX
|
||||
)
|
||||
|
||||
// struct tc_sfq_qopt {
|
||||
// unsigned quantum; /* Bytes per round allocated to flow */
|
||||
// int perturb_period; /* Period of hash perturbation */
|
||||
// __u32 limit; /* Maximal packets in queue */
|
||||
// unsigned divisor; /* Hash divisor */
|
||||
// unsigned flows; /* Maximal number of flows */
|
||||
// };
|
||||
|
||||
type TcSfqQopt struct {
|
||||
Quantum uint8
|
||||
Perturb int32
|
||||
Limit uint32
|
||||
Divisor uint8
|
||||
Flows uint8
|
||||
}
|
||||
|
||||
func (x *TcSfqQopt) Len() int {
|
||||
return SizeofTcSfqQopt
|
||||
}
|
||||
|
||||
func DeserializeTcSfqQopt(b []byte) *TcSfqQopt {
|
||||
return (*TcSfqQopt)(unsafe.Pointer(&b[0:SizeofTcSfqQopt][0]))
|
||||
}
|
||||
|
||||
func (x *TcSfqQopt) Serialize() []byte {
|
||||
return (*(*[SizeofTcSfqQopt]byte)(unsafe.Pointer(x)))[:]
|
||||
}
|
||||
|
||||
// struct tc_sfqred_stats {
|
||||
// __u32 prob_drop; /* Early drops, below max threshold */
|
||||
// __u32 forced_drop; /* Early drops, after max threshold */
|
||||
// __u32 prob_mark; /* Marked packets, below max threshold */
|
||||
// __u32 forced_mark; /* Marked packets, after max threshold */
|
||||
// __u32 prob_mark_head; /* Marked packets, below max threshold */
|
||||
// __u32 forced_mark_head;/* Marked packets, after max threshold */
|
||||
// };
|
||||
type TcSfqRedStats struct {
|
||||
ProbDrop uint32
|
||||
ForcedDrop uint32
|
||||
ProbMark uint32
|
||||
ForcedMark uint32
|
||||
ProbMarkHead uint32
|
||||
ForcedMarkHead uint32
|
||||
}
|
||||
|
||||
func (x *TcSfqRedStats) Len() int {
|
||||
return SizeofTcSfqRedStats
|
||||
}
|
||||
|
||||
func DeserializeTcSfqRedStats(b []byte) *TcSfqRedStats {
|
||||
return (*TcSfqRedStats)(unsafe.Pointer(&b[0:SizeofTcSfqRedStats][0]))
|
||||
}
|
||||
|
||||
func (x *TcSfqRedStats) Serialize() []byte {
|
||||
return (*(*[SizeofTcSfqRedStats]byte)(unsafe.Pointer(x)))[:]
|
||||
}
|
||||
|
||||
// struct tc_sfq_qopt_v1 {
|
||||
// struct tc_sfq_qopt v0;
|
||||
// unsigned int depth; /* max number of packets per flow */
|
||||
// unsigned int headdrop;
|
||||
// /* SFQRED parameters */
|
||||
// __u32 limit; /* HARD maximal flow queue length (bytes) */
|
||||
// __u32 qth_min; /* Min average length threshold (bytes) */
|
||||
// __u32 qth_max; /* Max average length threshold (bytes) */
|
||||
// unsigned char Wlog; /* log(W) */
|
||||
// unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */
|
||||
// unsigned char Scell_log; /* cell size for idle damping */
|
||||
// unsigned char flags;
|
||||
// __u32 max_P; /* probability, high resolution */
|
||||
// /* SFQRED stats */
|
||||
// struct tc_sfqred_stats stats;
|
||||
// };
|
||||
type TcSfqQoptV1 struct {
|
||||
TcSfqQopt
|
||||
Depth uint32
|
||||
HeadDrop uint32
|
||||
Limit uint32
|
||||
QthMin uint32
|
||||
QthMax uint32
|
||||
Wlog byte
|
||||
Plog byte
|
||||
ScellLog byte
|
||||
Flags byte
|
||||
MaxP uint32
|
||||
TcSfqRedStats
|
||||
}
|
||||
|
||||
func (x *TcSfqQoptV1) Len() int {
|
||||
return SizeofTcSfqQoptV1
|
||||
}
|
||||
|
||||
func DeserializeTcSfqQoptV1(b []byte) *TcSfqQoptV1 {
|
||||
return (*TcSfqQoptV1)(unsafe.Pointer(&b[0:SizeofTcSfqQoptV1][0]))
|
||||
}
|
||||
|
||||
func (x *TcSfqQoptV1) Serialize() []byte {
|
||||
return (*(*[SizeofTcSfqQoptV1]byte)(unsafe.Pointer(x)))[:]
|
||||
}
|
||||
Reference in new issue
Block a user