IFA_ADDRESS is to be used as the peer address if it differs from IFA_LOCAL.
Therefore, include the check for "no IFA_ADDRESS" in the difference check.
Example: ppp interfaces can contain IFA_LOCAL and no IFA_ADDRESS attribute
netlink(kernel) returns the string values in a c-style
manner terminating with null.
when converting to go string these need to be removed
as done in other places in the project.
keeping the null terminating char prevents comparing
devlink dev/port string attributes as the `==` string
operand will fail.
Signed-off-by: Adrian Chiris <adrianc@nvidia.com>
The package level var native (holding the native endianness) is
initialized at package load time. Thus there is no need to re-initalize
it in functions using it, e.g. (*Handle).filterModify, parseU32Data,
parseFwData, parseBpfData and parseMatchAllData.
This fixes a data race between these functions and any read access of
var native, e.g. in LinkDeserialize as reported in issue #633.
Also don't re-declare local variables shadowing the global package-level
var.
Fixes#633
Signed-off-by: Tobias Klauser <tobias@cilium.io>
Provide the status of the allmulticast option via the highlevel
link attributes instead of requiring raw flag handling.
Avoid comparing all rawflags before and after in tests due to that
the IFF_RUNNING flag might change independenly.
Signed-off-by: Björn Svensson <bjorn.a.svensson@est.tech>
Add APIs to add and delete a devlink port of specified flavour for a
given devlink device.
Extended test to accept devlink device and sf number parameters from the
test command line.
Signed-off-by: Parav Pandit <parav@nvidia.com>
ipvtap is a similar link type as ipvlan with tap interface.
This patch enables it just like macvtap.
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
Add optional field in XfrmPolicyTmpl to template code so users can
configure template optional values.
Tested via:
$ go test -exec sudo . -run XfrmPolicyWithOptional
ok github.com/vishvananda/netlink 0.009s
Co-authored-by: Joe Stringer <joe@cilium.io>
Signed-off-by: Joe Stringer <joe@cilium.io>
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Commit ec93726159 ("Adds strings translation methods") broke non-Linux
builds by relying on unix constants that are only declared on the linux
platform in the upstream x/sys/unix package.
Other platforms report undefined variables, such as the following:
$ GOOS=darwin go build .
# github.com/vishvananda/netlink
./route.go:17:7: undefined: SCOPE_UNIVERSE
./route.go:19:7: undefined: SCOPE_SITE
./route.go:21:7: undefined: SCOPE_LINK
./route.go:23:7: undefined: SCOPE_HOST
./route.go:25:7: undefined: SCOPE_NOWHERE
./route.go:55:7: undefined: unix.RTPROT_BABEL
./route.go:57:7: undefined: unix.RTPROT_BGP
./route.go:59:7: undefined: unix.RTPROT_BIRD
./route.go:61:7: undefined: unix.RTPROT_BOOT
./route.go:63:7: undefined: unix.RTPROT_DHCP
./route.go:63:7: too many errors
Move the platform-specific implementations to platform-specific files
and add stubs to satisfy other platforms.
Fixes: ec93726159 ("Adds strings translation methods")
Signed-off-by: Joe Stringer <joe@cilium.io>
XfrmState currently doesn't allow setting the mask for the output mark.
As a result, setting an output mark always clears all bits. This commit
adds support for the mask value.
Signed-off-by: Paul Chaignon <paul@cilium.io>