AMPR-Rip44
view release on metacpan or search on metacpan
#!/usr/bin/perl
#
# rip44d
#
# A naive custom RIPv2 daemon to receive RIP updates from the
# 44/8 ampr.org routing service, and insert them in the
# Linux routing table.
#
#
# This software is free.
# It is licensed under the EVVKTVH / ICCLEIYSIUYA license
# (public domain, no warranty of any sort).
# http://evvk.com/evvktvh.html#english
#
#
# Version history:
#
# see Changes
# Things to do in the future:
#
# - proper logging to syslog
# - support for better authentication, if one would be supported
# - support for multiple RIP masters, to fix the single point of failure
#
use strict;
use warnings;
use IO::Socket::Multicast;
use Getopt::Std;
use constant {
RIP_HDR_LEN => 4,
RIP_ENTRY_LEN => 2+2+4*4,
RIP_CMD_REQUEST => 1,
RIP_CMD_RESPONSE => 2,
RIP_AUTH_PASSWD => 2,
AF_INET => 2,
};
my $rip_passwd;
my $tunnel_if = 'tunl0';
my $routebin = '/sbin/ip';
my $ifconfig = '/sbin/ifconfig';
my $verbose = 0;
# Local gateway addresses (whose routes are skipped)
my %my_addresses;
# Allowed route destination networks
my $net_44_regexp = '^44\.';
# We do not accept routes less specific than /15
my $minimum_prefix_len = 15;
# tcp window to set
my $tcp_window = 840;
# time (in seconds) to use routes which are no longer advertised
# - this is set to a large value, so that if the rip advertisements
# from mirrorshades stop, the network won't go down right away.
my $route_ttl = 7*24*60*60;
my %current_routes;
my $me = 'rip44d';
my $VERSION = '1.1';
# help and version texts
$Getopt::Std::STANDARD_HELP_VERSION = 1;
sub HELP_MESSAGE()
{
my($fh) = @_;
print $fh "Usage:\n"
( run in 1.649 second using v1.01-cache-2.11-cpan-39bf76dae61 )