From d7dd2501956336d83d005a0cde12dfbdac5d531f Mon Sep 17 00:00:00 2001 From: Pengfei Ni Date: Thu, 19 May 2016 15:41:28 +0800 Subject: [PATCH] Config protocol for redirect rules --- src/portmapping.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/portmapping.c b/src/portmapping.c index f70ffa7..071b926 100644 --- a/src/portmapping.c +++ b/src/portmapping.c @@ -260,7 +260,11 @@ void hyper_cleanup_container_portmapping(struct hyper_container *c, struct hyper char rule[128] = {0}; for (i=0; iports_num; i++) { - sprintf(rule, "-p tcp -m tcp --dport %d -j REDIRECT --to-ports %d", c->ports[i].host_port, c->ports[i].container_port); + sprintf(rule, "-p %s -m %s --dport %d -j REDIRECT --to-ports %d", + c->ports[i].protocol, + c->ports[i].protocol, + c->ports[i].host_port, + c->ports[i].container_port); struct ipt_rule rediect_rule = { .table = "nat", .op = "-D",