Support GRE packets
Submitted by: Harry Starr <starr@gccs.com.au>
This commit is contained in:
parent
b89392e703
commit
28149effa7
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=51809
@ -277,6 +277,24 @@ ParseIgmp(int argc, char const * const *argv, struct filterent *tgt)
|
||||
return 1;
|
||||
}
|
||||
|
||||
#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
|
||||
|
||||
#ifdef P_OSPF
|
||||
static int
|
||||
ParseOspf(int argc, char const * const *argv, struct filterent *tgt)
|
||||
@ -457,6 +475,11 @@ Parse(struct ipcp *ipcp, int argc, char const *const *argv,
|
||||
case P_OSPF:
|
||||
val = ParseOspf(argc, argv, &filterdata);
|
||||
break;
|
||||
#endif
|
||||
#ifdef P_GRE
|
||||
case P_GRE:
|
||||
val = ParseGRE(argc, argv, &filterdata);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -596,7 +619,7 @@ filter_Show(struct cmdargs const *arg)
|
||||
}
|
||||
|
||||
static const char *protoname[] = {
|
||||
"none", "tcp", "udp", "icmp", "ospf", "igmp"
|
||||
"none", "tcp", "udp", "icmp", "ospf", "igmp", "gre"
|
||||
};
|
||||
|
||||
const char *
|
||||
|
@ -29,6 +29,9 @@
|
||||
#define P_OSPF 4
|
||||
#endif
|
||||
#define P_IGMP 5
|
||||
#ifdef IPPROTO_GRE
|
||||
#define P_GRE 6
|
||||
#endif
|
||||
|
||||
/* Operations - f_srcop, f_dstop */
|
||||
#define OP_NONE 0
|
||||
|
@ -170,6 +170,15 @@ FilterCheck(const struct ip *pip, const struct filter *filter)
|
||||
estab = syn = finrst = -1;
|
||||
sport = ntohs(0);
|
||||
break;
|
||||
#ifdef IPPROTO_GRE
|
||||
case IPPROTO_GRE:
|
||||
cproto = P_GRE;
|
||||
if (datalen < 2) /* GRE uses 2-octet+ messages */
|
||||
return (1);
|
||||
estab = syn = finrst = -1;
|
||||
sport = ntohs(0);
|
||||
break;
|
||||
#endif
|
||||
#ifdef IPPROTO_OSPFIGP
|
||||
case IPPROTO_OSPFIGP:
|
||||
cproto = P_OSPF;
|
||||
@ -360,6 +369,19 @@ PacketCheck(struct bundle *bundle, char *cp, int nb, struct filter *filter)
|
||||
}
|
||||
break;
|
||||
|
||||
#ifdef IPPROTO_GRE
|
||||
case IPPROTO_GRE:
|
||||
if (logit && loglen < sizeof logbuf) {
|
||||
snprintf(logbuf + loglen, sizeof logbuf - loglen,
|
||||
"GRE: %s ---> ", inet_ntoa(pip->ip_src));
|
||||
loglen += strlen(logbuf + loglen);
|
||||
snprintf(logbuf + loglen, sizeof logbuf - loglen,
|
||||
"%s", inet_ntoa(pip->ip_dst));
|
||||
loglen += strlen(logbuf + loglen);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef IPPROTO_OSPFIGP
|
||||
case IPPROTO_OSPFIGP:
|
||||
if (logit && loglen < sizeof logbuf) {
|
||||
|
Loading…
Reference in New Issue
Block a user