mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-26 02:42:58 +02:00
ipsec: Add block rules to avoid conntrack entries
If an IPsec VPN connections is not established, there are rare cases when packets are supposed to be sent through that said tunnel and incorrectly handled. Those packets are sent to the default gateway an entry for this connection is created in the connection tracking table (usually only happens to UDP). All following packets are sent the same route even after the tunnel has been brought up. That leads to SIP phones not being able to register among other things. This patch adds firewall rules that these packets are rejected. That will sent a notification to the client that the tunnel is not up and avoid the connection to be added to the connection tracking table. Apart from a small performance penalty there should be no other side-effects. Fixes: #10908 Signed-off-by: Michael Tremer <michael.tremer@ipfire.org> Cc: tomvend@rymes.com Cc: daniel.weismueller@ipfire.org Cc: morlix@morlix.de Reviewed-by: Timo Eissler <timo.eissler@ipfire.org>
This commit is contained in:
@@ -144,6 +144,9 @@ void turn_connection_on(char *name, char *type) {
|
||||
"/usr/sbin/ipsec down %s >/dev/null", name);
|
||||
safe_system(command);
|
||||
|
||||
// Reload the IPsec block chain
|
||||
safe_system("/usr/lib/firewall/ipsec-block >/dev/null");
|
||||
|
||||
// Reload the configuration into the daemon (#10339).
|
||||
ipsec_reload();
|
||||
|
||||
@@ -302,6 +305,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
// start the system
|
||||
if ((argc == 2) && strcmp(argv[1], "S") == 0) {
|
||||
safe_system("/usr/lib/firewall/ipsec-block >/dev/null");
|
||||
safe_system("/usr/sbin/ipsec restart >/dev/null");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user