Skip to content

Commit

Permalink
Correctly restore connection mark for UDP traffic, to allow e.g. DNS …
Browse files Browse the repository at this point in the history
…services to work

(fix for #11)
  • Loading branch information
struanb committed Sep 4, 2021
1 parent 379df73 commit 2d5643a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions docker-ingress-routing-daemon
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash

VERSION=3.2.0
VERSION=3.3.0

# Ingress Routing Daemon v3.2.0
# Ingress Routing Daemon v3.3.0
# Copyright © 2020-2021 Struan Bartlett
# ----------------------------------------------------------------------
# Permission is hereby granted, free of charge, to any person
Expand Down Expand Up @@ -276,7 +276,12 @@ docker events \

log "Container SERVICE=$SERVICE, ID=$ID, NID=$NID launched: ingress network interface $CIF found, so applying policy routes."

# 3. Map any connection mark on outgoing traffic to a firewall mark on the individual packets.
# 3. Map any connection mark on outgoing tcp or udp traffic to a firewall mark on the individual packets.
# These rules /could potentially/ be applied more selectively, according to --tcp-ports and --udp-ports, to make
# a marginal efficiency gain, but this is not necessary: as, if no connection mark has been set, because no
# TOS byte has been set by the load balancer, then none will be restored and legacy routing rules will apply.
# - See https://github.com/newsnowlabs/docker-ingress-routing-daemon/issues/11
nsenter -n -t $NID iptables -t mangle -A OUTPUT -p udp -j CONNMARK --restore-mark
nsenter -n -t $NID iptables -t mangle -A OUTPUT -p tcp -j CONNMARK --restore-mark

# 3.1 Enable 'loose' rp_filter mode on interface $CIF (and 'all' as required by kernel
Expand Down

0 comments on commit 2d5643a

Please sign in to comment.