Need some help:
IP packet is getting corrupted!
CODE
struct uip_eth_addr {
u8_t addr[6];
};
struct uip_eth_hdr {
struct uip_eth_addr dest;
struct uip_eth_addr src;
u16_t type;
};
Does this struct look right?
CODE
struct ethip_hdr {
struct uip_eth_hdr ethhdr; //
/* IP header. */
u8_t vhl,
tos,
len[2],
ipid[2],
ipoffset[2],
ttl,
proto;
u16_t ipchksum;
u16_t srcipaddr[2],
destipaddr[2];
};
The ARP code checks to see if destination IP is broadcast or not.... It says it is not... but it IS.
The checking code is correct... But IPBUF->destipaddr[0]!=0xffff && IPBUF->destipaddr[0]!=0xffff !
#define BUF ((struct arp_hdr *)uip_buf)
#define IPBUF ((struct ethip_hdr *)uip_buf)
CODE
if(uip_ipaddr_cmp(IPBUF->destipaddr, broadcast_ipaddr)) {
dbgPrint("YES Broadcast Addr");
memcpy(IPBUF->ethhdr.dest.addr, broadcast_ethaddr.addr, 6);
} else {
// reaches here

dbgPrint("Not Broadcast Addr, Replacing IP packet with ARP request VERSION: %x %x:%x\n",IPBUF->vhl,IPBUF->destipaddr,IPBUF->destipaddr+1);
That was why it seemed to send Who is 0.0.16.240 Tell 0.0.0.0 and such crap... Which makes sense since it thinks it's not broadcast address.
THe linklevelheader length is 14; guessing it's right.
Openxdkman, Any ideas?