Lines Matching refs:iphdr

769         struct ip_hdr *iphdr = (struct ip_hdr *)(p->payload + SIZEOF_ETH_HDR);
771 if(IPH_PROTO(iphdr) == IP_PROTO_UDP) {
772 struct udp_hdr *udphdr = (struct udp_hdr *)(p->payload + SIZEOF_ETH_HDR + (IPH_HL(iphdr) * 4));
848 struct ip_hdr *iphdr = (struct ip_hdr *)(inpkt->payload + SIZEOF_ETH_HDR);
850 assert(IPH_PROTO(iphdr) == IP_PROTO_UDP);
852 struct udp_hdr *udphdr = (struct udp_hdr *)(inpkt->payload + SIZEOF_ETH_HDR + (IPH_HL(iphdr) * 4));
853 size_t hdr_len = SIZEOF_ETH_HDR + (IPH_HL(iphdr) * 4) + sizeof(struct udp_hdr);
867 addr->sin_addr.s_addr = iphdr->src.addr;
914 struct ip_hdr *iphdr = (struct ip_hdr *)(inpkt->payload + SIZEOF_ETH_HDR);
916 uint16_t pkt_len = ntohs(IPH_LEN(iphdr));
917 uint8_t *payload = (void *)iphdr;
928 addr->sin_addr.s_addr = iphdr->src.addr;
957 struct ip_hdr *iphdr = (struct ip_hdr *)(inpkt->payload + SIZEOF_ETH_HDR);
958 assert(IPH_PROTO(iphdr) == IP_PROTO_TCP);
959 struct tcp_hdr *tcphdr = (struct tcp_hdr *)(inpkt->payload + SIZEOF_ETH_HDR + (IPH_HL(iphdr) * 4));
960 size_t hdr_len = SIZEOF_ETH_HDR + (IPH_HL(iphdr) * 4) + (TCPH_HDRLEN(tcphdr) * 4);
962 uint16_t pkt_len = htons(IPH_LEN(iphdr)) - (TCPH_HDRLEN(tcphdr) * 4) - (IPH_HL(iphdr) * 4);
1014 addr->sin_addr.s_addr = iphdr->src.addr;
2166 struct ip_hdr *iphdr = (struct ip_hdr *)(p->payload + SIZEOF_ETH_HDR);
2168 /* printf("%d: Is an IP packet, type %x\n", disp_get_core_id(), IPH_PROTO(iphdr)); */
2171 if(IPH_PROTO(iphdr) == IP_PROTO_ICMP) {
2224 if(IPH_PROTO(iphdr) != IP_PROTO_UDP && IPH_PROTO(iphdr) != IP_PROTO_TCP) {
2229 if(iphdr->dest.addr != arranet_myip) {
2236 if(IPH_PROTO(iphdr) == IP_PROTO_TCP) {
2243 if(IPH_PROTO(iphdr) == IP_PROTO_UDP) {
2244 struct udp_hdr *udphdr = (struct udp_hdr *)(p->payload + SIZEOF_ETH_HDR + (IPH_HL(iphdr) * 4));
2245 /* uint8_t *payload = p->payload + SIZEOF_ETH_HDR + (IPH_HL(iphdr) * 4) + sizeof(struct udp_hdr); */
2253 /* htonl(iphdr->dest.addr), htons(udphdr->dest)); */
2267 protocol_binary_request_no_extras *mypayload = (void *)p->payload + SIZEOF_ETH_HDR + (IPH_HL(iphdr) * 4) + sizeof(struct udp_hdr) + UDP_HEADLEN;
2273 if(IPH_PROTO(iphdr) == IP_PROTO_TCP) {
2274 struct tcp_hdr *tcphdr = (struct tcp_hdr *)(p->payload + SIZEOF_ETH_HDR + (IPH_HL(iphdr) * 4));
2282 /* htonl(iphdr->dest.addr), htonl(iphdr->src.addr), */
2291 sock->peer_addr.sin_addr.s_addr == iphdr->src.addr) {
2300 uint16_t pkt_len = htons(IPH_LEN(iphdr)) - (TCPH_HDRLEN(tcphdr) * 4) - (IPH_HL(iphdr) * 4);
2358 ph->ip.dest.addr = iphdr->src.addr;
2408 /* size_t psize = htons(iphdr->_len) - (TCPH_HDRLEN(tcphdr) * 4); */
2409 /* if(psize > IPH_HL(iphdr) * 4) { */
2419 htons(iphdr->_len) - (TCPH_HDRLEN(tcphdr) * 4) == IPH_HL(iphdr) * 4) {
2427 /* protocol_binary_request_no_extras *mypayload = (void *)p->payload + SIZEOF_ETH_HDR + (IPH_HL(iphdr) * 4) + sizeof(struct udp_hdr) + UDP_HEADLEN; */
2435 if(peers_get_from_ip(iphdr->src.addr) == NULL) {
2439 newpeer->ip = iphdr->src.addr;
2552 struct ip_hdr *iphdr = (struct ip_hdr *)(inpkt->payload + SIZEOF_ETH_HDR);
2553 assert(IPH_PROTO(iphdr) == IP_PROTO_TCP);
2554 struct tcp_hdr *tcphdr = (struct tcp_hdr *)(inpkt->payload + SIZEOF_ETH_HDR + (IPH_HL(iphdr) * 4));
2754 struct ip_hdr *iphdr = (struct ip_hdr *)(inpkt->payload + SIZEOF_ETH_HDR);
2755 assert(IPH_PROTO(iphdr) == IP_PROTO_TCP);
2756 struct tcp_hdr *tcphdr = (struct tcp_hdr *)(inpkt->payload + SIZEOF_ETH_HDR + (IPH_HL(iphdr) * 4));
2757 size_t hdr_len = SIZEOF_ETH_HDR + (IPH_HL(iphdr) * 4) + (TCPH_HDRLEN(tcphdr) * 4);
2759 uint16_t pkt_len = htons(IPH_LEN(iphdr)) - (TCPH_HDRLEN(tcphdr) * 4) - (IPH_HL(iphdr) * 4);