CNI: bump to 1.0.1 (#297)
* CNI: bump to 1.0.1 This commit bumps the declared version of CNI in the Kilo manifests to 1.0.1. This is possible with no changes to the configuration lists because our simple configuration is not affected by any of the deprecations, and there was effectively no change between 0.4.0 and 1.0.0, other than the declaration of a stable API. Similarly, this commit also bumps the version of the CNI library and the plugins package. Bumping to CNI 1.0.0 will help ensure that Kilo stays compatible with container runtimes in the future. Signed-off-by: Lucas Servén Marín <lserven@gmail.com> * vendor: revendor Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
This commit is contained in:
committed by
GitHub
parent
6862274e8e
commit
8cadff2b79
68
vendor/github.com/vishvananda/netlink/rule_linux.go
generated
vendored
68
vendor/github.com/vishvananda/netlink/rule_linux.go
generated
vendored
@@ -1,6 +1,7 @@
|
||||
package netlink
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"net"
|
||||
|
||||
@@ -55,6 +56,9 @@ func ruleHandle(rule *Rule, req *nl.NetlinkRequest) error {
|
||||
if rule.Table >= 0 && rule.Table < 256 {
|
||||
msg.Table = uint8(rule.Table)
|
||||
}
|
||||
if rule.Tos != 0 {
|
||||
msg.Tos = uint8(rule.Tos)
|
||||
}
|
||||
|
||||
var dstFamily uint8
|
||||
var rtAttrs []*nl.RtAttr
|
||||
@@ -138,18 +142,28 @@ func ruleHandle(rule *Rule, req *nl.NetlinkRequest) error {
|
||||
}
|
||||
}
|
||||
if rule.IifName != "" {
|
||||
req.AddData(nl.NewRtAttr(nl.FRA_IIFNAME, []byte(rule.IifName)))
|
||||
req.AddData(nl.NewRtAttr(nl.FRA_IIFNAME, []byte(rule.IifName+"\x00")))
|
||||
}
|
||||
if rule.OifName != "" {
|
||||
req.AddData(nl.NewRtAttr(nl.FRA_OIFNAME, []byte(rule.OifName)))
|
||||
req.AddData(nl.NewRtAttr(nl.FRA_OIFNAME, []byte(rule.OifName+"\x00")))
|
||||
}
|
||||
if rule.Goto >= 0 {
|
||||
msg.Type = nl.FR_ACT_NOP
|
||||
msg.Type = nl.FR_ACT_GOTO
|
||||
b := make([]byte, 4)
|
||||
native.PutUint32(b, uint32(rule.Goto))
|
||||
req.AddData(nl.NewRtAttr(nl.FRA_GOTO, b))
|
||||
}
|
||||
|
||||
if rule.Dport != nil {
|
||||
b := rule.Dport.toRtAttrData()
|
||||
req.AddData(nl.NewRtAttr(nl.FRA_DPORT_RANGE, b))
|
||||
}
|
||||
|
||||
if rule.Sport != nil {
|
||||
b := rule.Sport.toRtAttrData()
|
||||
req.AddData(nl.NewRtAttr(nl.FRA_SPORT_RANGE, b))
|
||||
}
|
||||
|
||||
_, err := req.Execute(unix.NETLINK_ROUTE, 0)
|
||||
return err
|
||||
}
|
||||
@@ -163,6 +177,19 @@ func RuleList(family int) ([]Rule, error) {
|
||||
// RuleList lists rules in the system.
|
||||
// Equivalent to: ip rule list
|
||||
func (h *Handle) RuleList(family int) ([]Rule, error) {
|
||||
return h.RuleListFiltered(family, nil, 0)
|
||||
}
|
||||
|
||||
// RuleListFiltered gets a list of rules in the system filtered by the
|
||||
// specified rule template `filter`.
|
||||
// Equivalent to: ip rule list
|
||||
func RuleListFiltered(family int, filter *Rule, filterMask uint64) ([]Rule, error) {
|
||||
return pkgHandle.RuleListFiltered(family, filter, filterMask)
|
||||
}
|
||||
|
||||
// RuleListFiltered lists rules in the system.
|
||||
// Equivalent to: ip rule list
|
||||
func (h *Handle) RuleListFiltered(family int, filter *Rule, filterMask uint64) ([]Rule, error) {
|
||||
req := h.newNetlinkRequest(unix.RTM_GETRULE, unix.NLM_F_DUMP|unix.NLM_F_REQUEST)
|
||||
msg := nl.NewIfInfomsg(family)
|
||||
req.AddData(msg)
|
||||
@@ -184,6 +211,7 @@ func (h *Handle) RuleList(family int) ([]Rule, error) {
|
||||
rule := NewRule()
|
||||
|
||||
rule.Invert = msg.Flags&FibRuleInvert > 0
|
||||
rule.Tos = uint(msg.Tos)
|
||||
|
||||
for j := range attrs {
|
||||
switch attrs[j].Attr.Type {
|
||||
@@ -225,10 +253,44 @@ func (h *Handle) RuleList(family int) ([]Rule, error) {
|
||||
rule.Goto = int(native.Uint32(attrs[j].Value[0:4]))
|
||||
case nl.FRA_PRIORITY:
|
||||
rule.Priority = int(native.Uint32(attrs[j].Value[0:4]))
|
||||
case nl.FRA_DPORT_RANGE:
|
||||
rule.Dport = NewRulePortRange(native.Uint16(attrs[j].Value[0:2]), native.Uint16(attrs[j].Value[2:4]))
|
||||
case nl.FRA_SPORT_RANGE:
|
||||
rule.Sport = NewRulePortRange(native.Uint16(attrs[j].Value[0:2]), native.Uint16(attrs[j].Value[2:4]))
|
||||
}
|
||||
}
|
||||
|
||||
if filter != nil {
|
||||
switch {
|
||||
case filterMask&RT_FILTER_SRC != 0 &&
|
||||
(rule.Src == nil || rule.Src.String() != filter.Src.String()):
|
||||
continue
|
||||
case filterMask&RT_FILTER_DST != 0 &&
|
||||
(rule.Dst == nil || rule.Dst.String() != filter.Dst.String()):
|
||||
continue
|
||||
case filterMask&RT_FILTER_TABLE != 0 &&
|
||||
filter.Table != unix.RT_TABLE_UNSPEC && rule.Table != filter.Table:
|
||||
continue
|
||||
case filterMask&RT_FILTER_TOS != 0 && rule.Tos != filter.Tos:
|
||||
continue
|
||||
case filterMask&RT_FILTER_PRIORITY != 0 && rule.Priority != filter.Priority:
|
||||
continue
|
||||
case filterMask&RT_FILTER_MARK != 0 && rule.Mark != filter.Mark:
|
||||
continue
|
||||
case filterMask&RT_FILTER_MASK != 0 && rule.Mask != filter.Mask:
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
res = append(res, *rule)
|
||||
}
|
||||
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func (pr *RulePortRange) toRtAttrData() []byte {
|
||||
b := [][]byte{make([]byte, 2), make([]byte, 2)}
|
||||
native.PutUint16(b[0], pr.Start)
|
||||
native.PutUint16(b[1], pr.End)
|
||||
return bytes.Join(b, []byte{})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user