Ajay Joseph
Ajay Joseph

Reputation: 3

arping not working when called from a script

I am using an arping command to find duplicate IP's on the network, before assigning it to my device. I use this command

arping -D -I ${NET_DEVICE} -c 10 ${IPADDR}

After that, I check with $? for the response and decides, if it's duplicated or not.

The problem is, this command returns as not duplicated when I call it from my network_reset script. When I call it individually from outside, it works perfectly.

Any suggestions are appreciated.

Upvotes: 1

Views: 221

Answers (1)

Thomas
Thomas

Reputation: 4255

I've had similar issues with programs that do work in signal handlers. I got different behaviour on the command line compared to when run within a script.

I see that iputils-arping, which you're probably using, seems to violate POSIX in the same way that I've seen. See signal(7) for a list of functions allowed. iputils-arping uses many more.

This may be the cause of what you see.

You could try the portable arping.

Upvotes: 1

Related Questions