#include #include // ntoh... & hton... #include #include // // the original header uses // unsigned int ihl:4; // unsigned int version:4; // struct my_iphdr { #if __BYTE_ORDER == __LITTLE_ENDIAN u_int8_t ihl:4; u_int8_t version:4; #elif __BYTE_ORDER == __BIG_ENDIAN u_int8_t version:4; u_int8_t ihl:4; #else # error "Please fix " #endif u_int8_t tos; u_int16_t tot_len; u_int16_t id; u_int16_t frag_off; u_int8_t ttl; u_int8_t protocol; u_int16_t check; u_int32_t saddr; u_int32_t daddr; /*The options start here. */ }__attribute__((__packed__)); void printbuf(u_int8_t *p,int len) { for (int i=0;i