Support `igmp' filters.
Mostly submitted by: Timo Geusch <freebsd@sleepycat.ukpeople.net>
This commit is contained in:
parent
8a56be1af7
commit
1f9e5fe5fa
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=48142
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: command.c,v 1.201 1999/06/09 16:54:02 brian Exp $
|
||||
* $Id: command.c,v 1.202 1999/06/10 09:34:57 brian Exp $
|
||||
*
|
||||
*/
|
||||
#include <sys/param.h>
|
||||
@ -144,7 +144,7 @@
|
||||
#define NEG_VJCOMP 53
|
||||
|
||||
const char Version[] = "2.22";
|
||||
const char VersionDate[] = "$Date: 1999/06/09 16:54:02 $";
|
||||
const char VersionDate[] = "$Date: 1999/06/10 09:34:57 $";
|
||||
|
||||
static int ShowCommand(struct cmdargs const *);
|
||||
static int TerminalCommand(struct cmdargs const *);
|
||||
@ -1814,8 +1814,8 @@ static struct cmdtab const SetCommands[] = {
|
||||
"escape characters", "set escape hex-digit ..."},
|
||||
{"filter", NULL, filter_Set, LOCAL_AUTH,
|
||||
"packet filters", "set filter alive|dial|in|out rule-no permit|deny "
|
||||
"[src_addr[/width]] [dst_addr[/width]] [tcp|udp|icmp [src [lt|eq|gt port]] "
|
||||
"[dst [lt|eq|gt port]] [estab] [syn] [finrst]]"},
|
||||
"[src_addr[/width]] [dst_addr[/width]] [tcp|udp|icmp|igmp "
|
||||
"[src [lt|eq|gt port]] [dst [lt|eq|gt port]] [estab] [syn] [finrst]]"},
|
||||
{"hangup", NULL, SetVariable, LOCAL_AUTH | LOCAL_CX,
|
||||
"hangup script", "set hangup chat-script", (const void *) VAR_HANGUP},
|
||||
{"ifaddr", NULL, SetInterfaceAddr, LOCAL_AUTH, "destination address",
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: filter.c,v 1.28 1999/05/08 11:06:33 brian Exp $
|
||||
* $Id: filter.c,v 1.29 1999/05/31 23:57:36 brian Exp $
|
||||
*
|
||||
* TODO: Shoud send ICMP error message when we discard packets.
|
||||
*/
|
||||
@ -261,6 +261,18 @@ ParseUdpOrTcp(int argc, char const *const *argv, int proto,
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ParseIgmp(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, "ParseIgmp: Too many parameters\n");
|
||||
return 0;
|
||||
} else
|
||||
tgt->opt.srcop = OP_NONE;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static unsigned
|
||||
addrtype(const char *addr)
|
||||
{
|
||||
@ -396,6 +408,9 @@ Parse(struct ipcp *ipcp, int argc, char const *const *argv,
|
||||
case P_ICMP:
|
||||
val = ParseIcmp(argc, argv, &filterdata);
|
||||
break;
|
||||
case P_IGMP:
|
||||
val = ParseIgmp(argc, argv, &filterdata);
|
||||
break;
|
||||
}
|
||||
|
||||
log_Printf(LogDEBUG, "Parse: Src: %s\n", inet_ntoa(filterdata.src.ipaddr));
|
||||
@ -529,7 +544,7 @@ filter_Show(struct cmdargs const *arg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char *protoname[] = { "none", "tcp", "udp", "icmp" };
|
||||
static const char *protoname[] = { "none", "tcp", "udp", "icmp", "igmp" };
|
||||
|
||||
const char *
|
||||
filter_Proto2Nam(int proto)
|
||||
|
@ -15,7 +15,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: filter.h,v 1.14 1999/01/28 01:56:31 brian Exp $
|
||||
* $Id: filter.h,v 1.15 1999/05/31 23:57:37 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -33,6 +33,7 @@
|
||||
#define P_TCP 1
|
||||
#define P_UDP 2
|
||||
#define P_ICMP 3
|
||||
#define P_IGMP 4
|
||||
|
||||
/* Operations */
|
||||
#define OP_NONE 0
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: ip.c,v 1.62 1999/05/31 23:57:39 brian Exp $
|
||||
* $Id: ip.c,v 1.63 1999/06/02 15:59:00 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
* o Return ICMP message for filterd packet
|
||||
@ -139,8 +139,12 @@ FilterCheck(struct ip *pip, struct filter *filter)
|
||||
if (log_IsKept(LogDEBUG))
|
||||
snprintf(dbuff, sizeof dbuff, "sport = %d", sport);
|
||||
break;
|
||||
case IPPROTO_UDP:
|
||||
case IPPROTO_IGMP:
|
||||
cproto = P_IGMP;
|
||||
estab = syn = finrst = -1;
|
||||
sport = ntohs(0);
|
||||
break;
|
||||
case IPPROTO_UDP:
|
||||
case IPPROTO_IPIP:
|
||||
cproto = P_UDP;
|
||||
uh = (struct udphdr *) ptop;
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $Id: ppp.8,v 1.175 1999/06/11 11:27:18 brian Exp $
|
||||
.\" $Id: ppp.8,v 1.176 1999/06/14 10:12:41 brian Exp $
|
||||
.Dd 20 September 1995
|
||||
.nr XX \w'\fC00'
|
||||
.Os FreeBSD
|
||||
@ -1466,6 +1466,7 @@ command below.
|
||||
.Ar Proto
|
||||
must be one of
|
||||
.Sq icmp ,
|
||||
.Sq igmp ,
|
||||
.Sq udp
|
||||
or
|
||||
.Sq tcp .
|
||||
@ -3831,7 +3832,7 @@ as they travel across the link.
|
||||
.No permit|deny
|
||||
.Oo Ar src_addr Ns Op / Ns Ar width
|
||||
.Op Ar dst_addr Ns Op / Ns Ar width
|
||||
.Oc Oo tcp|udp|icmp Op src lt|eq|gt Ar port
|
||||
.Oc Oo tcp|udp|igmp|icmp Op src lt|eq|gt Ar port
|
||||
.Op dst lt|eq|gt Ar port
|
||||
.Op estab
|
||||
.Op syn
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $Id: ppp.8,v 1.175 1999/06/11 11:27:18 brian Exp $
|
||||
.\" $Id: ppp.8,v 1.176 1999/06/14 10:12:41 brian Exp $
|
||||
.Dd 20 September 1995
|
||||
.nr XX \w'\fC00'
|
||||
.Os FreeBSD
|
||||
@ -1466,6 +1466,7 @@ command below.
|
||||
.Ar Proto
|
||||
must be one of
|
||||
.Sq icmp ,
|
||||
.Sq igmp ,
|
||||
.Sq udp
|
||||
or
|
||||
.Sq tcp .
|
||||
@ -3831,7 +3832,7 @@ as they travel across the link.
|
||||
.No permit|deny
|
||||
.Oo Ar src_addr Ns Op / Ns Ar width
|
||||
.Op Ar dst_addr Ns Op / Ns Ar width
|
||||
.Oc Oo tcp|udp|icmp Op src lt|eq|gt Ar port
|
||||
.Oc Oo tcp|udp|igmp|icmp Op src lt|eq|gt Ar port
|
||||
.Op dst lt|eq|gt Ar port
|
||||
.Op estab
|
||||
.Op syn
|
||||
|
Loading…
Reference in New Issue
Block a user