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

Attachment: 0001-fix-dhcpd-warning.patch
Description: Binary data

_______________________________________________
Toybox mailing list
[email protected]
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to