2001-06-13 21:52:19 +00:00
|
|
|
/*-
|
|
|
|
* Copyright (c) 1996 - 2001 Brian Somers <brian@Awfulhak.org>
|
|
|
|
* based on work by Toshiharu OHNO <tony-o@iij.ad.jp>
|
|
|
|
* Internet Initiative Japan, Inc (IIJ)
|
|
|
|
* All rights reserved.
|
1995-01-31 06:29:58 +00:00
|
|
|
*
|
2001-06-13 21:52:19 +00:00
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
1995-01-31 06:29:58 +00:00
|
|
|
*
|
2001-06-13 21:52:19 +00:00
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
1995-05-30 03:57:47 +00:00
|
|
|
*
|
1999-08-28 01:35:59 +00:00
|
|
|
* $FreeBSD$
|
1995-01-31 06:29:58 +00:00
|
|
|
*/
|
|
|
|
|
1999-01-28 01:56:34 +00:00
|
|
|
#include <sys/param.h>
|
1995-01-31 06:29:58 +00:00
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <arpa/inet.h>
|
1995-09-17 16:14:49 +00:00
|
|
|
#include <netdb.h>
|
1998-05-21 21:49:08 +00:00
|
|
|
#include <netinet/in_systm.h>
|
|
|
|
#include <netinet/ip.h>
|
|
|
|
#include <sys/un.h>
|
1997-10-26 01:04:02 +00:00
|
|
|
|
1995-01-31 06:29:58 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <strings.h>
|
1998-05-21 21:49:08 +00:00
|
|
|
#include <termios.h>
|
1997-10-26 01:04:02 +00:00
|
|
|
|
1999-05-08 11:07:56 +00:00
|
|
|
#include "layer.h"
|
1998-06-15 19:06:25 +00:00
|
|
|
#include "defs.h"
|
1995-01-31 06:29:58 +00:00
|
|
|
#include "command.h"
|
1997-06-09 03:27:43 +00:00
|
|
|
#include "mbuf.h"
|
|
|
|
#include "log.h"
|
1998-05-21 21:49:08 +00:00
|
|
|
#include "iplist.h"
|
|
|
|
#include "timer.h"
|
|
|
|
#include "throughput.h"
|
|
|
|
#include "lqr.h"
|
|
|
|
#include "hdlc.h"
|
|
|
|
#include "fsm.h"
|
|
|
|
#include "lcp.h"
|
|
|
|
#include "ccp.h"
|
|
|
|
#include "link.h"
|
|
|
|
#include "slcompress.h"
|
1997-06-28 01:34:03 +00:00
|
|
|
#include "ipcp.h"
|
1997-10-26 01:04:02 +00:00
|
|
|
#include "filter.h"
|
1998-05-21 21:49:08 +00:00
|
|
|
#include "descriptor.h"
|
|
|
|
#include "prompt.h"
|
|
|
|
#include "mp.h"
|
1999-01-28 01:56:34 +00:00
|
|
|
#ifndef NORADIUS
|
|
|
|
#include "radius.h"
|
|
|
|
#endif
|
1998-05-21 21:49:08 +00:00
|
|
|
#include "bundle.h"
|
1997-10-26 01:04:02 +00:00
|
|
|
|
1998-05-21 21:49:08 +00:00
|
|
|
static int filter_Nam2Proto(int, char const *const *);
|
|
|
|
static int filter_Nam2Op(const char *);
|
1995-01-31 06:29:58 +00:00
|
|
|
|
1998-06-27 12:03:50 +00:00
|
|
|
static const u_int32_t netmasks[33] = {
|
1997-08-25 00:29:32 +00:00
|
|
|
0x00000000,
|
|
|
|
0x80000000, 0xC0000000, 0xE0000000, 0xF0000000,
|
|
|
|
0xF8000000, 0xFC000000, 0xFE000000, 0xFF000000,
|
|
|
|
0xFF800000, 0xFFC00000, 0xFFE00000, 0xFFF00000,
|
|
|
|
0xFFF80000, 0xFFFC0000, 0xFFFE0000, 0xFFFF0000,
|
|
|
|
0xFFFF8000, 0xFFFFC000, 0xFFFFE000, 0xFFFFF000,
|
|
|
|
0xFFFFF800, 0xFFFFFC00, 0xFFFFFE00, 0xFFFFFF00,
|
|
|
|
0xFFFFFF80, 0xFFFFFFC0, 0xFFFFFFE0, 0xFFFFFFF0,
|
|
|
|
0xFFFFFFF8, 0xFFFFFFFC, 0xFFFFFFFE, 0xFFFFFFFF,
|
1995-01-31 06:29:58 +00:00
|
|
|
};
|
|
|
|
|
1999-01-28 01:56:34 +00:00
|
|
|
struct in_addr
|
|
|
|
bits2mask(int bits)
|
|
|
|
{
|
|
|
|
struct in_addr result;
|
|
|
|
|
|
|
|
result.s_addr = htonl(netmasks[bits]);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
1995-01-31 06:29:58 +00:00
|
|
|
int
|
1999-01-28 01:56:34 +00:00
|
|
|
ParseAddr(struct ipcp *ipcp, const char *data,
|
1998-05-21 21:49:08 +00:00
|
|
|
struct in_addr *paddr, struct in_addr *pmask, int *pwidth)
|
1995-01-31 06:29:58 +00:00
|
|
|
{
|
1997-11-22 03:37:54 +00:00
|
|
|
int bits, len;
|
|
|
|
char *wp;
|
|
|
|
const char *cp;
|
1995-01-31 06:29:58 +00:00
|
|
|
|
1997-12-13 02:37:33 +00:00
|
|
|
if (pmask)
|
1998-05-21 21:49:08 +00:00
|
|
|
pmask->s_addr = INADDR_BROADCAST; /* Assume 255.255.255.255 as default */
|
1997-12-13 02:37:33 +00:00
|
|
|
|
1999-01-28 01:56:34 +00:00
|
|
|
cp = pmask || pwidth ? strchr(data, '/') : NULL;
|
|
|
|
len = cp ? cp - data : strlen(data);
|
1997-11-22 03:37:54 +00:00
|
|
|
|
1999-01-28 01:56:34 +00:00
|
|
|
if (ipcp && strncasecmp(data, "HISADDR", len) == 0)
|
1998-05-21 21:49:08 +00:00
|
|
|
*paddr = ipcp->peer_ip;
|
1999-01-28 01:56:34 +00:00
|
|
|
else if (ipcp && strncasecmp(data, "MYADDR", len) == 0)
|
1998-05-21 21:49:08 +00:00
|
|
|
*paddr = ipcp->my_ip;
|
2000-03-14 01:47:27 +00:00
|
|
|
else if (ipcp && strncasecmp(data, "DNS0", len) == 0)
|
|
|
|
*paddr = ipcp->ns.dns[0];
|
|
|
|
else if (ipcp && strncasecmp(data, "DNS1", len) == 0)
|
|
|
|
*paddr = ipcp->ns.dns[1];
|
1997-11-22 03:37:54 +00:00
|
|
|
else {
|
2000-03-29 09:31:27 +00:00
|
|
|
char *s;
|
|
|
|
|
|
|
|
s = (char *)alloca(len + 1);
|
1999-01-28 01:56:34 +00:00
|
|
|
strncpy(s, data, len);
|
1997-11-22 03:37:54 +00:00
|
|
|
s[len] = '\0';
|
2000-03-29 09:31:27 +00:00
|
|
|
*paddr = GetIpAddr(s);
|
2000-03-31 14:31:36 +00:00
|
|
|
if (paddr->s_addr == INADDR_NONE) {
|
1998-05-21 21:49:08 +00:00
|
|
|
log_Printf(LogWARN, "ParseAddr: %s: Bad address\n", s);
|
1999-07-27 23:44:00 +00:00
|
|
|
return 0;
|
1997-11-22 03:37:54 +00:00
|
|
|
}
|
1997-10-23 10:09:35 +00:00
|
|
|
}
|
1997-11-22 03:37:54 +00:00
|
|
|
if (cp && *++cp) {
|
1995-01-31 06:29:58 +00:00
|
|
|
bits = strtol(cp, &wp, 0);
|
|
|
|
if (cp == wp || bits < 0 || bits > 32) {
|
1998-05-21 21:49:08 +00:00
|
|
|
log_Printf(LogWARN, "ParseAddr: bad mask width.\n");
|
1999-07-27 23:44:00 +00:00
|
|
|
return 0;
|
1995-01-31 06:29:58 +00:00
|
|
|
}
|
1998-05-21 21:49:08 +00:00
|
|
|
} else if (paddr->s_addr == INADDR_ANY)
|
|
|
|
/* An IP of 0.0.0.0 without a width is anything */
|
|
|
|
bits = 0;
|
|
|
|
else
|
|
|
|
/* If a valid IP is given without a width, assume 32 bits */
|
1995-01-31 06:29:58 +00:00
|
|
|
bits = 32;
|
1995-05-30 03:57:47 +00:00
|
|
|
|
1997-12-13 02:37:33 +00:00
|
|
|
if (pwidth)
|
|
|
|
*pwidth = bits;
|
|
|
|
|
1998-10-22 02:32:50 +00:00
|
|
|
if (pmask) {
|
|
|
|
if (paddr->s_addr == INADDR_ANY)
|
|
|
|
pmask->s_addr = INADDR_ANY;
|
|
|
|
else
|
1999-01-28 01:56:34 +00:00
|
|
|
*pmask = bits2mask(bits);
|
1998-10-22 02:32:50 +00:00
|
|
|
}
|
1995-01-31 06:29:58 +00:00
|
|
|
|
1999-07-27 23:44:00 +00:00
|
|
|
return 1;
|
1995-01-31 06:29:58 +00:00
|
|
|
}
|
|
|
|
|
1995-09-17 16:14:49 +00:00
|
|
|
static int
|
1997-11-22 03:37:54 +00:00
|
|
|
ParsePort(const char *service, int proto)
|
1995-09-17 16:14:49 +00:00
|
|
|
{
|
1997-11-22 03:37:54 +00:00
|
|
|
const char *protocol_name;
|
|
|
|
char *cp;
|
1995-09-17 16:14:49 +00:00
|
|
|
struct servent *servent;
|
|
|
|
int port;
|
|
|
|
|
|
|
|
switch (proto) {
|
2001-04-24 02:13:34 +00:00
|
|
|
case P_IPIP:
|
|
|
|
protocol_name = "ipip";
|
|
|
|
break;
|
1995-09-17 16:14:49 +00:00
|
|
|
case P_UDP:
|
|
|
|
protocol_name = "udp";
|
|
|
|
break;
|
|
|
|
case P_TCP:
|
|
|
|
protocol_name = "tcp";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
protocol_name = 0;
|
|
|
|
}
|
|
|
|
|
1997-08-25 00:29:32 +00:00
|
|
|
servent = getservbyname(service, protocol_name);
|
1995-09-17 16:14:49 +00:00
|
|
|
if (servent != 0)
|
1999-07-27 23:44:00 +00:00
|
|
|
return ntohs(servent->s_port);
|
1995-09-17 16:14:49 +00:00
|
|
|
|
|
|
|
port = strtol(service, &cp, 0);
|
|
|
|
if (cp == service) {
|
1998-05-21 21:49:08 +00:00
|
|
|
log_Printf(LogWARN, "ParsePort: %s is not a port name or number.\n",
|
1997-08-25 00:29:32 +00:00
|
|
|
service);
|
1999-07-27 23:44:00 +00:00
|
|
|
return 0;
|
1995-09-17 16:14:49 +00:00
|
|
|
}
|
1999-07-27 23:44:00 +00:00
|
|
|
return port;
|
1995-09-17 16:14:49 +00:00
|
|
|
}
|
|
|
|
|
1995-01-31 06:29:58 +00:00
|
|
|
/*
|
|
|
|
* ICMP Syntax: src eq icmp_message_type
|
|
|
|
*/
|
|
|
|
static int
|
1998-05-21 21:49:08 +00:00
|
|
|
ParseIcmp(int argc, char const *const *argv, struct filterent *tgt)
|
1995-01-31 06:29:58 +00:00
|
|
|
{
|
|
|
|
int type;
|
|
|
|
char *cp;
|
|
|
|
|
|
|
|
switch (argc) {
|
|
|
|
case 0:
|
|
|
|
/* permit/deny all ICMP types */
|
1999-07-27 23:44:00 +00:00
|
|
|
tgt->f_srcop = OP_NONE;
|
1995-01-31 06:29:58 +00:00
|
|
|
break;
|
1998-05-21 21:49:08 +00:00
|
|
|
|
1995-01-31 06:29:58 +00:00
|
|
|
case 3:
|
1997-10-26 01:04:02 +00:00
|
|
|
if (!strcmp(*argv, "src") && !strcmp(argv[1], "eq")) {
|
1995-01-31 06:29:58 +00:00
|
|
|
type = strtol(argv[2], &cp, 0);
|
|
|
|
if (cp == argv[2]) {
|
1998-05-21 21:49:08 +00:00
|
|
|
log_Printf(LogWARN, "ParseIcmp: type is expected.\n");
|
1999-07-27 23:44:00 +00:00
|
|
|
return 0;
|
1995-01-31 06:29:58 +00:00
|
|
|
}
|
1999-07-27 23:44:00 +00:00
|
|
|
tgt->f_srcop = OP_EQ;
|
|
|
|
tgt->f_srcport = type;
|
1995-01-31 06:29:58 +00:00
|
|
|
}
|
|
|
|
break;
|
1998-05-21 21:49:08 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
log_Printf(LogWARN, "ParseIcmp: bad icmp syntax.\n");
|
1999-07-27 23:44:00 +00:00
|
|
|
return 0;
|
1995-01-31 06:29:58 +00:00
|
|
|
}
|
1999-07-27 23:44:00 +00:00
|
|
|
return 1;
|
1995-01-31 06:29:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* UDP Syntax: [src op port] [dst op port]
|
|
|
|
*/
|
|
|
|
static int
|
1998-05-21 21:49:08 +00:00
|
|
|
ParseUdpOrTcp(int argc, char const *const *argv, int proto,
|
|
|
|
struct filterent *tgt)
|
1995-01-31 06:29:58 +00:00
|
|
|
{
|
1999-07-27 23:44:00 +00:00
|
|
|
tgt->f_srcop = tgt->f_dstop = OP_NONE;
|
|
|
|
tgt->f_estab = tgt->f_syn = tgt->f_finrst = 0;
|
1997-10-23 10:09:35 +00:00
|
|
|
|
1997-10-26 01:04:02 +00:00
|
|
|
if (argc >= 3 && !strcmp(*argv, "src")) {
|
1999-07-27 23:44:00 +00:00
|
|
|
tgt->f_srcop = filter_Nam2Op(argv[1]);
|
|
|
|
if (tgt->f_srcop == OP_NONE) {
|
1998-05-21 21:49:08 +00:00
|
|
|
log_Printf(LogWARN, "ParseUdpOrTcp: bad operation\n");
|
1999-07-27 23:44:00 +00:00
|
|
|
return 0;
|
1995-01-31 06:29:58 +00:00
|
|
|
}
|
1999-07-27 23:44:00 +00:00
|
|
|
tgt->f_srcport = ParsePort(argv[2], proto);
|
|
|
|
if (tgt->f_srcport == 0)
|
|
|
|
return 0;
|
1997-08-25 00:29:32 +00:00
|
|
|
argc -= 3;
|
|
|
|
argv += 3;
|
1995-01-31 06:29:58 +00:00
|
|
|
}
|
1998-05-21 21:49:08 +00:00
|
|
|
|
1997-10-26 01:04:02 +00:00
|
|
|
if (argc >= 3 && !strcmp(argv[0], "dst")) {
|
1999-07-27 23:44:00 +00:00
|
|
|
tgt->f_dstop = filter_Nam2Op(argv[1]);
|
|
|
|
if (tgt->f_dstop == OP_NONE) {
|
1998-05-21 21:49:08 +00:00
|
|
|
log_Printf(LogWARN, "ParseUdpOrTcp: bad operation\n");
|
1999-07-27 23:44:00 +00:00
|
|
|
return 0;
|
1995-01-31 06:29:58 +00:00
|
|
|
}
|
1999-07-27 23:44:00 +00:00
|
|
|
tgt->f_dstport = ParsePort(argv[2], proto);
|
|
|
|
if (tgt->f_dstport == 0)
|
|
|
|
return 0;
|
1997-08-25 00:29:32 +00:00
|
|
|
argc -= 3;
|
|
|
|
argv += 3;
|
1995-09-17 16:14:49 +00:00
|
|
|
}
|
1998-05-21 21:49:08 +00:00
|
|
|
|
|
|
|
if (proto == P_TCP) {
|
|
|
|
for (; argc > 0; argc--, argv++)
|
|
|
|
if (!strcmp(*argv, "estab"))
|
1999-07-27 23:44:00 +00:00
|
|
|
tgt->f_estab = 1;
|
1998-05-21 21:49:08 +00:00
|
|
|
else if (!strcmp(*argv, "syn"))
|
1999-07-27 23:44:00 +00:00
|
|
|
tgt->f_syn = 1;
|
1998-05-21 21:49:08 +00:00
|
|
|
else if (!strcmp(*argv, "finrst"))
|
1999-07-27 23:44:00 +00:00
|
|
|
tgt->f_finrst = 1;
|
1998-05-21 21:49:08 +00:00
|
|
|
else
|
|
|
|
break;
|
1995-09-17 16:14:49 +00:00
|
|
|
}
|
1995-01-31 06:29:58 +00:00
|
|
|
|
1998-05-21 21:49:08 +00:00
|
|
|
if (argc > 0) {
|
|
|
|
log_Printf(LogWARN, "ParseUdpOrTcp: bad src/dst port syntax: %s\n", *argv);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
1995-01-31 06:29:58 +00:00
|
|
|
|
1999-08-02 11:53:16 +00:00
|
|
|
static int
|
|
|
|
ParseIgmp(int argc, char const * const *argv, struct filterent *tgt)
|
1999-07-27 23:44:00 +00:00
|
|
|
{
|
1999-08-02 11:53:16 +00:00
|
|
|
/*
|
|
|
|
* Filter currently is a catch-all. Requests are either permitted or
|
|
|
|
* dropped.
|
|
|
|
*/
|
1999-06-23 16:48:24 +00:00
|
|
|
if (argc != 0) {
|
|
|
|
log_Printf(LogWARN, "ParseIgmp: Too many parameters\n");
|
|
|
|
return 0;
|
|
|
|
} else
|
1999-07-27 23:44:00 +00:00
|
|
|
tgt->f_srcop = OP_NONE;
|
1999-06-23 16:48:24 +00:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
1999-09-30 07:23:13 +00:00
|
|
|
#ifdef P_GRE
|
|
|
|
static int
|
|
|
|
ParseGRE(int argc, char const * const *argv, struct filterent *tgt)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Filter currently is a catch-all. Requests are either permitted or
|
|
|
|
* dropped.
|
|
|
|
*/
|
|
|
|
if (argc != 0) {
|
|
|
|
log_Printf(LogWARN, "ParseGRE: Too many parameters\n");
|
|
|
|
return 0;
|
|
|
|
} else
|
|
|
|
tgt->f_srcop = OP_NONE;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
1999-08-02 15:29:19 +00:00
|
|
|
#ifdef P_OSPF
|
1999-08-02 11:53:16 +00:00
|
|
|
static int
|
|
|
|
ParseOspf(int argc, char const * const *argv, struct filterent *tgt)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Filter currently is a catch-all. Requests are either permitted or
|
|
|
|
* dropped.
|
|
|
|
*/
|
|
|
|
if (argc != 0) {
|
|
|
|
log_Printf(LogWARN, "ParseOspf: Too many parameters\n");
|
|
|
|
return 0;
|
|
|
|
} else
|
|
|
|
tgt->f_srcop = OP_NONE;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
1999-08-02 15:29:19 +00:00
|
|
|
#endif
|
1999-08-02 11:53:16 +00:00
|
|
|
|
1999-05-31 23:57:40 +00:00
|
|
|
static unsigned
|
|
|
|
addrtype(const char *addr)
|
|
|
|
{
|
|
|
|
if (!strncasecmp(addr, "MYADDR", 6) && (addr[6] == '\0' || addr[6] == '/'))
|
|
|
|
return T_MYADDR;
|
|
|
|
if (!strncasecmp(addr, "HISADDR", 7) && (addr[7] == '\0' || addr[7] == '/'))
|
|
|
|
return T_HISADDR;
|
2000-03-14 01:47:27 +00:00
|
|
|
if (!strncasecmp(addr, "DNS0", 4) && (addr[4] == '\0' || addr[4] == '/'))
|
|
|
|
return T_DNS0;
|
|
|
|
if (!strncasecmp(addr, "DNS1", 4) && (addr[4] == '\0' || addr[4] == '/'))
|
|
|
|
return T_DNS1;
|
1999-05-31 23:57:40 +00:00
|
|
|
|
|
|
|
return T_ADDR;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char *
|
|
|
|
addrstr(struct in_addr addr, unsigned type)
|
|
|
|
{
|
|
|
|
switch (type) {
|
|
|
|
case T_MYADDR:
|
|
|
|
return "MYADDR";
|
|
|
|
case T_HISADDR:
|
|
|
|
return "HISADDR";
|
2000-03-14 01:47:27 +00:00
|
|
|
case T_DNS0:
|
|
|
|
return "DNS0";
|
|
|
|
case T_DNS1:
|
|
|
|
return "DNS1";
|
1999-05-31 23:57:40 +00:00
|
|
|
}
|
|
|
|
return inet_ntoa(addr);
|
|
|
|
}
|
|
|
|
|
1999-07-27 23:44:00 +00:00
|
|
|
static const char *
|
|
|
|
maskstr(int bits)
|
|
|
|
{
|
|
|
|
static char str[4];
|
|
|
|
|
|
|
|
if (bits == 32)
|
|
|
|
*str = '\0';
|
|
|
|
else
|
|
|
|
snprintf(str, sizeof str, "/%d", bits);
|
|
|
|
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
1995-01-31 06:29:58 +00:00
|
|
|
static int
|
1998-05-21 21:49:08 +00:00
|
|
|
Parse(struct ipcp *ipcp, int argc, char const *const *argv,
|
|
|
|
struct filterent *ofp)
|
1995-01-31 06:29:58 +00:00
|
|
|
{
|
|
|
|
int action, proto;
|
1999-07-27 23:44:00 +00:00
|
|
|
int val, ruleno;
|
1995-01-31 06:29:58 +00:00
|
|
|
char *wp;
|
1998-05-21 21:49:08 +00:00
|
|
|
struct filterent filterdata;
|
1995-01-31 06:29:58 +00:00
|
|
|
|
1999-07-27 23:44:00 +00:00
|
|
|
ruleno = strtol(*argv, &wp, 0);
|
|
|
|
if (*argv == wp || ruleno >= MAXFILTERS) {
|
1998-05-21 21:49:08 +00:00
|
|
|
log_Printf(LogWARN, "Parse: invalid filter number.\n");
|
1999-07-27 23:44:00 +00:00
|
|
|
return 0;
|
1995-01-31 06:29:58 +00:00
|
|
|
}
|
1999-07-27 23:44:00 +00:00
|
|
|
if (ruleno < 0) {
|
|
|
|
for (ruleno = 0; ruleno < MAXFILTERS; ruleno++) {
|
|
|
|
ofp->f_action = A_NONE;
|
1995-01-31 06:29:58 +00:00
|
|
|
ofp++;
|
|
|
|
}
|
1998-05-21 21:49:08 +00:00
|
|
|
log_Printf(LogWARN, "Parse: filter cleared.\n");
|
1999-07-27 23:44:00 +00:00
|
|
|
return 1;
|
1995-01-31 06:29:58 +00:00
|
|
|
}
|
1999-07-27 23:44:00 +00:00
|
|
|
ofp += ruleno;
|
1995-01-31 06:29:58 +00:00
|
|
|
|
|
|
|
if (--argc == 0) {
|
1998-05-21 21:49:08 +00:00
|
|
|
log_Printf(LogWARN, "Parse: missing action.\n");
|
1999-07-27 23:44:00 +00:00
|
|
|
return 0;
|
1995-01-31 06:29:58 +00:00
|
|
|
}
|
|
|
|
argv++;
|
|
|
|
|
|
|
|
proto = P_NONE;
|
1997-12-24 09:29:17 +00:00
|
|
|
memset(&filterdata, '\0', sizeof filterdata);
|
1995-01-31 06:29:58 +00:00
|
|
|
|
1999-07-27 23:44:00 +00:00
|
|
|
val = strtol(*argv, &wp, 0);
|
|
|
|
if (!*wp && val >= 0 && val < MAXFILTERS) {
|
|
|
|
if (val <= ruleno) {
|
|
|
|
log_Printf(LogWARN, "Parse: Can only jump forward from rule %d\n",
|
|
|
|
ruleno);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
action = val;
|
|
|
|
} else if (!strcmp(*argv, "permit")) {
|
1995-01-31 06:29:58 +00:00
|
|
|
action = A_PERMIT;
|
1997-10-26 01:04:02 +00:00
|
|
|
} else if (!strcmp(*argv, "deny")) {
|
1995-01-31 06:29:58 +00:00
|
|
|
action = A_DENY;
|
1997-10-26 01:04:02 +00:00
|
|
|
} else if (!strcmp(*argv, "clear")) {
|
1999-07-27 23:44:00 +00:00
|
|
|
ofp->f_action = A_NONE;
|
|
|
|
return 1;
|
1995-01-31 06:29:58 +00:00
|
|
|
} else {
|
1998-05-21 21:49:08 +00:00
|
|
|
log_Printf(LogWARN, "Parse: bad action: %s\n", *argv);
|
1999-07-27 23:44:00 +00:00
|
|
|
return 0;
|
1995-01-31 06:29:58 +00:00
|
|
|
}
|
1999-07-27 23:44:00 +00:00
|
|
|
filterdata.f_action = action;
|
1995-01-31 06:29:58 +00:00
|
|
|
|
1997-08-25 00:29:32 +00:00
|
|
|
argc--;
|
|
|
|
argv++;
|
1995-01-31 06:29:58 +00:00
|
|
|
|
1999-07-27 23:44:00 +00:00
|
|
|
if (argc && argv[0][0] == '!' && !argv[0][1]) {
|
|
|
|
filterdata.f_invert = 1;
|
|
|
|
argc--;
|
|
|
|
argv++;
|
1995-01-31 06:29:58 +00:00
|
|
|
}
|
1999-01-28 01:56:34 +00:00
|
|
|
|
1998-05-21 21:49:08 +00:00
|
|
|
proto = filter_Nam2Proto(argc, argv);
|
1995-01-31 06:29:58 +00:00
|
|
|
if (proto == P_NONE) {
|
1999-01-28 01:56:34 +00:00
|
|
|
if (!argc)
|
|
|
|
log_Printf(LogWARN, "Parse: address/mask is expected.\n");
|
1999-07-27 23:44:00 +00:00
|
|
|
else if (ParseAddr(ipcp, *argv, &filterdata.f_src.ipaddr,
|
|
|
|
&filterdata.f_src.mask, &filterdata.f_src.width)) {
|
|
|
|
filterdata.f_srctype = addrtype(*argv);
|
1997-08-25 00:29:32 +00:00
|
|
|
argc--;
|
|
|
|
argv++;
|
1998-05-21 21:49:08 +00:00
|
|
|
proto = filter_Nam2Proto(argc, argv);
|
1999-01-28 01:56:34 +00:00
|
|
|
if (!argc)
|
|
|
|
log_Printf(LogWARN, "Parse: address/mask is expected.\n");
|
|
|
|
else if (proto == P_NONE) {
|
1999-07-27 23:44:00 +00:00
|
|
|
if (ParseAddr(ipcp, *argv, &filterdata.f_dst.ipaddr,
|
|
|
|
&filterdata.f_dst.mask, &filterdata.f_dst.width)) {
|
|
|
|
filterdata.f_dsttype = addrtype(*argv);
|
1997-08-25 00:29:32 +00:00
|
|
|
argc--;
|
|
|
|
argv++;
|
1999-05-31 23:57:40 +00:00
|
|
|
} else
|
1999-07-27 23:44:00 +00:00
|
|
|
filterdata.f_dsttype = T_ADDR;
|
|
|
|
if (argc) {
|
|
|
|
proto = filter_Nam2Proto(argc, argv);
|
|
|
|
if (proto == P_NONE) {
|
|
|
|
log_Printf(LogWARN, "Parse: %s: Invalid protocol\n", *argv);
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
argc--;
|
|
|
|
argv++;
|
|
|
|
}
|
1995-02-26 12:18:08 +00:00
|
|
|
}
|
1997-07-27 23:26:23 +00:00
|
|
|
} else {
|
1997-08-25 00:29:32 +00:00
|
|
|
argc--;
|
|
|
|
argv++;
|
1995-01-31 06:29:58 +00:00
|
|
|
}
|
|
|
|
} else {
|
1998-05-21 21:49:08 +00:00
|
|
|
log_Printf(LogWARN, "Parse: Address/protocol expected.\n");
|
1999-07-27 23:44:00 +00:00
|
|
|
return 0;
|
1995-01-31 06:29:58 +00:00
|
|
|
}
|
|
|
|
} else {
|
1997-08-25 00:29:32 +00:00
|
|
|
argc--;
|
|
|
|
argv++;
|
1995-01-31 06:29:58 +00:00
|
|
|
}
|
|
|
|
|
2000-07-11 22:11:36 +00:00
|
|
|
if (argc >= 2 && strcmp(argv[argc - 2], "timeout") == 0) {
|
|
|
|
filterdata.timeout = strtoul(argv[argc - 1], NULL, 10);
|
|
|
|
argc -= 2;
|
|
|
|
}
|
|
|
|
|
1995-01-31 06:29:58 +00:00
|
|
|
val = 1;
|
1999-07-27 23:44:00 +00:00
|
|
|
filterdata.f_proto = proto;
|
1995-01-31 06:29:58 +00:00
|
|
|
|
|
|
|
switch (proto) {
|
|
|
|
case P_TCP:
|
1998-05-21 21:49:08 +00:00
|
|
|
val = ParseUdpOrTcp(argc, argv, P_TCP, &filterdata);
|
1995-01-31 06:29:58 +00:00
|
|
|
break;
|
|
|
|
case P_UDP:
|
1998-05-21 21:49:08 +00:00
|
|
|
val = ParseUdpOrTcp(argc, argv, P_UDP, &filterdata);
|
1995-01-31 06:29:58 +00:00
|
|
|
break;
|
2001-04-24 02:13:34 +00:00
|
|
|
case P_IPIP:
|
|
|
|
val = ParseUdpOrTcp(argc, argv, P_IPIP, &filterdata);
|
|
|
|
break;
|
1995-01-31 06:29:58 +00:00
|
|
|
case P_ICMP:
|
1998-05-21 21:49:08 +00:00
|
|
|
val = ParseIcmp(argc, argv, &filterdata);
|
1995-01-31 06:29:58 +00:00
|
|
|
break;
|
1999-06-23 16:48:24 +00:00
|
|
|
case P_IGMP:
|
|
|
|
val = ParseIgmp(argc, argv, &filterdata);
|
|
|
|
break;
|
1999-08-02 15:29:19 +00:00
|
|
|
#ifdef P_OSPF
|
1999-08-02 11:53:16 +00:00
|
|
|
case P_OSPF:
|
|
|
|
val = ParseOspf(argc, argv, &filterdata);
|
|
|
|
break;
|
1999-09-30 07:23:13 +00:00
|
|
|
#endif
|
|
|
|
#ifdef P_GRE
|
|
|
|
case P_GRE:
|
|
|
|
val = ParseGRE(argc, argv, &filterdata);
|
|
|
|
break;
|
1999-08-02 15:29:19 +00:00
|
|
|
#endif
|
1995-01-31 06:29:58 +00:00
|
|
|
}
|
|
|
|
|
1999-07-27 23:44:00 +00:00
|
|
|
log_Printf(LogDEBUG, "Parse: Src: %s\n", inet_ntoa(filterdata.f_src.ipaddr));
|
2000-10-30 00:15:29 +00:00
|
|
|
log_Printf(LogDEBUG, "Parse: Src mask: %s\n",
|
|
|
|
inet_ntoa(filterdata.f_src.mask));
|
1999-07-27 23:44:00 +00:00
|
|
|
log_Printf(LogDEBUG, "Parse: Dst: %s\n", inet_ntoa(filterdata.f_dst.ipaddr));
|
2000-10-30 00:15:29 +00:00
|
|
|
log_Printf(LogDEBUG, "Parse: Dst mask: %s\n",
|
|
|
|
inet_ntoa(filterdata.f_dst.mask));
|
1998-05-21 21:49:08 +00:00
|
|
|
log_Printf(LogDEBUG, "Parse: Proto = %d\n", proto);
|
1995-01-31 06:29:58 +00:00
|
|
|
|
1998-05-21 21:49:08 +00:00
|
|
|
log_Printf(LogDEBUG, "Parse: src: %s (%d)\n",
|
1999-07-27 23:44:00 +00:00
|
|
|
filter_Op2Nam(filterdata.f_srcop), filterdata.f_srcport);
|
1998-05-21 21:49:08 +00:00
|
|
|
log_Printf(LogDEBUG, "Parse: dst: %s (%d)\n",
|
1999-07-27 23:44:00 +00:00
|
|
|
filter_Op2Nam(filterdata.f_dstop), filterdata.f_dstport);
|
|
|
|
log_Printf(LogDEBUG, "Parse: estab: %u\n", filterdata.f_estab);
|
|
|
|
log_Printf(LogDEBUG, "Parse: syn: %u\n", filterdata.f_syn);
|
|
|
|
log_Printf(LogDEBUG, "Parse: finrst: %u\n", filterdata.f_finrst);
|
1995-01-31 06:29:58 +00:00
|
|
|
|
|
|
|
if (val)
|
1998-05-21 21:49:08 +00:00
|
|
|
*ofp = filterdata;
|
1999-07-27 23:44:00 +00:00
|
|
|
|
|
|
|
return val;
|
1995-01-31 06:29:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
1998-05-21 21:49:08 +00:00
|
|
|
filter_Set(struct cmdargs const *arg)
|
1995-01-31 06:29:58 +00:00
|
|
|
{
|
1998-05-21 21:49:08 +00:00
|
|
|
struct filter *filter;
|
|
|
|
|
|
|
|
if (arg->argc < arg->argn+2)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
if (!strcmp(arg->argv[arg->argn], "in"))
|
|
|
|
filter = &arg->bundle->filter.in;
|
|
|
|
else if (!strcmp(arg->argv[arg->argn], "out"))
|
|
|
|
filter = &arg->bundle->filter.out;
|
|
|
|
else if (!strcmp(arg->argv[arg->argn], "dial"))
|
|
|
|
filter = &arg->bundle->filter.dial;
|
|
|
|
else if (!strcmp(arg->argv[arg->argn], "alive"))
|
|
|
|
filter = &arg->bundle->filter.alive;
|
|
|
|
else {
|
|
|
|
log_Printf(LogWARN, "filter_Set: %s: Invalid filter name.\n",
|
|
|
|
arg->argv[arg->argn]);
|
|
|
|
return -1;
|
1997-06-09 03:27:43 +00:00
|
|
|
}
|
1995-01-31 06:29:58 +00:00
|
|
|
|
1998-05-21 21:49:08 +00:00
|
|
|
Parse(&arg->bundle->ncp.ipcp, arg->argc - arg->argn - 1,
|
|
|
|
arg->argv + arg->argn + 1, filter->rule);
|
|
|
|
return 0;
|
1995-01-31 06:29:58 +00:00
|
|
|
}
|
|
|
|
|
1998-05-21 21:49:08 +00:00
|
|
|
const char *
|
|
|
|
filter_Action2Nam(int act)
|
1995-02-26 12:18:08 +00:00
|
|
|
{
|
1999-12-27 11:54:57 +00:00
|
|
|
static const char * const actname[] = { " none ", "permit ", " deny " };
|
1999-07-27 23:44:00 +00:00
|
|
|
static char buf[8];
|
|
|
|
|
|
|
|
if (act >= 0 && act < MAXFILTERS) {
|
1999-07-28 03:01:52 +00:00
|
|
|
snprintf(buf, sizeof buf, "%6d ", act);
|
1999-07-27 23:44:00 +00:00
|
|
|
return buf;
|
|
|
|
} else if (act >= A_NONE && act < A_NONE + sizeof(actname)/sizeof(char *))
|
|
|
|
return actname[act - A_NONE];
|
|
|
|
else
|
|
|
|
return "?????? ";
|
1995-02-26 12:18:08 +00:00
|
|
|
}
|
|
|
|
|
1995-01-31 06:29:58 +00:00
|
|
|
static void
|
1998-05-21 21:49:08 +00:00
|
|
|
doShowFilter(struct filterent *fp, struct prompt *prompt)
|
1995-01-31 06:29:58 +00:00
|
|
|
{
|
|
|
|
int n;
|
|
|
|
|
|
|
|
for (n = 0; n < MAXFILTERS; n++, fp++) {
|
1999-07-27 23:44:00 +00:00
|
|
|
if (fp->f_action != A_NONE) {
|
|
|
|
prompt_Printf(prompt, " %2d %s", n, filter_Action2Nam(fp->f_action));
|
|
|
|
prompt_Printf(prompt, "%c ", fp->f_invert ? '!' : ' ');
|
|
|
|
prompt_Printf(prompt, "%s%s ", addrstr(fp->f_src.ipaddr, fp->f_srctype),
|
|
|
|
maskstr(fp->f_src.width));
|
|
|
|
prompt_Printf(prompt, "%s%s ", addrstr(fp->f_dst.ipaddr, fp->f_dsttype),
|
|
|
|
maskstr(fp->f_dst.width));
|
|
|
|
if (fp->f_proto) {
|
|
|
|
prompt_Printf(prompt, "%s", filter_Proto2Nam(fp->f_proto));
|
|
|
|
|
|
|
|
if (fp->f_srcop)
|
|
|
|
prompt_Printf(prompt, " src %s %d", filter_Op2Nam(fp->f_srcop),
|
|
|
|
fp->f_srcport);
|
|
|
|
if (fp->f_dstop)
|
|
|
|
prompt_Printf(prompt, " dst %s %d", filter_Op2Nam(fp->f_dstop),
|
|
|
|
fp->f_dstport);
|
|
|
|
if (fp->f_estab)
|
1998-05-21 21:49:08 +00:00
|
|
|
prompt_Printf(prompt, " estab");
|
1999-07-27 23:44:00 +00:00
|
|
|
if (fp->f_syn)
|
1998-05-21 21:49:08 +00:00
|
|
|
prompt_Printf(prompt, " syn");
|
1999-07-27 23:44:00 +00:00
|
|
|
if (fp->f_finrst)
|
1998-05-21 21:49:08 +00:00
|
|
|
prompt_Printf(prompt, " finrst");
|
1995-01-31 06:29:58 +00:00
|
|
|
}
|
2000-07-11 22:11:36 +00:00
|
|
|
if (fp->timeout != 0)
|
|
|
|
prompt_Printf(prompt, " timeout %u", fp->timeout);
|
1998-05-21 21:49:08 +00:00
|
|
|
prompt_Printf(prompt, "\n");
|
1995-01-31 06:29:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
1998-05-21 21:49:08 +00:00
|
|
|
filter_Show(struct cmdargs const *arg)
|
1995-01-31 06:29:58 +00:00
|
|
|
{
|
1998-05-21 21:49:08 +00:00
|
|
|
if (arg->argc > arg->argn+1)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
if (arg->argc == arg->argn+1) {
|
|
|
|
struct filter *filter;
|
|
|
|
|
|
|
|
if (!strcmp(arg->argv[arg->argn], "in"))
|
|
|
|
filter = &arg->bundle->filter.in;
|
|
|
|
else if (!strcmp(arg->argv[arg->argn], "out"))
|
|
|
|
filter = &arg->bundle->filter.out;
|
|
|
|
else if (!strcmp(arg->argv[arg->argn], "dial"))
|
|
|
|
filter = &arg->bundle->filter.dial;
|
|
|
|
else if (!strcmp(arg->argv[arg->argn], "alive"))
|
|
|
|
filter = &arg->bundle->filter.alive;
|
|
|
|
else
|
|
|
|
return -1;
|
|
|
|
doShowFilter(filter->rule, arg->prompt);
|
|
|
|
} else {
|
|
|
|
struct filter *filter[4];
|
|
|
|
int f;
|
|
|
|
|
|
|
|
filter[0] = &arg->bundle->filter.in;
|
|
|
|
filter[1] = &arg->bundle->filter.out;
|
|
|
|
filter[2] = &arg->bundle->filter.dial;
|
|
|
|
filter[3] = &arg->bundle->filter.alive;
|
|
|
|
for (f = 0; f < 4; f++) {
|
|
|
|
if (f)
|
|
|
|
prompt_Printf(arg->prompt, "\n");
|
|
|
|
prompt_Printf(arg->prompt, "%s:\n", filter[f]->name);
|
|
|
|
doShowFilter(filter[f]->rule, arg->prompt);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1997-06-09 03:27:43 +00:00
|
|
|
return 0;
|
1995-01-31 06:29:58 +00:00
|
|
|
}
|
|
|
|
|
1999-12-27 11:54:57 +00:00
|
|
|
static const char * const protoname[] = {
|
2001-04-24 02:13:34 +00:00
|
|
|
"none", "tcp", "udp", "icmp", "ospf", "igmp", "gre", "ipip"
|
1999-08-02 11:53:16 +00:00
|
|
|
};
|
1998-05-21 21:49:08 +00:00
|
|
|
|
|
|
|
const char *
|
|
|
|
filter_Proto2Nam(int proto)
|
1995-01-31 06:29:58 +00:00
|
|
|
{
|
1998-05-21 21:49:08 +00:00
|
|
|
if (proto >= sizeof protoname / sizeof protoname[0])
|
|
|
|
return "unknown";
|
|
|
|
return protoname[proto];
|
1995-01-31 06:29:58 +00:00
|
|
|
}
|
|
|
|
|
1998-05-21 21:49:08 +00:00
|
|
|
static int
|
|
|
|
filter_Nam2Proto(int argc, char const *const *argv)
|
1995-01-31 06:29:58 +00:00
|
|
|
{
|
1998-05-21 21:49:08 +00:00
|
|
|
int proto;
|
|
|
|
|
|
|
|
if (argc == 0)
|
|
|
|
proto = 0;
|
|
|
|
else
|
|
|
|
for (proto = sizeof protoname / sizeof protoname[0] - 1; proto; proto--)
|
|
|
|
if (!strcasecmp(*argv, protoname[proto]))
|
|
|
|
break;
|
|
|
|
|
|
|
|
return proto;
|
1995-01-31 06:29:58 +00:00
|
|
|
}
|
1995-02-26 12:18:08 +00:00
|
|
|
|
1999-12-27 11:54:57 +00:00
|
|
|
static const char * const opname[] = {"none", "eq", "gt", "lt"};
|
1998-05-21 21:49:08 +00:00
|
|
|
|
|
|
|
const char *
|
|
|
|
filter_Op2Nam(int op)
|
1995-02-26 12:18:08 +00:00
|
|
|
{
|
1998-05-21 21:49:08 +00:00
|
|
|
if (op >= sizeof opname / sizeof opname[0])
|
|
|
|
return "unknown";
|
|
|
|
return opname[op];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
filter_Nam2Op(const char *cp)
|
|
|
|
{
|
|
|
|
int op;
|
|
|
|
|
|
|
|
for (op = sizeof opname / sizeof opname[0] - 1; op; op--)
|
|
|
|
if (!strcasecmp(cp, opname[op]))
|
|
|
|
break;
|
|
|
|
|
|
|
|
return op;
|
1995-02-26 12:18:08 +00:00
|
|
|
}
|
1999-05-31 23:57:40 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
filter_AdjustAddr(struct filter *filter, struct in_addr *my_ip,
|
2000-03-14 01:47:27 +00:00
|
|
|
struct in_addr *peer_ip, struct in_addr dns[2])
|
1999-05-31 23:57:40 +00:00
|
|
|
{
|
|
|
|
struct filterent *fp;
|
|
|
|
int n;
|
|
|
|
|
|
|
|
for (fp = filter->rule, n = 0; n < MAXFILTERS; fp++, n++)
|
1999-07-27 23:44:00 +00:00
|
|
|
if (fp->f_action != A_NONE) {
|
1999-05-31 23:57:40 +00:00
|
|
|
if (my_ip) {
|
1999-07-27 23:44:00 +00:00
|
|
|
if (fp->f_srctype == T_MYADDR)
|
|
|
|
fp->f_src.ipaddr = *my_ip;
|
|
|
|
if (fp->f_dsttype == T_MYADDR)
|
|
|
|
fp->f_dst.ipaddr = *my_ip;
|
1999-05-31 23:57:40 +00:00
|
|
|
}
|
|
|
|
if (peer_ip) {
|
1999-07-27 23:44:00 +00:00
|
|
|
if (fp->f_srctype == T_HISADDR)
|
|
|
|
fp->f_src.ipaddr = *peer_ip;
|
|
|
|
if (fp->f_dsttype == T_HISADDR)
|
|
|
|
fp->f_dst.ipaddr = *peer_ip;
|
1999-05-31 23:57:40 +00:00
|
|
|
}
|
2000-03-14 01:47:27 +00:00
|
|
|
if (dns) {
|
|
|
|
if (fp->f_srctype == T_DNS0)
|
|
|
|
fp->f_src.ipaddr = dns[0];
|
|
|
|
if (fp->f_dsttype == T_DNS0)
|
|
|
|
fp->f_dst.ipaddr = dns[0];
|
|
|
|
if (fp->f_srctype == T_DNS1)
|
|
|
|
fp->f_src.ipaddr = dns[1];
|
|
|
|
if (fp->f_dsttype == T_DNS1)
|
|
|
|
fp->f_dst.ipaddr = dns[1];
|
|
|
|
}
|
1999-05-31 23:57:40 +00:00
|
|
|
}
|
|
|
|
}
|