Route static NAT forwards to explicit owners on all ports
This commit is contained in:
1 parent
2d24bea53f
commit
af0baad38d
3 files changed
+33
-25
No files matched your search
@@ -740,7 +740,7 @@ static void test_port_forward(void) {
|
||||
|
||||
int r = eim_nat_add_forward(&ctx, IPPROTO_TCP_UINT8,
|
||||
0x0A0000FE, htobe16(8080), // internal 10.0.0.254:8080
|
||||
10050);
|
||||
10050, 1);
|
||||
ASSERT_EQ(r, 0, "add_forward ok");
|
||||
ASSERT(ctx.table[10050].state == EIM_NAT_ENTRY_STATIC, "entry static");
|
||||
ASSERT_EQ(ctx.table[10050].internal_ip, 0x0A0000FE, "internal_ip");
|
||||
@@ -756,8 +756,8 @@ static void test_port_forward(void) {
|
||||
struct eim_nat_ctx ctx;
|
||||
eim_nat_init_ctx(&ctx, &g);
|
||||
|
||||
eim_nat_add_forward(&ctx, IPPROTO_TCP_UINT8, 0x0A0000FE, htobe16(8080), 10050);
|
||||
int r = eim_nat_add_forward(&ctx, IPPROTO_UDP_UINT8, 0x0A0000FF, htobe16(9090), 10050);
|
||||
eim_nat_add_forward(&ctx, IPPROTO_TCP_UINT8, 0x0A0000FE, htobe16(8080), 10050, 1);
|
||||
int r = eim_nat_add_forward(&ctx, IPPROTO_UDP_UINT8, 0x0A0000FF, htobe16(9090), 10050, 1);
|
||||
ASSERT_EQ(r, -1, "duplicate rejects");
|
||||
eim_nat_destroy_ctx(&ctx);
|
||||
}
|
||||
@@ -770,7 +770,7 @@ static void test_port_forward(void) {
|
||||
eim_nat_init_ctx(&ctx, &g);
|
||||
|
||||
// Static forward: external port 10050 → internal 10.0.0.254:8080 TCP
|
||||
eim_nat_add_forward(&ctx, IPPROTO_TCP_UINT8, 0x0A0000FE, htobe16(8080), 10050);
|
||||
eim_nat_add_forward(&ctx, IPPROTO_TCP_UINT8, 0x0A0000FE, htobe16(8080), 10050, 1);
|
||||
|
||||
// Ingress TCP packet to gateway:10050
|
||||
uint8_t* resp = make_tcp_pkt(TEST_IP_DST_HOST, 443, TEST_GW_HOST, 10050);
|
||||
|
||||
@@ -138,7 +138,6 @@ static int create_temp_configs(void) {
|
||||
"allow_all=1\n"
|
||||
"\n"
|
||||
"[nat]\n"
|
||||
"enabled=1\n"
|
||||
"tun_ifname=tun_nat\n"
|
||||
"tun_ip=100.64.0.1/24\n"
|
||||
"port_start=20000\n"
|
||||
@@ -166,7 +165,6 @@ static int create_temp_configs(void) {
|
||||
"link=cl:127.0.0.1:0\n"
|
||||
"\n"
|
||||
"[nat]\n"
|
||||
"enabled=1\n"
|
||||
"tun_ifname=tun_nat_client\n"
|
||||
"tun_ip=100.64.1.1/24\n"
|
||||
"nat_via=0x%016llx\n",
|
||||
|
||||
Reference in new issue
Block a user