diff options
| author | luwenpeng <[email protected]> | 2024-06-19 14:43:32 +0800 |
|---|---|---|
| committer | luwenpeng <[email protected]> | 2024-06-19 14:43:32 +0800 |
| commit | c3fd452793905bd492b47cd032e4e7b0d6a3f868 (patch) | |
| tree | 9668dd0bbc8d295c13365727db0556e85f459958 /test/packet_inject | |
| parent | 327d6e7b14f32e6471a946dcec1cb2966abcad43 (diff) | |
Add test case for tunnel
Diffstat (limited to 'test/packet_inject')
| -rw-r--r-- | test/packet_inject/packet_inject_plugin.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/test/packet_inject/packet_inject_plugin.cpp b/test/packet_inject/packet_inject_plugin.cpp index ab6da04..612069c 100644 --- a/test/packet_inject/packet_inject_plugin.cpp +++ b/test/packet_inject/packet_inject_plugin.cpp @@ -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; } |
