From 2b05f31dc724539454f67ea09fb2bd04e5a51e40 Mon Sep 17 00:00:00 2001 From: Brendan O'Dea Date: Fri, 2 Sep 2005 23:59:56 +0000 Subject: [PATCH] add cluster_mcast_ttl option --- Changes | 2 ++ Docs/manual.html | 4 ++++ Docs/startup-config.5 | 5 ++++- THANKS | 1 + cluster.c | 11 ++++++++++- l2tpns.c | 4 +++- l2tpns.h | 3 ++- 7 files changed, 26 insertions(+), 4 deletions(-) diff --git a/Changes b/Changes index be6c2da..04cbf79 100644 --- a/Changes +++ b/Changes @@ -3,6 +3,8 @@ - Increase size of PPP buffers to MAXETHER. - Bug fixes for CLI ringbuffer and tunnel HELLO from Yuri. - Restart rather than halt BGP on receipt of CEASE (Dominique Rousseau). +- Add cluster_mcast_ttl option to allow a cluster to span multiple + subnets (suggested by Tim Devries). * Mon Aug 29 2005 Brendan O'Dea 2.1.4 - Drop level of "Unexpected CHAP message" log. diff --git a/Docs/manual.html b/Docs/manual.html index 65d7f4c..bebc7c8 100644 --- a/Docs/manual.html +++ b/Docs/manual.html @@ -335,6 +335,10 @@ on Clustering for more information. Interface for cluster packets (default: eth0). +
  • cluster_mcast_ttl (int)
    +TTL for multicast packets (default: 1). +
  • +
  • cluster_hb_interval (int)
    Interval in tenths of a second between cluster heartbeat/pings.
  • diff --git a/Docs/startup-config.5 b/Docs/startup-config.5 index c403de1..ee59995 100644 --- a/Docs/startup-config.5 +++ b/Docs/startup-config.5 @@ -2,7 +2,7 @@ .de Id .ds Dt \\$4 \\$5 .. -.Id $Id: startup-config.5,v 1.12 2005-07-31 10:04:14 bodea Exp $ +.Id $Id: startup-config.5,v 1.13 2005-09-02 23:59:56 bodea Exp $ .TH STARTUP-CONFIG 5 "\*(Dt" L2TPNS "File Formats and Conventions" .SH NAME startup\-config \- configuration file for l2tpns @@ -194,6 +194,9 @@ Multicast cluster address (default: 239.192.13.13). .B cluster_interface Interface for cluster packets (default: eth0). .TP +.B cluster_mcast_ttl +TTL for multicast packets (default: 1). +.TP .B cluster_hb_interval Interval in tenths of a second between cluster heartbeat/pings. .TP diff --git a/THANKS b/THANKS index 679ec31..16e4f5b 100644 --- a/THANKS +++ b/THANKS @@ -18,3 +18,4 @@ Jordan Hrycaj Vladislav Bjelic Alex Kiernan Dominique Rousseau +Tim Devries diff --git a/cluster.c b/cluster.c index 2370eaf..12e7c08 100644 --- a/cluster.c +++ b/cluster.c @@ -1,6 +1,6 @@ // L2TPNS Clustering Stuff -char const *cvs_id_cluster = "$Id: cluster.c,v 1.45 2005-07-31 10:04:09 bodea Exp $"; +char const *cvs_id_cluster = "$Id: cluster.c,v 1.46 2005-09-02 23:59:56 bodea Exp $"; #include #include @@ -127,6 +127,15 @@ int cluster_init() opt = 0; // Turn off multicast loopback. setsockopt(cluster_sockfd, IPPROTO_IP, IP_MULTICAST_LOOP, &opt, sizeof(opt)); + if (config->cluster_mcast_ttl != 1) + { + uint8_t ttl = 0; + if (config->cluster_mcast_ttl > 0) + ttl = config->cluster_mcast_ttl < 256 ? config->cluster_mcast_ttl : 255; + + setsockopt(cluster_sockfd, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof(ttl)); + } + if (setsockopt(cluster_sockfd, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq)) < 0) { LOG(0, 0, 0, "Failed to setsockopt (join mcast group): %s\n", strerror(errno)); diff --git a/l2tpns.c b/l2tpns.c index 8b2bffd..384e7ca 100644 --- a/l2tpns.c +++ b/l2tpns.c @@ -4,7 +4,7 @@ // Copyright (c) 2002 FireBrick (Andrews & Arnold Ltd / Watchfront Ltd) - GPL licenced // vim: sw=8 ts=8 -char const *cvs_id_l2tpns = "$Id: l2tpns.c,v 1.127 2005-09-01 06:59:06 bodea Exp $"; +char const *cvs_id_l2tpns = "$Id: l2tpns.c,v 1.128 2005-09-02 23:59:56 bodea Exp $"; #include #include @@ -135,6 +135,7 @@ config_descriptt config_values[] = { CONFIG("packet_limit", max_packets, INT), CONFIG("cluster_address", cluster_address, IPv4), CONFIG("cluster_interface", cluster_interface, STRING), + CONFIG("cluster_mcast_ttl", cluster_mcast_ttl, INT), CONFIG("cluster_hb_interval", cluster_hb_interval, INT), CONFIG("cluster_hb_timeout", cluster_hb_timeout, INT), CONFIG("cluster_master_min_adv", cluster_master_min_adv, INT), @@ -3469,6 +3470,7 @@ static void initdata(int optdebug, char *optconfig) config->debug = optdebug; config->num_tbfs = MAXTBFS; config->rl_rate = 28; // 28kbps + config->cluster_mcast_ttl = 1; config->cluster_master_min_adv = 1; config->ppp_restart_time = 3; config->ppp_max_configure = 10; diff --git a/l2tpns.h b/l2tpns.h index cd6e005..7b5a95c 100644 --- a/l2tpns.h +++ b/l2tpns.h @@ -1,5 +1,5 @@ // L2TPNS Global Stuff -// $Id: l2tpns.h,v 1.86 2005-08-31 12:38:38 bodea Exp $ +// $Id: l2tpns.h,v 1.87 2005-09-02 23:59:56 bodea Exp $ #ifndef __L2TPNS_H__ #define __L2TPNS_H__ @@ -570,6 +570,7 @@ typedef struct int cluster_last_hb_ver; // Heartbeat version last seen from master int cluster_num_changes; // Number of changes queued. + int cluster_mcast_ttl; // TTL for multicast packets int cluster_hb_interval; // How often to send a heartbeat. int cluster_hb_timeout; // How many missed heartbeats trigger an election. uint64_t cluster_table_version; // # state changes processed by cluster -- 2.20.1