Lines Matching refs:p
161 * @param p the packet to forward
166 ip_canforward(struct pbuf *p)
170 if (p->flags & PBUF_FLAG_LLBCAST) {
174 if ((p->flags & PBUF_FLAG_LLMCAST) && !IP_MULTICAST(addr)) {
197 * @param p the packet to forward (p->payload points to IP header)
202 ip_forward(struct pbuf *p, struct ip_hdr *iphdr, struct netif *inp)
208 if (!ip_canforward(p)) {
246 icmp_time_exceeded(p, ICMP_TE_TTL);
269 if (netif->mtu && (p->tot_len > netif->mtu)) {
272 ip_frag(p, netif, ip_current_dest_addr());
278 icmp_dest_unreach(p, ICMP_DUR_FRAG);
283 netif->output(netif, p, ¤t_iphdr_dest);
299 * @param p the received IP packet (p->payload points to IP header)
305 ip_input(struct pbuf *p, struct netif *inp)
319 iphdr = (struct ip_hdr *)p->payload;
322 ip_debug_print(p);
323 pbuf_free(p);
331 if (LWIP_HOOK_IP4_INPUT(p, inp)) {
345 if ((iphdr_hlen > p->len) || (iphdr_len > p->tot_len)) {
346 if (iphdr_hlen > p->len) {
349 iphdr_hlen, p->len));
351 if (iphdr_len > p->tot_len) {
354 iphdr_len, p->tot_len));
357 pbuf_free(p);
370 ip_debug_print(p);
371 pbuf_free(p);
381 pbuf_realloc(p, iphdr_len);
480 pbuf_free(p);
496 ip_forward(p, iphdr, inp);
503 pbuf_free(p);
510 ntohs(IPH_ID(iphdr)), p->tot_len, ntohs(IPH_LEN(iphdr)), !!(IPH_OFFSET(iphdr) & PP_HTONS(IP_MF)), (ntohs(IPH_OFFSET(iphdr)) & IP_OFFMASK)*8));
512 p = ip_reass(p);
514 if (p == NULL) {
517 iphdr = (struct ip_hdr *)p->payload;
519 pbuf_free(p);
539 pbuf_free(p);
550 ip_debug_print(p);
551 LWIP_DEBUGF(IP_DEBUG, ("ip_input: p->len %"U16_F" p->tot_len %"U16_F"\n", p->len, p->tot_len));
558 if (raw_input(p, inp) == 0)
568 udp_input(p, inp);
574 tcp_input(p, inp);
580 icmp_input(p, inp);
585 igmp_input(p, inp, ¤t_iphdr_dest);
593 p->payload = iphdr;
594 icmp_dest_unreach(p, ICMP_DUR_PROTO);
597 pbuf_free(p);
620 * If the destination IP address is IP_HDRINCL, p is assumed to already
621 * include an IP header and p->payload points to it instead of the data.
623 * @param p the packet to send (p->payload points to the data, e.g. next
624 protocol header; if dest == IP_HDRINCL, p already includes an IP
625 header and p->payload points to that IP header)
634 * ERR_BUF if p doesn't have enough space for IP/LINK headers
641 ip_output_if(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
646 return ip_output_if_opt(p, src, dest, ttl, tos, proto, netif, NULL, 0);
655 err_t ip_output_if_opt(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
668 LWIP_ASSERT("p->ref == 1", p->ref == 1);
672 /* Should the IP header be generated or is it already included in p? */
685 if (pbuf_header(p, optlen_aligned)) {
691 MEMCPY(p->payload, ip_options, optlen);
694 memset(((char*)p->payload) + optlen, 0, optlen_aligned - optlen);
698 chk_sum += ((u16_t*)p->payload)[i];
704 if (pbuf_header(p, IP_HLEN)) {
712 iphdr = (struct ip_hdr *)p->payload;
714 (p->len >= sizeof(struct ip_hdr)));
734 IPH_LEN_SET(iphdr, htons(p->tot_len));
766 /* IP header already included in p */
767 iphdr = (struct ip_hdr *)p->payload;
775 ip_debug_print(p);
781 return netif_loop_output(netif, p, dest);
784 if ((p->flags & PBUF_FLAG_MCASTLOOP) != 0) {
785 netif_loop_output(netif, p, dest);
791 if (netif->mtu && (p->tot_len > netif->mtu)) {
792 return ip_frag(p, netif, dest);
797 return netif->output(netif, p, dest);
804 * @param p the packet to send (p->payload points to the data, e.g. next
805 protocol header; if dest == IP_HDRINCL, p already includes an IP
806 header and p->payload points to that IP header)
818 ip_output(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
825 LWIP_ASSERT("p->ref == 1", p->ref == 1);
834 return ip_output_if(p, src, dest, ttl, tos, proto, netif);
841 * @param p the packet to send (p->payload points to the data, e.g. next
842 protocol header; if dest == IP_HDRINCL, p already includes an IP
843 header and p->payload points to that IP header)
857 ip_output_hinted(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
865 LWIP_ASSERT("p->ref == 1", p->ref == 1);
875 err = ip_output_if(p, src, dest, ttl, tos, proto, netif);
884 * @param p an IP packet, p->payload pointing to the IP header
887 ip_debug_print(struct pbuf *p)
889 struct ip_hdr *iphdr = (struct ip_hdr *)p->payload;