Deleted Added
full compact
filter.c (37189) filter.c (40561)
1/*
2 * PPP Filter command Interface
3 *
4 * Written by Toshiharu OHNO (tony-o@iij.ad.jp)
5 *
6 * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd.
7 *
8 * Redistribution and use in source and binary forms are permitted
9 * provided that the above copyright notice and this paragraph are
10 * duplicated in all such forms and that any documentation,
11 * advertising materials, and other materials related to such
12 * distribution and use acknowledge that the software was developed
13 * by the Internet Initiative Japan. The name of the
14 * IIJ may not be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 *
1/*
2 * PPP Filter command Interface
3 *
4 * Written by Toshiharu OHNO (tony-o@iij.ad.jp)
5 *
6 * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd.
7 *
8 * Redistribution and use in source and binary forms are permitted
9 * provided that the above copyright notice and this paragraph are
10 * duplicated in all such forms and that any documentation,
11 * advertising materials, and other materials related to such
12 * distribution and use acknowledge that the software was developed
13 * by the Internet Initiative Japan. The name of the
14 * IIJ may not be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 *
20 * $Id: filter.c,v 1.24 1998/06/15 19:06:07 brian Exp $
20 * $Id: filter.c,v 1.25 1998/06/27 12:03:48 brian Exp $
21 *
22 * TODO: Shoud send ICMP error message when we discard packets.
23 */
24
25#include <sys/types.h>
26#include <netinet/in.h>
27#include <arpa/inet.h>
28#include <netdb.h>

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

85 }
86
87 if (pmask)
88 pmask->s_addr = INADDR_BROADCAST; /* Assume 255.255.255.255 as default */
89
90 cp = pmask || pwidth ? strchr(*argv, '/') : NULL;
91 len = cp ? cp - *argv : strlen(*argv);
92
21 *
22 * TODO: Shoud send ICMP error message when we discard packets.
23 */
24
25#include <sys/types.h>
26#include <netinet/in.h>
27#include <arpa/inet.h>
28#include <netdb.h>

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

85 }
86
87 if (pmask)
88 pmask->s_addr = INADDR_BROADCAST; /* Assume 255.255.255.255 as default */
89
90 cp = pmask || pwidth ? strchr(*argv, '/') : NULL;
91 len = cp ? cp - *argv : strlen(*argv);
92
93 if (strncasecmp(*argv, "HISADDR", len) == 0)
93 if (ipcp && strncasecmp(*argv, "HISADDR", len) == 0)
94 *paddr = ipcp->peer_ip;
94 *paddr = ipcp->peer_ip;
95 else if (strncasecmp(*argv, "MYADDR", len) == 0)
95 else if (ipcp && strncasecmp(*argv, "MYADDR", len) == 0)
96 *paddr = ipcp->my_ip;
97 else if (len > 15)
98 log_Printf(LogWARN, "ParseAddr: %s: Bad address\n", *argv);
99 else {
100 char s[16];
101 strncpy(s, *argv, len);
102 s[len] = '\0';
103 if (inet_aton(s, paddr) == 0) {

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

116 bits = 0;
117 else
118 /* If a valid IP is given without a width, assume 32 bits */
119 bits = 32;
120
121 if (pwidth)
122 *pwidth = bits;
123
96 *paddr = ipcp->my_ip;
97 else if (len > 15)
98 log_Printf(LogWARN, "ParseAddr: %s: Bad address\n", *argv);
99 else {
100 char s[16];
101 strncpy(s, *argv, len);
102 s[len] = '\0';
103 if (inet_aton(s, paddr) == 0) {

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

116 bits = 0;
117 else
118 /* If a valid IP is given without a width, assume 32 bits */
119 bits = 32;
120
121 if (pwidth)
122 *pwidth = bits;
123
124 if (pmask)
125 pmask->s_addr = htonl(netmasks[bits]);
124 if (pmask) {
125 if (paddr->s_addr == INADDR_ANY)
126 pmask->s_addr = INADDR_ANY;
127 else
128 pmask->s_addr = htonl(netmasks[bits]);
129 }
126
127 return (1);
128}
129
130static int
131ParsePort(const char *service, int proto)
132{
133 const char *protocol_name;

--- 400 unchanged lines hidden ---
130
131 return (1);
132}
133
134static int
135ParsePort(const char *service, int proto)
136{
137 const char *protocol_name;

--- 400 unchanged lines hidden ---