Re: Support for "raw-ip" mode
Roy Marples
Tue Aug 20 10:27:19 2019
On 20/08/2019 10:57, Yegor Yefremov wrote:
On Tue, Aug 20, 2019 at 11:34 AM Roy Marples <roy@xxxxxxxxxxxx> wrote:
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.
Thanks for the patch. Acquiring a DHCP lease is working now:
# dhcpcd -d wwan0
dhcpcd-8.0.2 starting
wwan0: executing `/lib/dhcpcd/dhcpcd-run-hooks' PREINIT
wwan0: executing `/lib/dhcpcd/dhcpcd-run-hooks' CARRIER
DUID 00:01:00:01:c7:92:bc:92:74:6a:8f:ff:50:55
wwan0: IAID 00:00:00:06
wwan0: delaying IPv6 router solicitation for 0.8 seconds
wwan0: using static address 10.42.112.218/30
wwan0: adding IP address 10.42.112.218/30 broadcast 10.42.112.218
arp_open: wwan0: Invalid argument
arp_announce: Invalid argument
wwan0: executing `/lib/dhcpcd/dhcpcd-run-hooks' STATIC
forking to background
forked to background, child pid 433
I've added these lines to the default /etc/dhcpcd.conf file:
interface wwan0 dhcp
debug
Though "debug" was ignored i.e. I had to specify it on the command line.
debug should appear at the top of dhcpcd.conf - it's not really
interface specific
Can I also specify "interface wwan0 dhcp" on the command line?
Should be able to
Is it OK that both arp_open and arp_announce fail?
No.
New patch (supercedes prior, or just apply the ipv4.c part) should
silence those errors.
Let me know!
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
diff --git a/src/ipv4.c b/src/ipv4.c
index c3cb0bfb..f5976618 100644
--- a/src/ipv4.c
+++ b/src/ipv4.c
@@ -742,7 +742,8 @@ ipv4_applyaddr(void *arg)
#ifdef ARP
/* Announce the preferred address to
* kick ARP caches. */
- arp_announceaddr(ifp->ctx, &lease->addr);
+ if (!(ifp->flags & IFF_NOARP))
+ arp_announceaddr(ifp->ctx,&lease->addr);
#endif
}
script_runreason(ifp, state->reason);
@@ -804,7 +805,8 @@ ipv4_applyaddr(void *arg)
rt_build(ifp->ctx, AF_INET);
#ifdef ARP
- arp_announceaddr(ifp->ctx, &state->addr->addr);
+ if (!(ifp->flags & IFF_NOARP))
+ arp_announceaddr(ifp->ctx, &state->addr->addr);
#endif
if (state->state == DHS_BOUND) {
Archive administrator: postmaster@marples.name