After update from 4.2 to 4.4wuth "fping" and "fping6" now fails inside a FreeBSD jail with "allow.raw_sockets". $ fping 127.0.0.44 fping: cannot bind source address : Can't assign requested address truss fping6: socket(PF_INET6,SOCK_RAW,IPPROTO_ICMPV6) = 4 (0x4) fcntl(4,F_GETFL,) = 2 (0x2) fcntl(4,F_SETFL,O_RDWR|O_NONBLOCK) = 0 (0x0) getuid() = 0 (0x0) getpid() = 29446 (0x7306) setsockopt(3,SOL_SOCKET,SO_TIMESTAMP,0x7fffffffe930,4) = 0 (0x0) setsockopt(4,SOL_SOCKET,SO_TIMESTAMP,0x7fffffffe930,4) = 0 (0x0) bind(3,{ AF_INET 0.0.0.0:0 },16) ERR#49 'Can't assign requested address' reverting to 4.2 fixes the problem.
@Dirk Was this a regression against a prior port/package version, or on a particular FreeBSD version/branch?
This works when the jail is set to ip4 = inherit $ fping 127.0.0.1 127.0.0.1 is alive $ fping --version fping: Version 4.4 fping: comments to david@schweikert.ch I can confirm it's broken when the jail is given an IP address.
(In reply to Kubilay Kocak from comment #1) Same FreeBSD version. broken package: 10 Aug. 07:36 /usr/ports/packages12-amd64/All/fping-4.4.txz working package_ 13 Juli 16:36 /usr/ports/packages12-amd64/Old/fping-4.2.txz
Please see if ping 5.0 fixes this issue: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=248744 Thanks.
(In reply to jharris from comment #4) Sorry, but fping 5.0 fails as well with the same error.
(In reply to Dirk Meyer from comment #5) The issue is a commit somewhere between v4.2 and v4.3 (which is also broken). I'm currently tracking down the commit in question with a git-bisect and will report back when I find it (hopefully with a patch).
As seen in the truss output fping6 tries to bind to an IPv4, AF_INET fping tries to bind to an IPV4 and IPv6. I got fping to work if I force both Source.Addresses. Looking at the diffs I see that src_addr_set and src_addr6_set is set but not used. Revering the conditions in fping.c resolves the problems for me. I propose the following patch to fix the port.
Created attachment 217361 [details] patch
merger-quaterly is not needed, as quarterly has still 4.2 https://www.freshports.org/net/fping/
Reported the issue upstream at https://github.com/schweikert/fping/pull/198
(In reply to Dirk Meyer from comment #10) Bisect finished (had to break to do something else), the offending commit is this one: https://github.com/schweikert/fping/commit/1486bf209baa49724c7f776463d2ba5858fa0ff4 I will add it to your issue report.
(In reply to James French from comment #11) This matches my finding. Both flags have been removed in the conditionals: 968/974 if (src_addr_set && socket4 >= 0) { 972/978 if (src_addr6_set && socket6 >= 0) {
(In reply to jharris from comment #4) Do you approve the suggested patch for you port?
(In reply to Dirk Meyer from comment #13) Yes, albeit without personally testing. Thanks!
A commit references this bug: Author: dinoex Date: Sat Aug 22 12:36:18 UTC 2020 New revision: 545762 URL: https://svnweb.freebsd.org/changeset/ports/545762 Log: - fix Can't assign requested address PR: 248647 Approved by: J Harris Changes: head/net/fping/Makefile head/net/fping/files/ head/net/fping/files/patch-fping.c