[Toybox] fix dhcpd warning patch

Yeongdeok Suh skyducks111 at gmail.com
Fri Oct 23 02:14:24 PDT 2015


I fixed warning when building dhcpd.c.

I modified some ipv6 packet structs using flexible array.

@@ -218,28 +217,28 @@ struct __attribute__((packed)) optval_duid_llt {
>    uint16_t type;
>    uint16_t hwtype;
>    uint32_t time;
> -  uint8_t *lladdr;
> +  uint8_t lladdr[];   //flexible
>  };



And the port numbers were hard-coded with default numbers, (ipv4: 67, ipv6
547)
so -P [port_num] option was not work. I fixed it too.

@@ -962,9 +934,10 @@ static int send_packet(uint8_t broadcast)
>    padding = 308 - 1 - dhcp_opt_size(gstate.send.send_pkt.options);
>    packet.iph.protocol = IPPROTO_UDP;
>    packet.iph.saddr = gconfig.server_nip;
> -  packet.iph.daddr = (broadcast || (gstate.rcvd.rcvd_pkt.ciaddr ==
> 0))?INADDR_BROADCAST:gstate.rcvd.rcvd_pkt.ciaddr;
> -  packet.udph.source = htons(67);//SERVER_PORT
> -  packet.udph.dest = htons(68); //CLIENT_PORT
> +  packet.iph.daddr = (broadcast || (gstate.rcvd.rcvd_pkt.ciaddr == 0))?
> +    INADDR_BROADCAST : gstate.rcvd.rcvd_pkt.ciaddr;
> +  packet.udph.source = htons(gconfig.port);//SERVER_PORT
> +  packet.udph.dest = gstate.client_port; //CLIENT_PORT
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20151023/1b013976/attachment-0003.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-fix-dhcpd-warning.patch
Type: application/octet-stream
Size: 27058 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20151023/1b013976/attachment-0004.obj>


More information about the Toybox mailing list