freebsd-src/sbin/ipf/libipf/printlookup.c
Cy Schubert 41edb306f0 ipfilter: Move userland bits to sbin
Through fixes and improvements our ipfilter sources have diverged
enough to warrant move from contrib into sbin/ipf. Now that I'm
planning on implementing MSS clamping as in iptables it makes more
sense to move ipfilter to sbin.

This is the second of three commits of the ipfilter move.

Suggested by glebius on two occaions.

Suggested by and discussed with:	glebius
Reviewed by:				glebius, kp (for #network)
MFC after:				1 month
Differential Revision:		https://reviews.freebsd.org/D33510
2021-12-20 06:16:33 -08:00

43 lines
700 B
C

/*
* Copyright (C) 2012 by Darren Reed.
*
* See the IPFILTER.LICENCE file for details on licencing.
*
* $Id$
*/
#include "ipf.h"
void
printlookup(base, addr, mask)
char *base;
i6addr_t *addr, *mask;
{
char name[32];
switch (addr->iplookuptype)
{
case IPLT_POOL :
PRINTF("pool/");
break;
case IPLT_HASH :
PRINTF("hash/");
break;
case IPLT_DSTLIST :
PRINTF("dstlist/");
break;
default :
PRINTF("lookup(%x)=", addr->iplookuptype);
break;
}
if (addr->iplookupsubtype == 0)
PRINTF("%u", addr->iplookupnum);
else if (addr->iplookupsubtype == 1) {
strncpy(name, base + addr->iplookupname, sizeof(name));
name[sizeof(name) - 1] = '\0';
PRINTF("%s", name);
}
}