2 # set list of bad dx nodes
4 # Copyright (c) 2021 - Dirk Koopman G1TLH
8 my ($self, $line) = @_;
9 return (1, $self->msg('e5')) if $self->remotecmd;
11 return (1, $self->msg('e5')) if $self->priv < 6;
12 return (1, q{Please install Net::CIDR::Lite or libnet-cidr-lite-perl to use this command}) unless $DXCIDR::active;
16 my @in = split /\s+/, $line;
18 if ($in[0] =~ /^[_\d\w]+$/) {
21 return (1, "set/badip: need [suffix (def: local])] IP, IP-IP or IP/24") unless @in;
24 unless (is_ipaddr($ip)) {
25 push @out, "set/badip: '$ip' is not an ip address, ignored";
28 eval{ $r = DXCIDR::find($ip); };
29 return (1, "set/badip: $ip $@") if $@;
31 push @out, "set/badip: $ip exists, not added";
34 DXCIDR::add($suffix, $ip);
38 my $list = join ' ', @in;
42 DXCIDR::append($suffix, @added);
43 push @out, "set/badip: added $count entries to badip.$suffix : '$list'";
45 push @out, "set/badip: No valid IPs, not updating badip.$suffix with '$list'";