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