xref: /freebsd/sbin/ipf/libipf/getsumd.c (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
1 
2 /*
3  * Copyright (C) 2012 by Darren Reed.
4  *
5  * See the IPFILTER.LICENCE file for details on licencing.
6  *
7  * $Id$
8  */
9 
10 #include "ipf.h"
11 
12 char *
13 getsumd(u_32_t sum)
14 {
15 	static char sumdbuf[17];
16 
17 	if (sum & NAT_HW_CKSUM)
18 		snprintf(sumdbuf, sizeof(sumdbuf), "hw(%#0x)", sum & 0xffff);
19 	else
20 		snprintf(sumdbuf, sizeof(sumdbuf), "%#0x", sum);
21 	return (sumdbuf);
22 }
23