static void dhcp_decode(const struct bootp_t *bp, int *pmsg_type,

                        struct in_addr *preq_addr)

{

    const uint8_t *p, *p_end;

    int len, tag;



    *pmsg_type = 0;

    preq_addr->s_addr = htonl(0L);



    p = bp->bp_vend;

    p_end = p + DHCP_OPT_LEN;

    if (memcmp(p, rfc1533_cookie, 4) != 0)

        return;

    p += 4;

    while (p < p_end) {

        tag = p[0];

        if (tag == RFC1533_PAD) {

            p++;

        } else if (tag == RFC1533_END) {


        } else {

            p++;

            if (p >= p_end)


            len = *p++;




            DPRINTF("dhcp: tag=%d len=%d\n", tag, len);



            switch(tag) {

            case RFC2132_MSG_TYPE:

                if (len >= 1)

                    *pmsg_type = p[0];


            case RFC2132_REQ_ADDR:

                if (len >= 4) {

                    memcpy(&(preq_addr->s_addr), p, 4);



            default:



            p += len;



    if (*pmsg_type == DHCPREQUEST && preq_addr->s_addr == htonl(0L) &&

        bp->bp_ciaddr.s_addr) {

        memcpy(&(preq_addr->s_addr), &bp->bp_ciaddr, 4);


static void dhcp_decode(const struct bootp_t *bp, int *pmsg_type,

                        struct in_addr *preq_addr)

{

    const uint8_t *p, *p_end;

    int len, tag;



    *pmsg_type = 0;

    preq_addr->s_addr = htonl(0L);



    p = bp->bp_vend;

    p_end = p + DHCP_OPT_LEN;

    if (memcmp(p, rfc1533_cookie, 4) != 0)

        return;

    p += 4;

    while (p < p_end) {

        tag = p[0];

        if (tag == RFC1533_PAD) {

            p++;

        } else if (tag == RFC1533_END) {


        } else {

            p++;

            if (p >= p_end)


            len = *p++;




            DPRINTF("dhcp: tag=%d len=%d\n", tag, len);



            switch(tag) {

            case RFC2132_MSG_TYPE:

                if (len >= 1)

                    *pmsg_type = p[0];


            case RFC2132_REQ_ADDR:

                if (len >= 4) {

                    memcpy(&(preq_addr->s_addr), p, 4);



            default:



            p += len;



    if (*pmsg_type == DHCPREQUEST && preq_addr->s_addr == htonl(0L) &&

        bp->bp_ciaddr.s_addr) {

        memcpy(&(preq_addr->s_addr), &bp->bp_ciaddr, 4);


static void FUNC_0(const struct bootp_t *VAR_0, int *VAR_1,

                        struct in_addr *VAR_2)

{

    const uint8_t *VAR_3, *p_end;

    int VAR_4, VAR_5;



    *VAR_1 = 0;

    VAR_2->s_addr = htonl(0L);



    VAR_3 = VAR_0->bp_vend;

    p_end = VAR_3 + DHCP_OPT_LEN;

    if (memcmp(VAR_3, rfc1533_cookie, 4) != 0)

        return;

    VAR_3 += 4;

    while (VAR_3 < p_end) {

        VAR_5 = VAR_3[0];

        if (VAR_5 == RFC1533_PAD) {

            VAR_3++;

        } else if (VAR_5 == RFC1533_END) {


        } else {

            VAR_3++;

            if (VAR_3 >= p_end)


            VAR_4 = *VAR_3++;




            DPRINTF("dhcp: VAR_5=%d VAR_4=%d\n", VAR_5, VAR_4);



            switch(VAR_5) {

            case RFC2132_MSG_TYPE:

                if (VAR_4 >= 1)

                    *VAR_1 = VAR_3[0];


            case RFC2132_REQ_ADDR:

                if (VAR_4 >= 4) {

                    memcpy(&(VAR_2->s_addr), VAR_3, 4);



            default:



            VAR_3 += VAR_4;



    if (*VAR_1 == DHCPREQUEST && VAR_2->s_addr == htonl(0L) &&

        VAR_0->bp_ciaddr.s_addr) {

        memcpy(&(VAR_2->s_addr), &VAR_0->bp_ciaddr, 4);


static void FUNC_0(const struct bootp_t *VAR_0, int *VAR_1,
struct in_addr *VAR_2)
{ const uint8_t *VAR_3, *p_end; int VAR_4, VAR_5; *VAR_1 = 0; VAR_2->s_addr = htonl(0L); VAR_3 = VAR_0->bp_vend; p_end = VAR_3 + DHCP_OPT_LEN; if (memcmp(VAR_3, rfc1533_cookie, 4) != 0)
return; VAR_3 += 4; while (VAR_3 < p_end) { VAR_5 = VAR_3[0]; if (VAR_5 == RFC1533_PAD) { VAR_3++; } else if (VAR_5 == RFC1533_END) { } else { VAR_3++; if (VAR_3 >= p_end)
VAR_4 = *VAR_3++; DPRINTF("dhcp: VAR_5=%d VAR_4=%d\n", VAR_5, VAR_4); switch(VAR_5) { case RFC2132_MSG_TYPE:
if (VAR_4 >= 1)
*VAR_1 = VAR_3[0]; case RFC2132_REQ_ADDR:
if (VAR_4 >= 4) { memcpy(&(VAR_2->s_addr), VAR_3, 4); default:
VAR_3 += VAR_4; if (*VAR_1 == DHCPREQUEST && VAR_2->s_addr == htonl(0L) &&
VAR_0->bp_ciaddr.s_addr) { memcpy(&(VAR_2->s_addr), &VAR_0->bp_ciaddr, 4);