Add test case for tunnel
This commit is contained in:
@@ -46,29 +46,29 @@ static void on_sess_msg(struct session *sess, int topic_id, const void *msg, voi
|
||||
switch (layer.proto)
|
||||
{
|
||||
case LAYER_PROTO_IPV4:
|
||||
if (memcmp(&layer.header.ip4->ip_src, &rule.addr4, sizeof(struct in_addr)) == 0 ||
|
||||
memcmp(&layer.header.ip4->ip_dst, &rule.addr4, sizeof(struct in_addr)) == 0)
|
||||
if (memcmp(&layer.hdr.ip4->ip_src, &rule.addr4, sizeof(struct in_addr)) == 0 ||
|
||||
memcmp(&layer.hdr.ip4->ip_dst, &rule.addr4, sizeof(struct in_addr)) == 0)
|
||||
{
|
||||
is_ip_hit = 1;
|
||||
}
|
||||
break;
|
||||
case LAYER_PROTO_IPV6:
|
||||
if (memcmp(&layer.header.ip6->ip6_src, &rule.addr6, sizeof(struct in6_addr)) == 0 ||
|
||||
memcmp(&layer.header.ip6->ip6_dst, &rule.addr6, sizeof(struct in6_addr)) == 0)
|
||||
if (memcmp(&layer.hdr.ip6->ip6_src, &rule.addr6, sizeof(struct in6_addr)) == 0 ||
|
||||
memcmp(&layer.hdr.ip6->ip6_dst, &rule.addr6, sizeof(struct in6_addr)) == 0)
|
||||
{
|
||||
is_ip_hit = 1;
|
||||
}
|
||||
break;
|
||||
case LAYER_PROTO_TCP:
|
||||
if (layer.header.tcp->th_sport == rule.port ||
|
||||
layer.header.tcp->th_dport == rule.port)
|
||||
if (layer.hdr.tcp->th_sport == rule.port ||
|
||||
layer.hdr.tcp->th_dport == rule.port)
|
||||
{
|
||||
is_port_hit = 1;
|
||||
}
|
||||
break;
|
||||
case LAYER_PROTO_UDP:
|
||||
if (layer.header.udp->uh_sport == rule.port ||
|
||||
layer.header.udp->uh_dport == rule.port)
|
||||
if (layer.hdr.udp->uh_sport == rule.port ||
|
||||
layer.hdr.udp->uh_dport == rule.port)
|
||||
{
|
||||
is_port_hit = 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user