On Mon 12.02.18 13:48, Daniel Wagner wrote:
>> Maybe you can start with the current structure and see if it fits or
>> not. Don't hesitate to post early draft versions of the code if you need
>> feedback. It is always a bit difficult to give good advice without
>> looking at real code.
> Ok, I will try to make a proposition. But it has to be more general than only
> for dhcp. Also for static ipv4.
Ah, that explains it. Yes, then it makes sense to move the ipv4ll to src.
what I understood is that ipv4ll is ACD with a random ip address. Further, ACD
has also as fallback to assign an ipv4ll address. And ACD (if enabled) has also
to be done for static ipv4 configurations. So ACD and ipv4ll should be
independent from dhcp.
The problem is that the current implementation mixes ipv4ll with dhcp. The code
is in gdhcp/client.c. All ipv4ll functions use struct GDHCPClient, the enum
GDHCPClientEvent mixes dhcp events with ipv4ll events, and so on.
I see two solutions:
(A) Split up client.c, also GDHCPClient and what ever. The goal would be to
seperate DHCP, ACD, ipv4ll, ARP. Where ipv4ll is a special case of ACD.
DHCP and ACD use ipv4ll as fallback. ARP is a small utility lib which is
used by ACD.
This might look not so bad but the drawback is a big change, lots of testing.
So high risk.
(B) Or I use the current ipv4ll as reference to implement ACD (in include/src),
make a new ipv4ll based on the new ACD which is independent from dhcp.
My plan is to start with (B) and if it works and the code looks good, then maybe
solution (A) becomes closer and easier. So after (B) works we could discuss how
to refactor until we have (A) or something closer to (A).