xref: /freebsd/sbin/ipf/libipf/getsumd.c (revision 22cf89c938886d14f5796fc49f9f020c23ea8eaf)
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