1145519Sdarrenr/* $FreeBSD$ */ 2145510Sdarrenr 3145510Sdarrenr/* 4255332Scy * Copyright (C) 2012 by Darren Reed. 5145510Sdarrenr * 6145510Sdarrenr * See the IPFILTER.LICENCE file for details on licencing. 7145510Sdarrenr * 8255332Scy * $Id$ 9145510Sdarrenr */ 10145510Sdarrenr 11145510Sdarrenr#include "ipf.h" 12145510Sdarrenr 13145510Sdarrenr 14255332Scyvoid 15255332Scyprintmask(family, mask) 16255332Scy int family; 17255332Scy u_32_t *mask; 18145510Sdarrenr{ 19145510Sdarrenr struct in_addr ipa; 20145510Sdarrenr int ones; 21145510Sdarrenr 22255332Scy if (family == AF_INET6) { 23255332Scy PRINTF("/%d", count6bits(mask)); 24255332Scy } else if ((ones = count4bits(*mask)) == -1) { 25145510Sdarrenr ipa.s_addr = *mask; 26255332Scy PRINTF("/%s", inet_ntoa(ipa)); 27255332Scy } else { 28255332Scy PRINTF("/%d", ones); 29255332Scy } 30145510Sdarrenr} 31