=head1 NAME client_option_relayclient - set relay_client property from client options =head1 DESCRIPTION This plugin sets $connection->relay_client if $self->qp->connection->notes('client_options')->{'relay_client'} is set. This allows you to set relay_client via the client_options plugin, which uses a central config file for the clients and allows CIDR notation to specify netmasks (unlike check_relay which allows only octet boundaries). =head1 CONFIGURATION See client_options for details of the format of the client_options file. The key is 'relay_client' and the value can be 0 or 1. =head2 Examples 10.1.2.3 relay_client=1 10.1.2.3 is a relay_client. 10.1.2.96/29 relay_client=1 10.1.2.99 relay_client=0 All addresses from 10.1.2.96 to 10.1.2.103 (inclusive) except 10.1.2.99 are allowed to relay. example.com relay_client=1 All IP adresses which resolve to name in the domain example.com may relay. =cut sub hook_connect { my ($self, $transaction) = @_; my $connection = $self->qp->connection; my $co = $connection->notes('client_options'); if (defined($co) && defined($co->{'relay_client'})) { $self->log(LOGINFO, "setting relay_client=", $co->{'relay_client'}); $connection->relay_client($co->{'relay_client'}); } return DECLINED; }