[SLOF] [PATCH 5/7] net-snk: Make use of DHCPv6 transaction IDs

Thomas Huth thuth at redhat.com
Tue Dec 22 05:58:17 AEDT 2015


On 21/12/15 16:55, Stefan Berger wrote:
> On 12/17/2015 03:18 PM, Thomas Huth wrote:
>> Generate a proper transaction ID before sending DHCPv6 packets
>> and check whether the DHCPv6 replies contain that correct XID, too.
>>
>> Signed-off-by: Thomas Huth <thuth at redhat.com>
>> ---
>>   clients/net-snk/app/netapps/netboot.c |  3 +++
>>   clients/net-snk/app/netlib/dhcpv6.c   | 17 +++++++++--------
>>   clients/net-snk/app/netlib/dhcpv6.h   |  1 +
>>   3 files changed, 13 insertions(+), 8 deletions(-)
>>
>> diff --git a/clients/net-snk/app/netapps/netboot.c
>> b/clients/net-snk/app/netapps/netboot.c
>> index 51189c4..d51d5a8 100644
>> --- a/clients/net-snk/app/netapps/netboot.c
>> +++ b/clients/net-snk/app/netapps/netboot.c
>> @@ -332,6 +332,9 @@ int dhcp(char *ret_buffer, filename_ip_t * fn_ip,
>> unsigned int retries, int flag
>>       int i = (int) retries+1;
>>       int rc = -1;
>>   +    if (flags != F_IPV4)
>> +        dhcpv6_generate_transaction_id();
> 
> Why not flags == F_IPV6 ? The rest of the function seems to test like
> this as well.

The dhcp() function can also be called with flags == 0 ... in that case,
both, DHCPv4 and DHCPv6 are tried. So the only case where we don't need
the DHCPv6 transaction ID is when using IPv4 only, i.e. when flags ==
F_IPV4.

[...]
>> b/clients/net-snk/app/netlib/dhcpv6.h
>> index 078a9f1..dcda9b1 100644
>> --- a/clients/net-snk/app/netlib/dhcpv6.h
>> +++ b/clients/net-snk/app/netlib/dhcpv6.h
>> @@ -77,6 +77,7 @@
>>   #define DUID_LL        3 /* DUID based on Link-layer Address */
>>     /* Prototypes */
>> +void dhcpv6_generate_transaction_id(void);
>>   int32_t dhcpv6 ( char *ret_buffer, void *fn_ip);
>>   uint32_t handle_dhcpv6(uint8_t * , int32_t);
>>   
> 
>     The rest looks good to me.

Thanks for the review!

 Thomas



More information about the SLOF mailing list