Example #1
0
/*
 * ICMP entry point with an IP packet pkt and the destination dest a reply
 * should be sent to.
 */
void
__icmp_handler(pktbuf_t *pkt, ip_route_t *dest)
{
    (*icmp_handler)(pkt, dest);

    BSPLOG(bsp_log("icmp: dest[%s] type[%d] seq[%d]\n",
		   inet_ntoa(pkt->ip_hdr->destination),
		   pkt->icmp_hdr->type,
		   pkt->icmp_hdr->seqnum));
    __pktbuf_free(pkt);
}
Example #2
0
/*
 * free a pktbuf.
 */
void
__pktbuf_free(pktbuf_t *pkt)
{
#if BUFF_STATS
    --num_alloc;
#endif
#ifdef BSP_LOG
    {
	int i;
	word *p;

	for (i = 0; i < MAX_PKTBUF; i++) {
	    p = bufdata[i];
	    if ((((unsigned long)p) & 2) == 0)
		++p;
	    if (p == (word *)pkt)
		break;
	}
	if (i < MAX_PKTBUF) {
	    BSPLOG(bsp_log("__pktbuf_free: bad pkt[%x].\n", pkt));
	    BSPLOG(while(1));
	}
    }