j-keck / arping Goto Github PK
View Code? Open in Web Editor NEWnative go library to ping a host per arp datagram, or query a host mac address
License: MIT License
native go library to ping a host per arp datagram, or query a host mac address
License: MIT License
Can we create a new release with ab5f188 and publish it on pkg.go.dev?
Hello,
I would like to use this Go arping implementation in a containerized (k8s) environment for CNI purposes.
I started a Pod(1), which has eth1 interface for packet capturing.
I started another Pod(2), which has eth1 as follows:
105: eth1@if2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9000 qdisc noqueue state UNKNOWN group default
link/ether fa:16:3e:41:8e:6b brd ff:ff:ff:ff:ff:ff
inet 10.100.20.101/24 brd 10.100.20.255 scope global eth1
valid_lft forever preferred_lft forever
inet6 fc00:caa5:1:a:f816:3eff:fe30:16bf/64 scope global
valid_lft forever preferred_lft forever
inet6 fe80::fa16:3e00:541:8e6b/64 scope link
valid_lft forever preferred_lft forever
When Pod(2) was created, our custom CNI sent gARP packet using this Go implementation. That is the first packet in the capture below. Inside Pod(2) I executed "arping -c1 -A -I eth1 10.100.20.101" (arping binary from centos repo) as a reference, that is the last packet in the capture file.
The problem is that the gARP packet send by this Go implementation is malformed (as it is reported by Wireshark v3), so I'm not sure whether it is really working.
The packet capture is attached here:
garp.zip
Can you please check what's wrong?
Thanks!
Hi,
I'm testing the arping cli on MacOS and I've the problem that I get no matching response.
sudo -E ./arping -t 1s -v 192.168.2.3 holger@happle
Password:
search usable interface
OTHER NET: lo0 up|loopback|multicast
DOWN: gif0 pointtopoint|multicast
DOWN: stf0 0
USABLE: en0 20:c9:d0:7a:fa:31 up|broadcast|multicast
search available /dev/bpfX
open failed: /dev/bpf0 - open /dev/bpf0: resource busy
open failed: /dev/bpf1 - open /dev/bpf1: resource busy
open success: /dev/bpf2
arping '192.168.2.3' over interface: 'en0' with address: '192.168.2.211'
ignore received arp: srcIP: '<nil>', srcMac: '02:d3:ff:ff:ff:ff:ff:ff:c0:a8:02:03'
ignore received arp: srcIP: '<nil>', srcMac: '02:03:20:c9:d0:7a:fa:31:c0:a8:02:d3:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00'
ignore received arp: srcIP: '<nil>', srcMac: '02:e2:00:00:00:00:00:00:c0:a8:02:01:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00'
timeout
With the "original" arping I get a response:
/usr/local/sbin/arping 192.168.2.3 holger@happle
ARPING 192.168.2.3
60 bytes from b8:27:eb:c4:2e:5f (192.168.2.3): index=0 time=5.100 msec
I've captured the packets also with Wireshark and arping (the go version) was correct in the number of responses. There are 3 arp packets. The first one was a correct reply, but somehow arping could not recognize it.
Any ideas?
2 errors when i build, a look through the source code confirms it:
# github.com/j-keck/arping
..\..\..\pkg\mod\github.com\j-keck\[email protected]\arping.go:120:12: assignment mismatch: 2 variables but initialize returns 1 values
..\..\..\pkg\mod\github.com\j-keck\[email protected]\arping.go:207:12: assignment mismatch: 2 variables but initialize returns 1 values
Use arping package like this:
var arpSyncInterval := time.NewTicker(time.Second * 10)
go loopForARP(dstIp);
func loopForARP(dstIp) {
for _ = range arpSyncInterval .C {
mac, _, err := arping.Ping(dstIp)
if err != nil {
log.WithError(err).Errorf("send arp ping failed")
continue
}
// doSomethingWithMac()
}
}
The goroutines continuously rising when dstIp is unreachable.
There are same goroutine like this:
I review the code of arping.Ping(), expect that it will stop the goroutine when arping timeout. but the result doesn't meet.
Is the usage wrong for the arping package?or misunderstanding for the goroutine?
arping.go:120:12: assignment mismatch: 2 variables but initialize returns 1 value
arping.go:207:12: assignment mismatch: 2 variables but initialize returns 1 value
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.