Lines Matching refs:p
65 static void icmp_send_response(struct pbuf *p, u8_t type, u8_t code);
73 * @param p the icmp echo request packet, p->payload pointing to the ip header
77 icmp_input(struct pbuf *p, struct netif *inp)
91 iphdr = (struct ip_hdr *)p->payload;
93 if (pbuf_header(p, -hlen) || (p->tot_len < sizeof(u16_t)*2)) {
94 LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: short ICMP (%"U16_F" bytes) received\n", p->tot_len));
98 type = *((u8_t *)p->payload);
100 code = *(((u8_t *)p->payload)+1);
127 pbuf_free(p);
133 if (p->tot_len < sizeof(struct icmp_echo_hdr)) {
137 if (inet_chksum_pbuf(p) != 0) {
139 pbuf_free(p);
145 if (pbuf_header(p, (PBUF_IP_HLEN + PBUF_LINK_HLEN))) {
146 /* p is not big enough to contain link headers
147 * allocate a new one and copy p into it
150 /* switch p->payload to ip header */
151 if (pbuf_header(p, hlen)) {
152 LWIP_ASSERT("icmp_input: moving p->payload to ip header failed\n", 0);
156 r = pbuf_alloc(PBUF_LINK, p->tot_len, PBUF_RAM);
164 if (pbuf_copy(r, p) != ERR_OK) {
171 LWIP_ASSERT("icmp_input: restoring original p->payload failed\n", 0);
174 /* free the original p */
175 pbuf_free(p);
176 /* we now have an identical copy of p that has room for link headers */
177 p = r;
179 /* restore p->payload to point to icmp header */
180 if (pbuf_header(p, -(s16_t)(PBUF_IP_HLEN + PBUF_LINK_HLEN))) {
181 LWIP_ASSERT("icmp_input: restoring original p->payload failed\n", 0);
189 iecho = (struct icmp_echo_hdr *)p->payload;
217 if(pbuf_header(p, hlen)) {
222 ret = ip_output_if(p, ip_current_dest_addr(), IP_HDRINCL,
235 pbuf_free(p);
238 pbuf_free(p);
244 pbuf_free(p);
256 * @param p the input packet for which the 'unreachable' should be sent,
257 * p->payload pointing to the IP header
261 icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t)
263 icmp_send_response(p, ICMP_DUR, t);
270 * @param p the input packet for which the 'time exceeded' should be sent,
271 * p->payload pointing to the IP header
275 icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t)
277 icmp_send_response(p, ICMP_TE, t);
285 * @param p the input packet for which the 'unreachable' should be sent,
286 * p->payload pointing to the IP header
291 icmp_send_response(struct pbuf *p, u8_t type, u8_t code)
309 iphdr = (struct ip_hdr *)p->payload;
323 SMEMCPY((u8_t *)q->payload + sizeof(struct icmp_echo_hdr), (u8_t *)p->payload,