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