abhisg/nslookup

Error on armv4l & armv5l : cann't get correct ipv4 address

Opened this issue · 1 comments

Error on armv4l & armv5l : cann't get correct ipv4 address

/tmp # ./ns google.com 8.8.8.8
Resolving google.com
Sending Packet to 8.8.8.8
Querying done
Receiving answer...
Answer received
The server used is a non-authoritative server in the domain

The response contains :
1 Questions.
1 Answers.
0 Authoritative Servers.
0 Additional records.

Answer Records : 1
Name : google.com has IPv4 address : 200.14.0.0

Authoritive Records : 0

Additional Records : 0

// error: sizeof( struct R_DATA ) == 12 when on armv4 & armv5
#pragma pack(push, 1)
struct R_DATA /*RESOURCE RECORD DATA*/ {
    uint16_t type;
    uint16_t _class;
    uint32_t ttl;
    uint16_t data_len;
};
#pragma pack(pop)

** the correct code as below:**

struct R_DATA /*RESOURCE RECORD DATA*/ {
    uint16_t type;
    uint16_t _class;
    uint32_t ttl;
    uint16_t data_len;
}__attribute__((packed));