summaryrefslogtreecommitdiffstats
path: root/usr.sbin/xntpd/lib/netof.c
blob: 286a5846eb40dee65ab9ac231c2f211d68a3526e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* 
 * netof - return the net address part of an ip address
 *         (zero out host part)
 */
#include <stdio.h>

#include "ntp_fp.h"
#include "ntp_stdlib.h"

U_LONG
netof(num)
	U_LONG num;
{
	register U_LONG netnum;

	netnum = num;

	if(IN_CLASSC(netnum))
		netnum &= IN_CLASSC_NET;
	else if (IN_CLASSB(netnum))
		netnum &= IN_CLASSB_NET;
	else			/* treat als other like class A */
		netnum &= IN_CLASSA_NET;
	return netnum;
}
OpenPOWER on IntegriCloud