start merging Jonathan's IPv6 patches (01-defines, 02-ipv6-cli)
This commit is contained in:
parent
6c4ac1aa6a
commit
9cb7003d33
5 changed files with 53 additions and 39 deletions
3
Changes
3
Changes
|
|
@ -1,3 +1,6 @@
|
||||||
|
* Sat Dec 18 2004 Brendan O'Dea <bod@optusnet.com.au> 2.1.0
|
||||||
|
- Add IPv6 support from Jonathan McDowell (work in progress).
|
||||||
|
|
||||||
* Fri Dec 17 2004 Brendan O'Dea <bod@optusnet.com.au> 2.0.13
|
* Fri Dec 17 2004 Brendan O'Dea <bod@optusnet.com.au> 2.0.13
|
||||||
- Better cluster master collision resolution: keep a counter of state
|
- Better cluster master collision resolution: keep a counter of state
|
||||||
changes, propagated in the heartbeats; the master with the highest #
|
changes, propagated in the heartbeats; the master with the highest #
|
||||||
|
|
|
||||||
51
cli.c
51
cli.c
|
|
@ -2,7 +2,7 @@
|
||||||
// vim: sw=8 ts=8
|
// vim: sw=8 ts=8
|
||||||
|
|
||||||
char const *cvs_name = "$Name: $";
|
char const *cvs_name = "$Name: $";
|
||||||
char const *cvs_id_cli = "$Id: cli.c,v 1.43 2004/12/17 00:28:00 bodea Exp $";
|
char const *cvs_id_cli = "$Id: cli.c,v 1.44 2004/12/18 01:20:05 bodea Exp $";
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
@ -98,6 +98,7 @@ static int cmd_set(struct cli_def *cli, char *command, char **argv, int argc);
|
||||||
static int cmd_load_plugin(struct cli_def *cli, char *command, char **argv, int argc);
|
static int cmd_load_plugin(struct cli_def *cli, char *command, char **argv, int argc);
|
||||||
static int cmd_remove_plugin(struct cli_def *cli, char *command, char **argv, int argc);
|
static int cmd_remove_plugin(struct cli_def *cli, char *command, char **argv, int argc);
|
||||||
static int cmd_uptime(struct cli_def *cli, char *command, char **argv, int argc);
|
static int cmd_uptime(struct cli_def *cli, char *command, char **argv, int argc);
|
||||||
|
|
||||||
static int regular_stuff(struct cli_def *cli);
|
static int regular_stuff(struct cli_def *cli);
|
||||||
static void parsemac(char *string, char mac[6]);
|
static void parsemac(char *string, char mac[6]);
|
||||||
|
|
||||||
|
|
@ -889,6 +890,7 @@ static char const *show_access_list_rule(int extended, ip_filter_rulet *rule);
|
||||||
static int cmd_show_run(struct cli_def *cli, char *command, char **argv, int argc)
|
static int cmd_show_run(struct cli_def *cli, char *command, char **argv, int argc)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
char ipv6addr[INET6_ADDRSTRLEN];
|
||||||
|
|
||||||
if (CLI_HELP_REQUESTED)
|
if (CLI_HELP_REQUESTED)
|
||||||
return CLI_HELP_NO_ARGS;
|
return CLI_HELP_NO_ARGS;
|
||||||
|
|
@ -899,25 +901,27 @@ static int cmd_show_run(struct cli_def *cli, char *command, char **argv, int arg
|
||||||
{
|
{
|
||||||
void *value = ((void *)config) + config_values[i].offset;
|
void *value = ((void *)config) + config_values[i].offset;
|
||||||
if (config_values[i].type == STRING)
|
if (config_values[i].type == STRING)
|
||||||
cli_print(cli, "set %s \"%.*s\"", config_values[i].key, config_values[i].size, (char *)value);
|
cli_print(cli, "set %s \"%.*s\"", config_values[i].key, config_values[i].size, (char *) value);
|
||||||
else if (config_values[i].type == IP)
|
else if (config_values[i].type == IPv4)
|
||||||
cli_print(cli, "set %s %s", config_values[i].key, fmtaddr(*(unsigned *)value, 0));
|
cli_print(cli, "set %s %s", config_values[i].key, fmtaddr(*(in_addr_t *) value, 0));
|
||||||
|
else if (config_values[i].type == IPv6)
|
||||||
|
cli_print(cli, "set %s %s", config_values[i].key, inet_ntop(AF_INET6, value, ipv6addr, INET6_ADDRSTRLEN));
|
||||||
else if (config_values[i].type == SHORT)
|
else if (config_values[i].type == SHORT)
|
||||||
cli_print(cli, "set %s %hu", config_values[i].key, *(short *)value);
|
cli_print(cli, "set %s %hu", config_values[i].key, *(short *) value);
|
||||||
else if (config_values[i].type == BOOL)
|
else if (config_values[i].type == BOOL)
|
||||||
cli_print(cli, "set %s %s", config_values[i].key, (*(int *)value) ? "yes" : "no");
|
cli_print(cli, "set %s %s", config_values[i].key, (*(int *) value) ? "yes" : "no");
|
||||||
else if (config_values[i].type == INT)
|
else if (config_values[i].type == INT)
|
||||||
cli_print(cli, "set %s %d", config_values[i].key, *(int *)value);
|
cli_print(cli, "set %s %d", config_values[i].key, *(int *) value);
|
||||||
else if (config_values[i].type == UNSIGNED_LONG)
|
else if (config_values[i].type == UNSIGNED_LONG)
|
||||||
cli_print(cli, "set %s %lu", config_values[i].key, *(unsigned long *)value);
|
cli_print(cli, "set %s %lu", config_values[i].key, *(unsigned long *) value);
|
||||||
else if (config_values[i].type == MAC)
|
else if (config_values[i].type == MAC)
|
||||||
cli_print(cli, "set %s %02x%02x.%02x%02x.%02x%02x", config_values[i].key,
|
cli_print(cli, "set %s %02x%02x.%02x%02x.%02x%02x", config_values[i].key,
|
||||||
*(unsigned short *)(value + 0),
|
*(unsigned short *) (value + 0),
|
||||||
*(unsigned short *)(value + 1),
|
*(unsigned short *) (value + 1),
|
||||||
*(unsigned short *)(value + 2),
|
*(unsigned short *) (value + 2),
|
||||||
*(unsigned short *)(value + 3),
|
*(unsigned short *) (value + 3),
|
||||||
*(unsigned short *)(value + 4),
|
*(unsigned short *) (value + 4),
|
||||||
*(unsigned short *)(value + 5));
|
*(unsigned short *) (value + 5));
|
||||||
}
|
}
|
||||||
|
|
||||||
cli_print(cli, "# Plugins");
|
cli_print(cli, "# Plugins");
|
||||||
|
|
@ -1826,28 +1830,31 @@ static int cmd_set(struct cli_def *cli, char *command, char **argv, int argc)
|
||||||
switch (config_values[i].type)
|
switch (config_values[i].type)
|
||||||
{
|
{
|
||||||
case STRING:
|
case STRING:
|
||||||
strncpy((char *)value, argv[1], config_values[i].size - 1);
|
strncpy((char *) value, argv[1], config_values[i].size - 1);
|
||||||
break;
|
break;
|
||||||
case INT:
|
case INT:
|
||||||
*(int *)value = atoi(argv[1]);
|
*(int *) value = atoi(argv[1]);
|
||||||
break;
|
break;
|
||||||
case UNSIGNED_LONG:
|
case UNSIGNED_LONG:
|
||||||
*(unsigned long *)value = atol(argv[1]);
|
*(unsigned long *) value = atol(argv[1]);
|
||||||
break;
|
break;
|
||||||
case SHORT:
|
case SHORT:
|
||||||
*(short *)value = atoi(argv[1]);
|
*(short *) value = atoi(argv[1]);
|
||||||
break;
|
break;
|
||||||
case IP:
|
case IPv4:
|
||||||
*(unsigned *)value = inet_addr(argv[1]);
|
*(in_addr_t *) value = inet_addr(argv[1]);
|
||||||
|
break;
|
||||||
|
case IPv6:
|
||||||
|
inet_pton(AF_INET6, argv[1], value);
|
||||||
break;
|
break;
|
||||||
case MAC:
|
case MAC:
|
||||||
parsemac(argv[1], (char *)value);
|
parsemac(argv[1], (char *)value);
|
||||||
break;
|
break;
|
||||||
case BOOL:
|
case BOOL:
|
||||||
if (strcasecmp(argv[1], "yes") == 0 || strcasecmp(argv[1], "true") == 0 || strcasecmp(argv[1], "1") == 0)
|
if (strcasecmp(argv[1], "yes") == 0 || strcasecmp(argv[1], "true") == 0 || strcasecmp(argv[1], "1") == 0)
|
||||||
*(int *)value = 1;
|
*(int *) value = 1;
|
||||||
else
|
else
|
||||||
*(int *)value = 0;
|
*(int *) value = 0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
cli_print(cli, "Unknown variable type");
|
cli_print(cli, "Unknown variable type");
|
||||||
|
|
|
||||||
18
l2tpns.c
18
l2tpns.c
|
|
@ -4,7 +4,7 @@
|
||||||
// Copyright (c) 2002 FireBrick (Andrews & Arnold Ltd / Watchfront Ltd) - GPL licenced
|
// Copyright (c) 2002 FireBrick (Andrews & Arnold Ltd / Watchfront Ltd) - GPL licenced
|
||||||
// vim: sw=8 ts=8
|
// vim: sw=8 ts=8
|
||||||
|
|
||||||
char const *cvs_id_l2tpns = "$Id: l2tpns.c,v 1.73 2004/12/17 00:28:00 bodea Exp $";
|
char const *cvs_id_l2tpns = "$Id: l2tpns.c,v 1.74 2004/12/18 01:20:05 bodea Exp $";
|
||||||
|
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
@ -95,17 +95,17 @@ config_descriptt config_values[] = {
|
||||||
CONFIG("log_file", log_filename, STRING),
|
CONFIG("log_file", log_filename, STRING),
|
||||||
CONFIG("pid_file", pid_file, STRING),
|
CONFIG("pid_file", pid_file, STRING),
|
||||||
CONFIG("l2tp_secret", l2tpsecret, STRING),
|
CONFIG("l2tp_secret", l2tpsecret, STRING),
|
||||||
CONFIG("primary_dns", default_dns1, IP),
|
CONFIG("primary_dns", default_dns1, IPv4),
|
||||||
CONFIG("secondary_dns", default_dns2, IP),
|
CONFIG("secondary_dns", default_dns2, IPv4),
|
||||||
CONFIG("save_state", save_state, BOOL),
|
CONFIG("save_state", save_state, BOOL),
|
||||||
CONFIG("primary_radius", radiusserver[0], IP),
|
CONFIG("primary_radius", radiusserver[0], IPv4),
|
||||||
CONFIG("secondary_radius", radiusserver[1], IP),
|
CONFIG("secondary_radius", radiusserver[1], IPv4),
|
||||||
CONFIG("primary_radius_port", radiusport[0], SHORT),
|
CONFIG("primary_radius_port", radiusport[0], SHORT),
|
||||||
CONFIG("secondary_radius_port", radiusport[1], SHORT),
|
CONFIG("secondary_radius_port", radiusport[1], SHORT),
|
||||||
CONFIG("radius_accounting", radius_accounting, BOOL),
|
CONFIG("radius_accounting", radius_accounting, BOOL),
|
||||||
CONFIG("radius_secret", radiussecret, STRING),
|
CONFIG("radius_secret", radiussecret, STRING),
|
||||||
CONFIG("bind_address", bind_address, IP),
|
CONFIG("bind_address", bind_address, IPv4),
|
||||||
CONFIG("peer_address", peer_address, IP),
|
CONFIG("peer_address", peer_address, IPv4),
|
||||||
CONFIG("send_garp", send_garp, BOOL),
|
CONFIG("send_garp", send_garp, BOOL),
|
||||||
CONFIG("throttle_speed", rl_rate, UNSIGNED_LONG),
|
CONFIG("throttle_speed", rl_rate, UNSIGNED_LONG),
|
||||||
CONFIG("throttle_buckets", num_tbfs, INT),
|
CONFIG("throttle_buckets", num_tbfs, INT),
|
||||||
|
|
@ -117,7 +117,7 @@ config_descriptt config_values[] = {
|
||||||
CONFIG("scheduler_fifo", scheduler_fifo, BOOL),
|
CONFIG("scheduler_fifo", scheduler_fifo, BOOL),
|
||||||
CONFIG("lock_pages", lock_pages, BOOL),
|
CONFIG("lock_pages", lock_pages, BOOL),
|
||||||
CONFIG("icmp_rate", icmp_rate, INT),
|
CONFIG("icmp_rate", icmp_rate, INT),
|
||||||
CONFIG("cluster_address", cluster_address, IP),
|
CONFIG("cluster_address", cluster_address, IPv4),
|
||||||
CONFIG("cluster_interface", cluster_interface, STRING),
|
CONFIG("cluster_interface", cluster_interface, STRING),
|
||||||
CONFIG("cluster_hb_interval", cluster_hb_interval, INT),
|
CONFIG("cluster_hb_interval", cluster_hb_interval, INT),
|
||||||
CONFIG("cluster_hb_timeout", cluster_hb_timeout, INT),
|
CONFIG("cluster_hb_timeout", cluster_hb_timeout, INT),
|
||||||
|
|
@ -1993,7 +1993,7 @@ static void processtun(uint8_t * buf, int len)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*(uint16_t *) (buf + 2) == htons(PKTIP)) // IP
|
if (*(uint16_t *) (buf + 2) == htons(PKTIP)) // IPv4
|
||||||
processipout(buf, len);
|
processipout(buf, len);
|
||||||
// Else discard.
|
// Else discard.
|
||||||
}
|
}
|
||||||
|
|
|
||||||
14
l2tpns.h
14
l2tpns.h
|
|
@ -1,5 +1,5 @@
|
||||||
// L2TPNS Global Stuff
|
// L2TPNS Global Stuff
|
||||||
// $Id: l2tpns.h,v 1.49 2004/12/17 00:28:00 bodea Exp $
|
// $Id: l2tpns.h,v 1.50 2004/12/18 01:20:05 bodea Exp $
|
||||||
|
|
||||||
#ifndef __L2TPNS_H__
|
#ifndef __L2TPNS_H__
|
||||||
#define __L2TPNS_H__
|
#define __L2TPNS_H__
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <libcli.h>
|
#include <libcli.h>
|
||||||
|
|
||||||
#define VERSION "2.0.13"
|
#define VERSION "2.1.0"
|
||||||
|
|
||||||
// Limits
|
// Limits
|
||||||
#define MAXTUNNEL 500 // could be up to 65535
|
#define MAXTUNNEL 500 // could be up to 65535
|
||||||
|
|
@ -81,14 +81,16 @@
|
||||||
#define L2TPPORT 1701 // L2TP port
|
#define L2TPPORT 1701 // L2TP port
|
||||||
#define RADPORT 1645 // old radius port...
|
#define RADPORT 1645 // old radius port...
|
||||||
#define PKTARP 0x0806 // ARP packet type
|
#define PKTARP 0x0806 // ARP packet type
|
||||||
#define PKTIP 0x0800 // IP packet type
|
#define PKTIP 0x0800 // IPv4 packet type
|
||||||
#define PSEUDOMAC 0x0200 // pseudo MAC prefix (local significant MAC)
|
#define PKTIPV6 0x86DD // IPv6 packet type
|
||||||
#define PPPPAP 0xC023
|
#define PPPPAP 0xC023
|
||||||
#define PPPCHAP 0xC223
|
#define PPPCHAP 0xC223
|
||||||
#define PPPLCP 0xC021
|
#define PPPLCP 0xC021
|
||||||
#define PPPIPCP 0x8021
|
#define PPPIPCP 0x8021
|
||||||
|
#define PPPIPV6CP 0x8057
|
||||||
#define PPPCCP 0x80FD
|
#define PPPCCP 0x80FD
|
||||||
#define PPPIP 0x0021
|
#define PPPIP 0x0021
|
||||||
|
#define PPPIPV6 0x0057
|
||||||
#define PPPMP 0x003D
|
#define PPPMP 0x003D
|
||||||
#define MIN_IP_SIZE 0x19
|
#define MIN_IP_SIZE 0x19
|
||||||
enum
|
enum
|
||||||
|
|
@ -208,6 +210,8 @@ sessiont;
|
||||||
#define SF_IPCP_ACKED 1 // Has this session seen an IPCP Ack?
|
#define SF_IPCP_ACKED 1 // Has this session seen an IPCP Ack?
|
||||||
#define SF_LCP_ACKED 2 // LCP negotiated
|
#define SF_LCP_ACKED 2 // LCP negotiated
|
||||||
#define SF_CCP_ACKED 4 // CCP negotiated
|
#define SF_CCP_ACKED 4 // CCP negotiated
|
||||||
|
#define SF_IPV6CP_ACKED 8 // IPv6 negotiated
|
||||||
|
#define SF_IPV6_NACKED 16 // IPv6 rejected
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
|
@ -480,7 +484,7 @@ typedef struct
|
||||||
#endif
|
#endif
|
||||||
} configt;
|
} configt;
|
||||||
|
|
||||||
enum config_typet { INT, STRING, UNSIGNED_LONG, SHORT, BOOL, IP, MAC };
|
enum config_typet { INT, STRING, UNSIGNED_LONG, SHORT, BOOL, IPv4, IPv6, MAC };
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
char *key;
|
char *key;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
Summary: A high-speed clustered L2TP LNS
|
Summary: A high-speed clustered L2TP LNS
|
||||||
Name: l2tpns
|
Name: l2tpns
|
||||||
Version: 2.0.13
|
Version: 2.1.0
|
||||||
Release: 1
|
Release: 1
|
||||||
Copyright: GPL
|
Copyright: GPL
|
||||||
Group: System Environment/Daemons
|
Group: System Environment/Daemons
|
||||||
|
|
@ -43,5 +43,5 @@ rm -rf %{buildroot}
|
||||||
%attr(644,root,root) /usr/share/man/man[58]/*
|
%attr(644,root,root) /usr/share/man/man[58]/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Fri Dec 17 2004 Brendan O'Dea <bod@optusnet.com.au> 2.0.13-1
|
* Sat Dec 18 2004 Brendan O'Dea <bod@optusnet.com.au> 2.1.0-1
|
||||||
- 2.0.13 release, see /usr/share/doc/l2tpns-2.0.13/Changes
|
- 2.1.0 release, see /usr/share/doc/l2tpns-2.1.0/Changes
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue