Bug 238327 - net/fping: fping -4 broken if built with IPv6 disabled
Summary: net/fping: fping -4 broken if built with IPv6 disabled
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Eugene Grosbein
URL:
Keywords: easy, needs-qa
Depends on:
Blocks:
 
Reported: 2019-06-04 21:06 UTC by Eugene Grosbein
Modified: 2019-06-19 20:09 UTC (History)
1 user (show)

See Also:
eugen: maintainer-feedback-
eugen: merge-quarterly-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eugene Grosbein freebsd_committer 2019-06-04 21:06:22 UTC
If one builds and uses net/fping version 4.2 with option IPV6 disabled, the command fping -4 always fails with wrong error message:

fping: can't specify both -4 and -6

This makes it impossible using fping probes with SmokePing as it runs fping with -4 option.

If src/fping.c is compiled without IPV6 defined, its global variable "hints_ai_family" has initial value AF_INET but following code assumes it should be AF_UNSPEC before processing options.

Either port options IPV6 should be removed, or a patch added fixing the problem:

--- fping.c.orig        2019-02-20 03:54:45.000000000 +0700
+++ fping.c     2019-06-05 04:05:50.930412000 +0700
@@ -427,7 +427,7 @@
     while ((c = optparse_long(&optparse_state, longopts, NULL)) != EOF) {
         switch (c) {
         case '4':
-            if (hints_ai_family != AF_UNSPEC) {
+            if (hints_ai_family == AF_INET6) {
                 fprintf(stderr, "%s: can't specify both -4 and -6\n", prog);
                 exit(1);
             }
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2019-06-05 03:55:16 UTC
@Eugene Could you include the proposed patch as an attachment (against the port using make makepatch) please, and also confirm the port passes QA (poudriere) with this patch.

That will enable me/us to approve it under blanket: build fix for you to commit

^Triage: Reporter is committer, assign accordingly
Comment 2 Eugene Grosbein freebsd_committer 2019-06-05 08:51:38 UTC
(In reply to Kubilay Kocak from comment #1)

No need to rush. If maintainer approves, I'll commit it myself.
Comment 3 commit-hook freebsd_committer 2019-06-19 20:08:02 UTC
A commit references this bug:

Author: eugen
Date: Wed Jun 19 20:07:45 UTC 2019
New revision: 504585
URL: https://svnweb.freebsd.org/changeset/ports/504585

Log:
  net/fping: fix WITHOUT_IPV6 mode

  If one builds and uses net/fping version 4.2 with option IPV6 disabled,
  the command fping -4 always fails with wrong error message:

  fping: can't specify both -4 and -6

  This makes it impossible using fping probes with SmokePing
  as it runs fping with -4 option. This change fixes this.
  Also, do not install symlinks for fping6 and manual in this case.

  PORTREVISION not bumped as default build is not affected.

  PR:		238327
  Approved by:	jharris@widomaker.com (maintainter timeout, 2 weeks)

Changes:
  head/net/fping/Makefile
  head/net/fping/files/
  head/net/fping/files/patch-src_fping.c
  head/net/fping/pkg-plist
Comment 4 Eugene Grosbein freebsd_committer 2019-06-19 20:09:45 UTC
Fix commited. No MFH needed as default build not affected.