1999-07-03 12:30:16 +00:00
|
|
|
/* $NetBSD: netof.c,v 1.4 1999/07/03 12:30:31 simonb Exp $ */
|
1998-01-09 03:15:09 +00:00
|
|
|
|
1999-07-03 12:30:16 +00:00
|
|
|
/*
|
1997-04-18 13:22:49 +00:00
|
|
|
* 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_int32
|
|
|
|
netof(num)
|
|
|
|
u_int32 num;
|
|
|
|
{
|
|
|
|
register u_int32 netnum;
|
|
|
|
|
|
|
|
netnum = num;
|
|
|
|
if(IN_CLASSC(netnum))
|
|
|
|
netnum &= IN_CLASSC_NET;
|
|
|
|
else if (IN_CLASSB(netnum))
|
|
|
|
netnum &= IN_CLASSB_NET;
|
|
|
|
else /* treat all other like class A */
|
|
|
|
netnum &= IN_CLASSA_NET;
|
|
|
|
return netnum;
|
|
|
|
}
|