Skip to content
This repository was archived by the owner on Nov 10, 2023. It is now read-only.

Commit a759388

Browse files
committed
Add ip6tables setup to the Docker entrypoint
1 parent c638b7d commit a759388

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ COPY . .
55
RUN go build -o /tracetrout -ldflags='-s -w'
66

77
FROM alpine:3.7
8-
RUN apk add --no-cache iptables libnetfilter_queue
8+
RUN apk add --no-cache iptables ip6tables libnetfilter_queue
99
WORKDIR /tracetrout
1010
COPY entrypoint.sh .
1111
COPY --from=builder /tracetrout .

entrypoint.sh

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
set -e
22

3-
iptables -A INPUT -t mangle -j CONNMARK --restore-mark
4-
iptables -A INPUT -t mangle -m mark ! --mark 0 -j ACCEPT
5-
iptables -A INPUT -t mangle -p tcp --dport "${PORT}" -j MARK --set-mark 0x10000
6-
iptables -A INPUT -t mangle -p tcp --dport "${PORT}" -j MARK --or-mark "${FILTER_QUEUE}"
7-
iptables -A INPUT -t mangle -j CONNMARK --save-mark
8-
iptables -A OUTPUT -t mangle -j CONNMARK --restore-mark
3+
for CMD in iptables ip6tables; do
4+
"${CMD}" -A INPUT -t mangle -j CONNMARK --restore-mark
5+
"${CMD}" -A INPUT -t mangle -m mark ! --mark 0 -j ACCEPT
6+
"${CMD}" -A INPUT -t mangle -p tcp --dport "${PORT}" -j MARK --set-mark 0x10000
7+
"${CMD}" -A INPUT -t mangle -p tcp --dport "${PORT}" -j MARK --or-mark "${FILTER_QUEUE}"
8+
"${CMD}" -A INPUT -t mangle -j CONNMARK --save-mark
9+
"${CMD}" -A INPUT -m mark --mark 0x10000/0xffff0000 -m mark --mark "${FILTER_QUEUE}/0xffff" -j NFQUEUE --queue-num "${FILTER_QUEUE}"
910

10-
iptables -A INPUT -m mark --mark 0x10000/0xffff0000 -m mark --mark "${FILTER_QUEUE}/0xffff" -j NFQUEUE --queue-num "${FILTER_QUEUE}"
11-
iptables -A OUTPUT -m mark --mark 0x10000/0xffff0000 -m mark --mark "${FILTER_QUEUE}/0xffff" -j NFQUEUE --queue-num "${FILTER_QUEUE}"
11+
"${CMD}" -A OUTPUT -t mangle -j CONNMARK --restore-mark
12+
"${CMD}" -A OUTPUT -m mark --mark 0x10000/0xffff0000 -m mark --mark "${FILTER_QUEUE}/0xffff" -j NFQUEUE --queue-num "${FILTER_QUEUE}"
13+
done
1214

13-
$@
15+
$@

0 commit comments

Comments
 (0)