Esempio n. 1
0
void
sl_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
{
        register u_int caplen = h->caplen;
        register u_int length = h->len;
        register const struct ip *ip;

        ts_print(&h->ts);

        if (caplen < SLIP_HDRLEN) {
                printf("[|slip]");
                goto out;
        }
        /*
         * Some printers want to get back at the link level addresses,
         * and/or check that they're not walking off the end of the packet.
         * Rather than pass them all the way down, we set these globals.
         */
        packetp = p;
        snapend = p + caplen;

        length -= SLIP_HDRLEN;

        ip = (struct ip *)(p + SLIP_HDRLEN);

        if (eflag)
                sliplink_print(p, ip, length);

        ip_print((u_char *)ip, length);

        if (xflag)
                default_print((u_char *)ip, caplen - SLIP_HDRLEN);
 out:
        putchar('\n');
}
Esempio n. 2
0
u_int
sl_bsdos_if_print(const struct pcap_pkthdr *h, const u_char *p)
{
	register u_int caplen = h->caplen;
	register u_int length = h->len;
	register const struct ip *ip;

	if (caplen < SLIP_HDRLEN) {
		printf("[|slip]");
		return (caplen);
	}

	length -= SLIP_HDRLEN;

	ip = (struct ip *)(p + SLIP_HDRLEN);

#ifdef notdef
	if (eflag)
		sliplink_print(p, ip, length);
#endif

	ip_print(gndo, (u_char *)ip, length);

	return (SLIP_HDRLEN);
}
Esempio n. 3
0
u_int
sl_bsdos_if_print(netdissect_options *ndo,
                  const struct pcap_pkthdr *h, const u_char *p)
{
	register u_int caplen = h->caplen;
	register u_int length = h->len;
	register const struct ip *ip;

	if (caplen < SLIP_HDRLEN) {
		ND_PRINT((ndo, "%s", tstr));
		return (caplen);
	}

	length -= SLIP_HDRLEN;

	ip = (struct ip *)(p + SLIP_HDRLEN);

#ifdef notdef
	if (ndo->ndo_eflag)
		sliplink_print(ndo, p, ip, length);
#endif

	ip_print(ndo, (u_char *)ip, length);

	return (SLIP_HDRLEN);
}
Esempio n. 4
0
u_int
sl_if_print(const struct pcap_pkthdr *h, const u_char *p)
{
	register u_int caplen = h->caplen;
	register u_int length = h->len;
	register const struct ip *ip;

	if (caplen < SLIP_HDRLEN) {
		printf("[|slip]");
		return (caplen);
	}

	length -= SLIP_HDRLEN;

	ip = (struct ip *)(p + SLIP_HDRLEN);

	if (eflag)
		sliplink_print(p, ip, length);

	switch (IP_V(ip)) {
	case 4:
	        ip_print(gndo, (u_char *)ip, length);
		break;
#ifdef INET6
	case 6:
		ip6_print((u_char *)ip, length);
		break;
#endif
	default:
		printf ("ip v%d", IP_V(ip));
	}

	return (SLIP_HDRLEN);
}
Esempio n. 5
0
u_int
sl_if_print(netdissect_options *ndo,
            const struct pcap_pkthdr *h, const u_char *p)
{
	register u_int caplen = h->caplen;
	register u_int length = h->len;
	register const struct ip *ip;

	if (caplen < SLIP_HDRLEN || length < SLIP_HDRLEN) {
		ND_PRINT((ndo, "%s", tstr));
		return (caplen);
	}

	length -= SLIP_HDRLEN;

	ip = (struct ip *)(p + SLIP_HDRLEN);

	if (ndo->ndo_eflag)
		sliplink_print(ndo, p, ip, length);

	switch (IP_V(ip)) {
	case 4:
	        ip_print(ndo, (u_char *)ip, length);
		break;
	case 6:
		ip6_print(ndo, (u_char *)ip, length);
		break;
	default:
		ND_PRINT((ndo, "ip v%d", IP_V(ip)));
	}

	return (SLIP_HDRLEN);
}