}
+//
+// Forward a MPPP packet to the master for handling.
+//
+// (Note that this must be called with the tun header
+// as the start of the data).
+// (i.e. this routine writes to data[-8]).
+int master_forward_mppp_packet(sessionidt s, uint8_t *data, int size)
+{
+ uint8_t *p = data - (2 * sizeof(uint32_t));
+ uint8_t *psave = p;
+
+ if (!config->cluster_master_address) // No election has been held yet. Just skip it.
+ return -1;
+
+ LOG(4, 0, 0, "Forward MPPP packet to master (size %d)\n", size);
+
+ add_type(&p, C_MPPP_FORWARD, s, NULL, 0);
+
+ return peer_send_data(config->cluster_master_address, psave, size + (2 * sizeof(uint32_t)));
+
+}
+
//
// Send a chunk of data as a heartbeat..
// We save it in the history buffer as we do so.
exit(1);
}
- LOG(3, 0, 0, "Sending v%d heartbeat #%d, change #%" PRIu64 " with %d changes "
+ LOG(4, 0, 0, "Sending v%d heartbeat #%d, change #%" PRIu64 " with %d changes "
"(%d x-sess, %d x-bundles, %d x-tunnels, %d highsess, %d highbund, %d hightun, size %d)\n",
HB_VERSION, h.seq, h.table_version, config->cluster_num_changes,
count, bcount, tcount, config->cluster_highest_sessionid, config->cluster_highest_bundleid,
return 0;
}
+ case C_MPPP_FORWARD:
+ // Receive a MPPP packet from a slave.
+ if (!config->cluster_iam_master) {
+ LOG(0, 0, 0, "I'm not the master, but I got a C_MPPP_FORWARD from %s?\n", fmtaddr(addr, 0));
+ return -1;
+ }
+
+ processipout(p, s);
+ return 0;
+
case C_THROTTLE: { // Receive a forwarded packet from a slave.
if (!config->cluster_iam_master) {
LOG(0, 0, 0, "I'm not the master, but I got a C_THROTTLE from %s?\n", fmtaddr(addr, 0));
#define C_FORWARD_DAE 16 // A DAE packet for the master to handle
#define C_BUNDLE 17 // Bundle structure.
#define C_CBUNDLE 18 // Compressed bundle structure.
+#define C_MPPP_FORWARD 19 // MPPP Forwarded packet..
#define HB_VERSION 6 // Protocol version number..
#define HB_MAX_SEQ (1<<30) // Maximum sequence number. (MUST BE A POWER OF 2!)
int master_forward_dae_packet(uint8_t *data, int size, in_addr_t addr, int port);
int master_throttle_packet(int tid, uint8_t *data, int size);
int master_garden_packet(sessionidt s, uint8_t *data, int size);
+int master_forward_mppp_packet(sessionidt s, uint8_t *data, int size);
void master_update_counts(void);
void cluster_send_ping(time_t basetime);
void cluster_heartbeat(void);
+l2tpns (2.2.1-2fdn1.5) unstable; urgency=low
+
+ * MLPPP not working in cluster mode.
+
+ -- Fernando Alves <fernando.alves@sameswireless.fr> Wed, 09 May 2012 17:25:05 +0200
+
l2tpns (2.2.1-2fdn1.4) unstable; urgency=low
* Add a echo_timeout configuration option.
// process outgoing (to tunnel) IP
//
-static void processipout(uint8_t *buf, int len)
+// (i.e. this routine writes to data[-8]).
+void processipout(uint8_t *buf, int len)
{
sessionidt s;
sessiont *sp;
if(session[s].bundle != 0 && bundle[session[s].bundle].num_of_links > 1)
{
+
+ if (!config->cluster_iam_master)
+ {
+ // The MPPP packets must be managed by the Master.
+ master_forward_mppp_packet(s, data, size);
+ return;
+ }
+
// Add on L2TP header
sessionidt members[MAXBUNDLESES];
bundleidt bid = session[s].bundle;
if (nb_opened < 1)
{
- LOG(2, s, t, "MPPP: PROCESSIPOUT ERROR, no session opened in bundle:%d\n", bid);
+ LOG(3, s, t, "MPPP: PROCESSIPOUT ERROR, no session opened in bundle:%d\n", bid);
return;
}
{
uint8_t ml;
for(ml = 0; ml<bundle[b].num_of_links; ml++)
- if(bundle[b].members[ml] == s)
- {
- mem_num = ml;
- break;
- }
+ if(bundle[b].members[ml] == s)
+ {
+ mem_num = ml;
+ break;
+ }
bundle[b].members[mem_num] = bundle[b].members[bundle[b].num_of_links];
LOG(3, s, session[s].tunnel, "MPPP: Adjusted member links array\n");
case 0: // message type
message = ntohs(*(uint16_t *) b);
mandatory = flags & 0x80;
- LOG(4, s, t, " Message type = %u (%s)\n", *b, l2tp_code(message));
+ LOG(4, s, t, " Message type = %u (%s)\n", message, l2tp_code(message));
break;
case 1: // result code
{
}
// read and process packet on tun
+// (i.e. this routine writes to buf[-8]).
static void processtun(uint8_t * buf, int len)
{
LOG_HEX(5, "Receive TUN Data", buf, len);
{
int i;
uint8_t buf[65536];
+ uint8_t *p = buf + 8; // for the hearder of the forwarded MPPP packet (see C_MPPP_FORWARD)
+ int size_bufp = sizeof(buf) - 8;
clockt next_cluster_ping = 0; // send initial ping immediately
struct epoll_event events[BASE_FDS + RADIUS_FDS + EXTRA_FDS];
int maxevent = sizeof(events)/sizeof(*events);
// incoming IP
if (tun_ready)
{
- if ((s = read(tunfd, buf, sizeof(buf))) > 0)
+ if ((s = read(tunfd, p, size_bufp)) > 0)
{
- processtun(buf, s);
+ processtun(p, s);
tun_pkts++;
}
else
void sendipcp(sessionidt s, tunnelidt t);
void sendipv6cp(sessionidt s, tunnelidt t);
void processudp(uint8_t *buf, int len, struct sockaddr_in *addr);
+void processipout(uint8_t *buf, int len);
void snoop_send_packet(uint8_t *packet, uint16_t size, in_addr_t destination, uint16_t port);
int find_filter(char const *name, size_t len);
int ip_filter(uint8_t *buf, int len, uint8_t filter);