Skip to content

Commit

Permalink
mxrouter: add option disable_ipv4_rp_filter for interface
Browse files Browse the repository at this point in the history
When we have unsymmetrical routing, we need to accept
foreing packets. Make ipv4_rp_filter optional.
  • Loading branch information
donald committed Sep 14, 2017
1 parent 80b6dba commit 5f5e8a8
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions mxrouter/mxrouterctl
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,13 @@ sync=1
__EOF__
}

our %disable_ipv4_rp_filter = ('all' => 1); # this is AND ( https://marc.info/?l=linux-kernel&m=123606366021995&w=2 )

sub disable_ipv4_rp_filter {
my ($if)=@_;
$disable_ipv4_rp_filter{$if}=1;
}

sub start {

-d "/var/run/mxrouter/$NETNS" or sys ('mkdir','-p',"/var/run/mxrouter/$NETNS");
Expand Down Expand Up @@ -479,9 +486,11 @@ sub start {
warn "disable IPV4 send redirects on $dev\n" unless $opt_quiet;
set_ipv4_send_redirects($dev,0);
}
if (get_ipv4_rp_filter($dev)==0) {
warn "enable reverse path filter on $dev\n" unless $opt_quiet;
set_ipv4_rp_filter($dev,1);

my $ipv4_rp_filter = $disable_ipv4_rp_filter{$dev} ? 0 : 1;
if (get_ipv4_rp_filter($dev)!=$ipv4_rp_filter) {
warn (($ipv4_rp_filter ? "enable" : "disable")." ipv4_rp_filter on $dev\n") unless $opt_quiet;
set_ipv4_rp_filter($dev,$ipv4_rp_filter);
}
# if (get_ipv4_log_martians($dev)==0) {
# warn "enable martians log on $dev\n" unless $opt_quiet;
Expand Down

0 comments on commit 5f5e8a8

Please sign in to comment.