Deleted Added
full compact
rtquery.c (64526) rtquery.c (90868)
1/*-
2 * Copyright (c) 1982, 1986, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 16 unchanged lines hidden (view full) ---

25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
1/*-
2 * Copyright (c) 1982, 1986, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 16 unchanged lines hidden (view full) ---

25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * $FreeBSD: head/sbin/routed/rtquery/rtquery.c 50476 1999-08-28 00:22:10Z peter $
33 * $FreeBSD: head/sbin/routed/rtquery/rtquery.c 90868 2002-02-18 20:35:27Z mike $
34 */
35
36char copyright[] =
37"@(#) Copyright (c) 1982, 1986, 1993\n\
38 The Regents of the University of California. All rights reserved.\n";
39
40#include <sys/cdefs.h>
41#include <sys/param.h>

--- 735 unchanged lines hidden (view full) ---

777}
778
779
780/* Return the classical netmask for an IP address.
781 */
782static u_int
783std_mask(u_int addr) /* in network order */
784{
34 */
35
36char copyright[] =
37"@(#) Copyright (c) 1982, 1986, 1993\n\
38 The Regents of the University of California. All rights reserved.\n";
39
40#include <sys/cdefs.h>
41#include <sys/param.h>

--- 735 unchanged lines hidden (view full) ---

777}
778
779
780/* Return the classical netmask for an IP address.
781 */
782static u_int
783std_mask(u_int addr) /* in network order */
784{
785 NTOHL(addr); /* was a host, not a network */
785 addr = ntohl(addr); /* was a host, not a network */
786
787 if (addr == 0) /* default route has mask 0 */
788 return 0;
789 if (IN_CLASSA(addr))
790 return IN_CLASSA_NET;
791 if (IN_CLASSB(addr))
792 return IN_CLASSB_NET;
793 return IN_CLASSC_NET;

--- 26 unchanged lines hidden (view full) ---

820 mname++;
821 name = hname;
822 }
823
824 nentp = getnetbyname(name);
825 if (nentp != 0) {
826 in.s_addr = nentp->n_net;
827 } else if (inet_aton(name, &in) == 1) {
786
787 if (addr == 0) /* default route has mask 0 */
788 return 0;
789 if (IN_CLASSA(addr))
790 return IN_CLASSA_NET;
791 if (IN_CLASSB(addr))
792 return IN_CLASSB_NET;
793 return IN_CLASSC_NET;

--- 26 unchanged lines hidden (view full) ---

820 mname++;
821 name = hname;
822 }
823
824 nentp = getnetbyname(name);
825 if (nentp != 0) {
826 in.s_addr = nentp->n_net;
827 } else if (inet_aton(name, &in) == 1) {
828 NTOHL(in.s_addr);
828 in.s_addr = ntohl(in.s_addr);
829 } else {
830 return 0;
831 }
832
833 if (mname == 0) {
834 mask = std_mask(in.s_addr);
835 if ((~mask & in.s_addr) != 0)
836 mask = 0xffffffff;

--- 74 unchanged lines hidden ---
829 } else {
830 return 0;
831 }
832
833 if (mname == 0) {
834 mask = std_mask(in.s_addr);
835 if ((~mask & in.s_addr) != 0)
836 mask = 0xffffffff;

--- 74 unchanged lines hidden ---