dhcpcd-discuss

Re: Support for "raw-ip" mode

Roy Marples

Tue Aug 20 09:32:35 2019

On 19/08/2019 09:04, Yegor Yefremov wrote:
Can you provide logs of dhcpcd not working on one, or access to such a
device via ssh?

# dhcpcd wwan0
wwan0: unsupported interface family 00
wwan0: waiting for carrier
wwan0: carrier acquired
DUID 00:01:00:01:c7:92:bc:92:74:6a:8f:ff:50:55
wwan0: IAID 00:00:00:06
wwan0: using static address 169.254.227.48/16
arp_open: wwan0: Invalid argument
arp_announce: Invalid argument
forked to background, child pid 354

This is how the interface looks like:

# ip addr show wwan0
6: wwan0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc
pfifo_fast state UNKNOWN group default qlen 1000
     link/none
     inet 169.254.227.48/16 brd 169.254.255.255 scope global noprefixroute wwan0
        valid_lft forever preferred_lft forever

And this is what happens with udhcpc:

# udhcpc -i wwan0
udhcpc: started, v1.31.0
udhcpc: sending discover
udhcpc: sending select for 10.50.235.7
udhcpc: lease of 10.50.235.7 obtained, lease time 7200
deleting routers
adding dns 62.109.121.17
adding dns 62.109.121.18

The attached patch should fix what you've noted thus far.
However, the default dhcpcd action for PtP interfaces is to let a 3rd party configure the address - dhcpcd will wait for it to appear. I don't want to change this, so you'll need this in /etc/dhcpcd.conf

interface wwan0
	dhcp

Then it should work.

Let me know - but please add the -d flag or add `debug` to dhcpcd.conf so I can get more detailed information.

Roy
diff --git a/src/dhcp.c b/src/dhcp.c
index 245ad5c4..8e48592f 100644
--- a/src/dhcp.c
+++ b/src/dhcp.c
@@ -2365,7 +2365,10 @@ dhcp_arp_address(struct interface *ifp)
 		return 0;
 	}
 #else
-	if (ifp->options->options & DHCPCD_ARP && ia == NULL) {
+	if (!(ifp->flags & IFF_NOARP) &&
+	    ifp->options->options & DHCPCD_ARP &&
+	    ia == NULL)
+	{
 		struct arp_state *astate;
 		struct dhcp_lease l;
 
diff --git a/src/dhcpcd.c b/src/dhcpcd.c
index bddd316b..d2b8bd91 100644
--- a/src/dhcpcd.c
+++ b/src/dhcpcd.c
@@ -458,11 +458,10 @@ configure_interface1(struct interface *ifp)
 		ifo->options &= ~DHCPCD_ARP;
 		if (!(ifp->flags & IFF_MULTICAST))
 			ifo->options &= ~DHCPCD_IPV6RS;
-		if (!(ifo->options & DHCPCD_INFORM))
+		if (!(ifo->options & (DHCPCD_INFORM | DHCPCD_WANTDHCP)))
 			ifo->options |= DHCPCD_STATIC;
 	}
-	if (ifp->flags & IFF_NOARP ||
-	    !(ifo->options & DHCPCD_ARP) ||
+	if (!(ifo->options & DHCPCD_ARP) ||
 	    ifo->options & (DHCPCD_INFORM | DHCPCD_STATIC))
 		ifo->options &= ~DHCPCD_IPV4LL;
 
diff --git a/src/if-options.c b/src/if-options.c
index 0213de75..f0165c13 100644
--- a/src/if-options.c
+++ b/src/if-options.c
@@ -2062,7 +2062,7 @@ err_sla:
 		ifo->auth.options &= ~DHCPCD_AUTH_REQUIRE;
 		break;
 	case O_DHCP:
-		ifo->options |= DHCPCD_DHCP | DHCPCD_IPV4;
+		ifo->options |= DHCPCD_DHCP | DHCPCD_WANTDHCP | DHCPCD_IPV4;
 		break;
 	case O_NODHCP:
 		ifo->options &= ~DHCPCD_DHCP;
diff --git a/src/if-options.h b/src/if-options.h
index 4f720d32..d0eb764a 100644
--- a/src/if-options.h
+++ b/src/if-options.h
@@ -110,7 +110,7 @@
 #define DHCPCD_DHCP6			(1ULL << 50)
 #define DHCPCD_IF_UP			(1ULL << 51)
 #define DHCPCD_INFORM6			(1ULL << 52)
-// unused				(1ULL << 53)
+#define DHCPCD_WANTDHCP			(1ULL << 53)
 #define DHCPCD_IPV6RA_AUTOCONF		(1ULL << 54)
 #define DHCPCD_ROUTER_HOST_ROUTE_WARNED	(1ULL << 55)
 #define DHCPCD_LASTLEASE_EXTEND		(1ULL << 56)
diff --git a/src/if.c b/src/if.c
index fe84a882..857294ef 100644
--- a/src/if.c
+++ b/src/if.c
@@ -528,6 +528,9 @@ if_discover(struct dhcpcd_ctx *ctx, struct ifaddrs **ifaddrs,
 			    ctx->ifac == 0 && !if_hasconf(ctx, ifp->name))
 				active = IF_INACTIVE;
 			switch (ifp->family) {
+#ifdef ARPHRD_NETROM
+			case ARPHRD_NETROM:
+#endif
 			case ARPHRD_IEEE1394:
 			case ARPHRD_INFINIBAND:
 #ifdef ARPHRD_LOOPBACK

Follow-Ups:
Re: Support for "raw-ip" modeYegor Yefremov
References:
Support for "raw-ip" modeYegor Yefremov
Re: Support for "raw-ip" modeRoy Marples
Re: Support for "raw-ip" modeYegor Yefremov
Archive administrator: postmaster@marples.name