This bug still exists in version 0.2-11

This problem is caused because of an incorrect logical OR(||) which should
be replaced with logical AND(&&)

Here is the diff from farpd_0.2.orig.tar.gz source tree patched with
farpd_0.2-11.diff
--- farpd-0.2/arpd.c 2019-11-14 16:12:44.196839792 +0000
+++ farpd-0.2.12/arpd.c 2019-11-14 15:59:12.058676056 +0000
@@ -205,13 +205,14 @@
  arpd_ifent.intf_len = sizeof(arpd_ifent);
  strncpy(arpd_ifent.intf_name, dev, sizeof(arpd_ifent.intf_name) - 1);
  arpd_ifent.intf_name[sizeof(arpd_ifent.intf_name) - 1] = '\0';
-
+
  if (intf_get(intf, &arpd_ifent) < 0)
  err(1, "intf_get");

- if (arpd_ifent.intf_addr.addr_type != ADDR_TYPE_IP ||
-    arpd_ifent.intf_link_addr.addr_type != ADDR_TYPE_ETH)
- errx(1, "bad interface configuration: not IP or Ethernet");
+ if (arpd_ifent.intf_addr.addr_type != ADDR_TYPE_IP &&
+            arpd_ifent.intf_link_addr.addr_type != ADDR_TYPE_ETH)
+                errx(1, "bad interface configuration: not IP or Ethernet");
+
  arpd_ifent.intf_addr.addr_bits = IP_ADDR_BITS;

  snprintf(filter, sizeof(filter), "arp %s%s%s and not ether src %s",

Apply this patch and compile from source will allow using farpd with no IP
assigned to the interface.
I tested on Ubuntu 18.04.3 LTS

$ ifconfig ens34
ens34: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::250:56ff:fe31:89e3  prefixlen 64  scopeid 0x20<link>
        ether 00:50:56:31:89:e3  txqueuelen 1000  (Ethernet)
        RX packets 34  bytes 7162 (7.1 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 13  bytes 1006 (1.0 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

$ sudo ./farpd -i ens34
arpd[2024]: listening on ens34: arp  and not ether src 00:50:56:31:89:e3

/Paul Beyleveld

Attachment: farp_if_noip.patch
Description: Binary data

Reply via email to