qmicli working for EM7455

Bjørn Mork bjorn at mork.no
Tue Mar 31 08:10:06 UTC 2020


Aleksander Morgado <aleksander at aleksander.es> writes:

> I'm a bit surprised that you can have DHCP running on the MC7455 while
> in QMI raw-ip mode on a standard Debian. Is that really so? which DHCP
> client are you using?

I assume that must be the internal one in systemd-networkd?  It's not
like systemd allows you to configure any external one.

Anyway, I was also surprised, but thought that the systemd developers
actually might have learned something from others for once, instead of
repeating every mistake throught history.

Looking at 
https://github.com/systemd/systemd/blob/master/src/network/networkd-link.c#L2833
they call

        dhcp4_configure(link);

if dhcp is enabled on a link.  And looking further at
https://github.com/systemd/systemd/blob/master/src/network/networkd-dhcp4.c#L1324
we see stuff like

        r = sd_dhcp_client_set_mac(link->dhcp_client,
                                   (const uint8_t *) &link->mac,
                                   sizeof (link->mac), ARPHRD_ETHER);
        if (r < 0)
                return log_link_error_errno(link, r, "DHCP4 CLIENT: Failed to set MAC address: %m");


which shows that ARPHRD_ETHER is hardcoded, making it appear to be the
only supported interface type.

But i wonder if this hardcoding might (accidentally?) make the dhcp
client work anyway.  Since they force the type to ethernet, and pick up
the "mac address" from somewhere else (config or port-name-guessorama),
then this could still work for raw-ip.

I also noticed a few "raw_socket" calls in networkd-dhcp4.c but looking
at
https://github.com/systemd/systemd/blob/master/src/libsystemd-network/dhcp-network.c
they document support for 0 byte addresses in the BPF filter they use:

                BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, dhcp_hlen, 1, 0),                  /* address length == dhcp_hlen ? */
                BPF_STMT(BPF_RET + BPF_K, 0),                                          /* ignore */

                /* We only support MAC address length to be either 0 or 6 (ETH_ALEN). Optionally
                 * compare chaddr for ETH_ALEN bytes. */
                BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, ETH_ALEN, 0, 12),                                  /* A (the MAC address length) == ETH_ALEN ? */


I stopped reading there.  Following this magic around is too complicated
for me.  The "ARPHRD_ETHER" faking all the way didn't make it any
simpler.. It was actually easier to add raw-ip support in the ISC client
than making any sense out of this.

I'd be interested to know if it actually does work.  I don't see any
obvious way to test this dhcp client without losing all networking to
systemd.



Bjørn


More information about the libqmi-devel mailing list