Lines Matching refs:iphdr
430 struct ip_hdr *iphdr = (struct ip_hdr *)(p->payload + SIZEOF_ETH_HDR);
432 printf("%d: Is an IP packet, type %x\n", disp_get_core_id(), IPH_PROTO(iphdr));
435 if(IPH_PROTO(iphdr) != IP_PROTO_UDP && IPH_PROTO(iphdr) != IP_PROTO_TCP) {
440 if(iphdr->dest.addr != arranet_myip) {
444 if(IPH_PROTO(iphdr) == IP_PROTO_UDP) {
445 struct udp_hdr *udphdr = (struct udp_hdr *)(p->payload + SIZEOF_ETH_HDR + (IPH_HL(iphdr) * 4));
446 uint8_t *payload = p->payload + SIZEOF_ETH_HDR + (IPH_HL(iphdr) * 4) + sizeof(struct udp_hdr);
449 htonl(iphdr->dest.addr), htons(udphdr->dest));
462 struct udp_hdr *myudp = (struct udp_hdr *)(outp->payload + SIZEOF_ETH_HDR + (IPH_HL(iphdr) * 4));
463 uint8_t *mypayload = outp->payload + SIZEOF_ETH_HDR + (IPH_HL(iphdr) * 4) + sizeof(struct udp_hdr);
471 memcpy(myip, iphdr, sizeof(struct ip_hdr));
472 memcpy(&myip->src, &iphdr->dest, sizeof(ip_addr_p_t));
473 memcpy(&myip->dest, &iphdr->src, sizeof(ip_addr_p_t));
490 if(peers_get_from_ip(iphdr->src.addr) == NULL) {
493 newpeer->ip = iphdr->src.addr;