xl2tpd: Updated to v1.3.14les

arm-ng
AndreDVJ 7 years ago committed by kille72
parent a563ce00a1
commit ff09c08e98

@ -1,3 +1,28 @@
v1.3.14 (April 17, 2019)
* osport.h: replace SUSv3-specific functions by POSIX variants [Fabrice Fontaine]
* avp: Error Code field in Result Code AVP is optional [Pau Espin Pedrol]
* network_thread: Early continue in loop to remove huge indented block [Pau Espin Pedrol]
* network_thread: Simplify while loop using for loop [Pau Espin Pedrol]
* network: connect_pppol2tp: early return to avoid huge indentation block [Pau Espin Pedrol]
* xl2tpd: start_pppd: Fix truncation of last character [Pau Espin Pedrol]
* handle_packet: Remove unneded else clause when handling payload [Pau Espin Pedrol]
* control: Split control message handling into its own function [Pau Espin Pedrol]
* handle_packet: Rearrange code flow to simplify it [Pau Espin Pedrol]
* avp: Early failure if no handler to remove indent block [Pau Espin Pedrol]
* xl2tpd: Mark internal symbols as static [Pau Espin Pedrol]
* Fix indentation and whitespace in code block [Pau Espin Pedrol]
* xl2tpd: Remove unused variable [Pau Espin Pedrol]
* network: Add missing close(kernel_fd) on init network failure [Pau Espin Pedrol]
* network: Add missing close(server_fd) on init network failure [Pau Espin Pedrol]
* Add 'cap backoff' option, limiting exponential backoff retries will
be delayed by exponentially longer time, unless that time is capped
by configuration. [Bart Trojanowski]
* Add program to show status icon in system tray. [Github user: username34]
* Add info on building and installing xl2tpd [Samir Hussain]
* Update formatting of README.md [Samir Hussain]
* Rename README.xl2tpd to README.md [Samir Hussain]
* Update Debian changelog [Samir Hussain]
v1.3.13 (December 3, 2018)
* Specify email address for reporting security vulnerabilities [Samir Hussain]
* Fix compile warning with USE_KERNEL in xl2tpd.c [Samir Hussain]

@ -1 +1 @@
XL2TPDVERSION=1.3.13
XL2TPDVERSION=1.3.14

@ -1,6 +1,4 @@
URL : https://www.xelerance.com/software/xl2tpd/
Summary : Layer 2 Tunnelling Protocol Daemon (RFC 2661)
Description :
# xl2tpd
xl2tpd is an implementation of the Layer 2 Tunnelling Protocol (RFC 2661).
L2TP allows you to tunnel PPP over UDP. Some ISPs use L2TP to tunnel user
@ -31,9 +29,17 @@ NOTE: In Linux kernel 4.15+ there is a kernel bug with ancillary IP_PKTINFO.
As such, for Linux kernel 4.15+ we recommend the community use xl2tpd
1.3.12+
Mailing Lists :
https://lists.openswan.org/cgi-bin/mailman/listinfo/xl2tpd is home of the
mailing list. Note: This is a closed list - you *must* be subscribed to post.
## Build and install
make
sudo make install
Security Vulnerability :
Security vulnerabilities can be e-mailed to: security@xelerance.com
## Mailing Lists
https://lists.openswan.org/cgi-bin/mailman/listinfo/xl2tpd is home of the mailing list.
Note: This is a closed list - you **must** be subscribed to post.
## Security Vulnerability
Security vulnerabilities can be e-mailed to: security@xelerance.com

@ -443,19 +443,19 @@ int result_code_avp (struct tunnel *t, struct call *c, void *data,
* I'm not sure what we're supposed to do with this but whatever..
*/
int error;
int error = -1; /* error code unset */
int result;
struct unaligned_u16 *raw = data;
#ifdef SANITY
if (t->sanity)
{
if (datalen < 10)
if (datalen < 8)
{
if (DEBUG)
l2tp_log (LOG_DEBUG,
"%s: avp is incorrect size. %d < 10\n", __FUNCTION__,
"%s: avp is incorrect size. %d < 8\n", __FUNCTION__,
datalen);
wrong_length (c, "Result Code", 10, datalen, 1);
wrong_length (c, "Result Code", 8, datalen, 1);
return -EINVAL;
}
switch (c->msgtype)
@ -473,7 +473,6 @@ int result_code_avp (struct tunnel *t, struct call *c, void *data,
}
#endif
result = ntohs (raw[3].s);
error = ntohs (raw[4].s);
/*
* from prepare_StopCCN and prepare_CDN, note missing htons() call
@ -488,15 +487,6 @@ int result_code_avp (struct tunnel *t, struct call *c, void *data,
result >>= 8;
}
if (((error & 0xFF) == 0) && (error >> 8 != 0))
{
if (DEBUG)
l2tp_log (LOG_DEBUG,
"%s: error code endianness fix for buggy Apple client. network=%d, le=%d\n",
__FUNCTION__, error, error >> 8);
error >>= 8;
}
if ((c->msgtype == StopCCN) && ((result > 7) || (result < 1)))
{
if (DEBUG)
@ -515,9 +505,24 @@ int result_code_avp (struct tunnel *t, struct call *c, void *data,
return 0;
}
if (datalen >= 10) {
error = ntohs (raw[4].s);
if (((error & 0xFF) == 0) && (error >> 8 != 0))
{
if (DEBUG)
l2tp_log (LOG_DEBUG,
"%s: error code endianness fix for buggy Apple client. network=%d, le=%d\n",
__FUNCTION__, error, error >> 8);
error >>= 8;
}
}
c->error = error;
c->result = result;
safe_copy (c->errormsg, (char *) &raw[5].s, datalen - 10);
if (datalen > 10)
safe_copy (c->errormsg, (char *) &raw[5].s, datalen - 10);
else
c->errormsg[0] = 0;
if (gconfig.debug_avp)
{
if (DEBUG && (c->msgtype == StopCCN))
@ -1631,6 +1636,8 @@ int handle_avps (struct buffer *buf, struct tunnel *t, struct call *c)
* checking is done at this point.
*/
/* TODO: Refactor function to not use "goto next" */
struct avp_hdr *avp;
int len = buf->len - sizeof (struct control_hdr);
int firstavp = -1;
@ -1738,30 +1745,8 @@ int handle_avps (struct buffer *buf, struct tunnel *t, struct call *c)
}
else
hidlen = 0;
if (avps[avp->attr].handler)
{
if (avps[avp->attr].handler (t, c, avp, ALENGTH (avp->length)))
{
if (AMBIT (avp->length))
{
l2tp_log (LOG_WARNING,
"%s: Bad exit status handling attribute %d (%s) on mandatory packet.\n",
__FUNCTION__, avp->attr,
avps[avp->attr].description);
c->needclose = -1;
return -EINVAL;
}
else
{
if (DEBUG)
l2tp_log (LOG_DEBUG,
"%s: Bad exit status handling attribute %d (%s).\n",
__FUNCTION__, avp->attr,
avps[avp->attr].description);
}
}
}
else
if (!avps[avp->attr].handler)
{
if (AMBIT (avp->length))
{
@ -1779,8 +1764,31 @@ int handle_avps (struct buffer *buf, struct tunnel *t, struct call *c)
l2tp_log (LOG_WARNING, "%s: no handler for attribute %d (%s).\n",
__FUNCTION__, avp->attr,
avps[avp->attr].description);
goto next;
}
}
if (avps[avp->attr].handler (t, c, avp, ALENGTH (avp->length)))
{
if (AMBIT (avp->length))
{
l2tp_log (LOG_WARNING,
"%s: Bad exit status handling attribute %d (%s) on mandatory packet.\n",
__FUNCTION__, avp->attr,
avps[avp->attr].description);
c->needclose = -1;
return -EINVAL;
}
else
{
if (DEBUG)
l2tp_log (LOG_DEBUG,
"%s: Bad exit status handling attribute %d (%s).\n",
__FUNCTION__, avp->attr,
avps[avp->attr].description);
}
}
next:
if (hidlen && ALENGTH(hidlen))
{

@ -0,0 +1,30 @@
This program read xl2tpd log file and show status icon in system tray.
To compile it name file main.cpp and execute command in terminal.
g++ `pkg-config --cflags --libs gtk+-2.0` main.cpp -o xl2tpd-tray-icon
then copy xl2tpd-tray-icon to directory /usr/bin
then copy 4 image files (connect.png, disconnect.png, online.png, offline.png)
to directory /usr/share/xl2tpd-tray-icon
then make file /etc/xdg/autostart/xl2tpd-tray-icon.desktop with content
[Desktop Entry]
Name=xl2tpd-tray-icon
Exec=xl2tpd-tray-icon
Terminal=false
Type=Application
X-GNOME-Autostart-enabled=true
after reboot program will start automatically.
-----
Images are from Openclipart (Creative Commons Zero 1.0 Public Domain License)
and Pixabay (Free for commerical use. No attribution required)
https://openclipart.org/detail/198745/mono-tool-offline-mode-off
https://openclipart.org/detail/198746/mono-tool-offline-mode-on
https://pixabay.com/en/connection-broken-network-98523/
https://pixabay.com/en/network-computer-workstations-lan-98522/

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

@ -0,0 +1,160 @@
// reading file
#include <iostream>
#include <fstream>
// trimming string
#include <algorithm>
#include <cctype>
#include <locale>
#include <stdlib.h>
// regex
#include <regex>
// gtk
#include <gtk/gtk.h>
static std::string logfilepath = "";
// trim from start (in place)
static inline void ltrim(std::string &s) {
s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](int ch) {
return !std::isspace(ch);
}));
}
// trim from end (in place)
static inline void rtrim(std::string &s) {
s.erase(std::find_if(s.rbegin(), s.rend(), [](int ch) {
return !std::isspace(ch);
}).base(), s.end());
}
// trim from both ends (in place)
static inline void trim(std::string &s) {
ltrim(s);
rtrim(s);
}
// с++ read file to string
std::string readfile(std::string filepath) {
std::fstream f(filepath, std::fstream::in );
std::string s;
getline( f, s, '\0');
f.close();
return s;
}
// c++ regex example
std::string whereIsLogFile() {
std::string xl2tpd=readfile("/etc/xl2tpd/xl2tpd.conf");
if (xl2tpd!="") {
xl2tpd = std::regex_replace (xl2tpd, std::regex("(^|\n);[^\n]*(?=\n|$)"), "");
std::string options = "";
std::smatch match;
if (std::regex_search(xl2tpd, match, std::regex("(^|\n)pppoptfile\\s*=\\s*([^\n]+)(\n|$)")) && match.size() > 1) {
options=readfile(match.str(2));
if (options!="") {
options = std::regex_replace (options, std::regex("(^|\n)#[^\n]*(?=\n|$)"), "");
if (std::regex_search(options, match, std::regex("(^|\n)logfile\\s*([^\n]+)(\n|$)")) && match.size() > 1) {
return match.str(2);
}
}
}
}
return "/home/user/beeline.xl2tpd.log";
}
// c++ search string in file
int get_status_from_file() {
std::string s = readfile(logfilepath);
// split file by string
std::string delimiter = "Modem hangup";
// select last element of array
size_t pos = 0;
std::string token;
while ((pos = s.find(delimiter)) != std::string::npos) {
token = s.substr(0, pos);
s.erase(0, pos + delimiter.length());
}
trim(s);
if (s=="") {
return 0;
}
else {
delimiter = "status = 0x0";
token = "1";
while ((pos = s.find(delimiter)) != std::string::npos) {
token = "3";
s.erase(0, pos + delimiter.length());
}
trim(s);
if (s=="") {
return 2;
}
if (token == "1") {
return 1;
}
else {
return 3;
}
}
}
// c++ convert gchar std::string
const gchar* convertstring2gchar(std::string s) {
const gchar* x;
const char* cv = s.c_str();
x = (const gchar*) cv;
return x;
}
// с++ system tray icon
static gboolean updateIcon(gpointer data) {
GtkStatusIcon *icon = (GtkStatusIcon*)data;
int m = get_status_from_file();
std::string icon_name;
std::string icontext;
std::string icons_path = "/usr/share/xl2tpd-tray-icon/";
std::string ext = ".png";
switch (m) {
case 0: icon_name="offline"; icontext = "Internet offline"; break;
case 1: icon_name="connect"; icontext = "Trying to connect to internet"; break;
case 2: icon_name="online"; icontext = "Internet works"; break;
case 3: icon_name="disconnect"; icontext = "Disconnecting internet"; break;
}
gtk_status_icon_set_from_file (icon, convertstring2gchar(icons_path+icon_name + ext));
gtk_status_icon_set_tooltip (icon, convertstring2gchar(icontext));
return true;
}
static void trayIconPopup(GtkStatusIcon *status_icon, guint button, guint32 activate_time, gpointer popUpMenu) {
gtk_menu_popup(GTK_MENU(popUpMenu), NULL, NULL, gtk_status_icon_position_menu, status_icon, button, activate_time);
}
static void trayExit(GtkMenuItem *item, gpointer user_data) {
exit(0);
}
int main(int argc, char **argv) {
gtk_init(&argc,&argv);
GtkStatusIcon *icon = gtk_status_icon_new_from_file ("connect.png");
gtk_status_icon_set_visible(icon, 1);
gtk_status_icon_set_tooltip(icon, "Icon");
GtkWidget *menu, *menuItemView, *menuItemExit;
menu = gtk_menu_new();
menuItemExit = gtk_menu_item_new_with_label ("Exit");
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuItemExit);
gtk_widget_show_all (menu);
g_signal_connect(GTK_STATUS_ICON (icon), "popup-menu", GTK_SIGNAL_FUNC (trayIconPopup), menu);
g_signal_connect (G_OBJECT (menuItemExit), "activate", G_CALLBACK (trayExit), NULL);
logfilepath = whereIsLogFile();
// redraw status icon every 2 seconds
g_timeout_add_seconds(2, updateIcon, icon);
gtk_main();
return 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 857 B

@ -1773,6 +1773,48 @@ int handle_special (struct buffer *buf, struct call *c, _u16 call)
return 0;
}
static int handle_control(struct buffer *buf, struct tunnel *t,
struct call *c)
{
/* We have a control packet */
if (check_control (buf, t, c))
{
l2tp_log (LOG_DEBUG, "%s: bad control packet!\n", __FUNCTION__);
return -EINVAL;
}
c->msgtype = -1;
if (buf->len == sizeof (struct control_hdr))
{
#ifdef DEBUG_ZLB
l2tp_log (LOG_DEBUG, "%s: control ZLB received\n", __FUNCTION__);
#endif
t->control_rec_seq_num--;
c->cnu = 0;
if (c->needclose && c->closing)
{
if (c->container->cLr >= c->closeSs)
{
#ifdef DEBUG_ZLB
l2tp_log (LOG_DEBUG, "%s: ZLB for closing message found\n",
__FUNCTION__);
#endif
c->needclose = 0;
/* Trigger final closing of call */
}
}
return 0;
}
if (handle_avps (buf, t, c))
{
if (gconfig.debug_tunnel)
l2tp_log (LOG_DEBUG, "%s: bad AVP handling!\n", __FUNCTION__);
return -EINVAL;
}
return control_finish (t, c);
}
inline int handle_packet (struct buffer *buf, struct tunnel *t,
struct call *c)
{
@ -1783,153 +1825,109 @@ inline int handle_packet (struct buffer *buf, struct tunnel *t,
#endif
*/
if (CTBIT (*((_u16 *) buf->start)))
return handle_control(buf, t, c);
if (!check_payload (buf, t, c))
{
/* We have a control packet */
if (!check_control (buf, t, c))
{
c->msgtype = -1;
if (buf->len == sizeof (struct control_hdr))
{
#ifdef DEBUG_ZLB
l2tp_log (LOG_DEBUG, "%s: control ZLB received\n", __FUNCTION__);
#endif
t->control_rec_seq_num--;
c->cnu = 0;
if (c->needclose && c->closing)
{
if (c->container->cLr >= c->closeSs)
{
#ifdef DEBUG_ZLB
l2tp_log (LOG_DEBUG, "%s: ZLB for closing message found\n",
__FUNCTION__);
#endif
c->needclose = 0;
/* Trigger final closing of call */
}
}
return 0;
}
else if (!handle_avps (buf, t, c))
{
return control_finish (t, c);
}
else
{
if (gconfig.debug_tunnel)
l2tp_log (LOG_DEBUG, "%s: bad AVP handling!\n", __FUNCTION__);
return -EINVAL;
}
}
else
{
l2tp_log (LOG_DEBUG, "%s: bad control packet!\n", __FUNCTION__);
return -EINVAL;
}
}
else
{
if (!check_payload (buf, t, c))
if (!expand_payload (buf, t, c))
{
if (!expand_payload (buf, t, c))
if (buf->len > sizeof (struct payload_hdr))
{
if (buf->len > sizeof (struct payload_hdr))
{
/* if (c->throttle) {
if (c->pSs > c->pLr + c->rws) {
/* if (c->throttle) {
if (c->pSs > c->pLr + c->rws) {
#ifdef DEBUG_FLOW
l2tp_log(LOG_DEBUG, "%s: not yet dethrottling call\n",__FUNCTION__);
l2tp_log(LOG_DEBUG, "%s: not yet dethrottling call\n",__FUNCTION__);
#endif
} else {
} else {
#ifdef DEBUG_FLOW
l2tp_log(LOG_DEBUG, "%s: dethrottling call\n",__FUNCTION__);
l2tp_log(LOG_DEBUG, "%s: dethrottling call\n",__FUNCTION__);
#endif
if (c->dethrottle) deschedule(c->dethrottle);
c->dethrottle=NULL;
c->throttle = 0;
}
} */
if (c->dethrottle) deschedule(c->dethrottle);
c->dethrottle=NULL;
c->throttle = 0;
}
} */
/* JLM res = write_packet(buf,t,c, c->frame & SYNC_FRAMING); */
res = write_packet (buf, t, c, SYNC_FRAMING);
if (res)
return res;
/*
* Assuming we wrote to the ppp driver okay, we should
* do something about ZLB's unless *we* requested no
* window size or if they we have turned off our fbit.
*/
res = write_packet (buf, t, c, SYNC_FRAMING);
if (res)
return res;
/*
* Assuming we wrote to the ppp driver okay, we should
* do something about ZLB's unless *we* requested no
* window size or if they we have turned off our fbit.
*/
/* if (c->ourfbit && (c->ourrws > 0)) {
if (c->pSr >= c->prx + c->ourrws - 2) {
We've received enough to fill our receive window. At
this point, we should immediately send a ZLB!
if (c->pSr >= c->prx + c->ourrws - 2) {
We've received enough to fill our receive window. At
this point, we should immediately send a ZLB!
#ifdef DEBUG_ZLB
l2tp_log(LOG_DEBUG, "%s: Sending immediate ZLB!\n",__FUNCTION__);
l2tp_log(LOG_DEBUG, "%s: Sending immediate ZLB!\n",__FUNCTION__);
#endif
if (c->zlb_xmit) {
Deschedule any existing zlb_xmit's
deschedule(c->zlb_xmit);
c->zlb_xmit = NULL;
}
send_zlb((void *)c);
} else {
struct timeval tv;
We need to schedule sending a ZLB. FIXME: Should
be 1/4 RTT instead, when rate adaptive stuff is
in place. Spec allows .5 seconds though
tv.tv_sec = 0;
tv.tv_usec = 500000;
if (c->zlb_xmit)
deschedule(c->zlb_xmit);
if (c->zlb_xmit) {
Deschedule any existing zlb_xmit's
deschedule(c->zlb_xmit);
c->zlb_xmit = NULL;
}
send_zlb((void *)c);
} else {
struct timeval tv;
We need to schedule sending a ZLB. FIXME: Should
be 1/4 RTT instead, when rate adaptive stuff is
in place. Spec allows .5 seconds though
tv.tv_sec = 0;
tv.tv_usec = 500000;
if (c->zlb_xmit)
deschedule(c->zlb_xmit);
#ifdef DEBUG_ZLB
l2tp_log(LOG_DEBUG, "%s: scheduling ZLB\n",__FUNCTION__);
l2tp_log(LOG_DEBUG, "%s: scheduling ZLB\n",__FUNCTION__);
#endif
c->zlb_xmit = schedule(tv, &send_zlb, (void *)c);
}
} */
return 0;
}
else if (buf->len == sizeof (struct payload_hdr))
{
c->zlb_xmit = schedule(tv, &send_zlb, (void *)c);
}
} */
return 0;
}
else if (buf->len == sizeof (struct payload_hdr))
{
#ifdef DEBUG_ZLB
l2tp_log (LOG_DEBUG, "%s: payload ZLB received\n",
__FUNCTION__);
l2tp_log (LOG_DEBUG, "%s: payload ZLB received\n",
__FUNCTION__);
#endif
/* if (c->throttle) {
if (c->pSs > c->pLr + c->rws) {
if (c->pSs > c->pLr + c->rws) {
#ifdef DEBUG_FLOW
l2tp_log(LOG_DEBUG, "%s: not yet dethrottling call\n",__FUNCTION__);
l2tp_log(LOG_DEBUG, "%s: not yet dethrottling call\n",__FUNCTION__);
#endif
} else {
} else {
#ifdef DEBUG_FLOW
l2tp_log(LOG_DEBUG, "%s: dethrottling call\n",__FUNCTION__);
l2tp_log(LOG_DEBUG, "%s: dethrottling call\n",__FUNCTION__);
#endif
if (c->dethrottle)
deschedule(c->dethrottle);
c->dethrottle=NULL;
c->throttle = 0;
}
} */
c->data_rec_seq_num--;
return 0;
}
else
{
l2tp_log (LOG_DEBUG, "%s: payload too small!\n", __FUNCTION__);
return -EINVAL;
}
if (c->dethrottle)
deschedule(c->dethrottle);
c->dethrottle=NULL;
c->throttle = 0;
}
} */
c->data_rec_seq_num--;
return 0;
}
else
{
if (gconfig.debug_tunnel)
l2tp_log (LOG_DEBUG, "%s: unable to expand payload!\n",
__FUNCTION__);
l2tp_log (LOG_DEBUG, "%s: payload too small!\n", __FUNCTION__);
return -EINVAL;
}
}
else
{
l2tp_log (LOG_DEBUG, "%s: invalid payload packet!\n", __FUNCTION__);
if (gconfig.debug_tunnel)
l2tp_log (LOG_DEBUG, "%s: unable to expand payload!\n",
__FUNCTION__);
return -EINVAL;
}
}
else
{
l2tp_log (LOG_DEBUG, "%s: invalid payload packet!\n", __FUNCTION__);
return -EINVAL;
}
}

@ -1,3 +1,15 @@
xl2tpd (1.3.14-1) UNRELEASED; urgency=medium
* New upstream release.
-- Samir Hussain <shussain@xelerance.com> Wed, 17 Apr 2019 12:22:21 -0500
xl2tpd (1.3.13-1) UNRELEASED; urgency=medium
* New upstream release.
-- Samir Hussain <shussain@xelerance.com> Mon, 03 Dec 2018 13:02:21 -0500
xl2tpd (1.3.12-1.1) UNRELEASED; urgency=medium
* Non-maintainer upload.

@ -51,6 +51,7 @@ int init_config ()
gconfig.debug_tunnel = 0;
gconfig.debug_state = 0;
gconfig.max_retries = DEFAULT_MAX_RETRIES;
gconfig.cap_backoff = 0;
lnslist = NULL;
laclist = NULL;
deflac = (struct lac *) calloc (1, sizeof (struct lac));
@ -231,7 +232,7 @@ int set_port (char *word, char *value, int context, void *item)
{
case CONTEXT_GLOBAL:
#ifdef DEBUG_FILE
l2tp_log (LOG_DEBUG, "set_port: Setting global port number to %s\n",
l2tp_log (LOG_DEBUG, "set_maxretries: Setting global max retries to %s\n",
value);
#endif
set_int (word, value, &(((struct global *) item)->port));
@ -375,6 +376,26 @@ int set_maxretries (char *word, char *value, int context, void *item)
}
int set_capbackoff (char *word, char *value, int context, void *item)
{
switch (context & ~CONTEXT_DEFAULT)
{
case CONTEXT_GLOBAL:
#ifdef DEBUG_FILE
l2tp_log (LOG_DEBUG, "set_capbackoff: Setting global cap backoff to %s\n",
value);
#endif
set_int (word, value, &(((struct global *) item)->cap_backoff));
break;
default:
snprintf (filerr, sizeof (filerr), "'%s' not valid in this context\n",
word);
return -1;
}
return 0;
}
int set_rmax (char *word, char *value, int context, void *item)
{
if (atoi (value) < 1)
@ -1599,5 +1620,6 @@ struct keyword words[] = {
{"rx bps", &set_speed},
{"bps", &set_speed},
{"max retries" , &set_maxretries},
{"cap backoff" , &set_capbackoff},
{NULL, NULL}
};

@ -168,6 +168,7 @@ struct global
* Changed in SAref patch in openswan 2.6.36 for linux 2.6.36+ */
int max_retries; /* Max retries before closing tunnel
or stop re-transmitting */
int cap_backoff; /* Limit seconds between exponential backoff */
};
extern struct global gconfig; /* Global configuration options */

@ -59,7 +59,7 @@ typedef unsigned long long _u64;
#define CONTROL_PIPE_REQ_LNS_REMOVE 'w' /* Get status of LNS */
#define BINARY "xl2tpd"
#define SERVER_VERSION "xl2tpd-1.3.13"
#define SERVER_VERSION "xl2tpd-1.3.14"
#define VENDOR_NAME "xelerance.com"
#ifndef PPPD
#define PPPD "/usr/sbin/pppd"

@ -68,7 +68,6 @@ extern int addfcs (struct buffer *buf);
extern void swaps (void *, int);
extern void do_packet_dump (struct buffer *);
extern void status (const char *fmt, ...);
extern void status_handler (int signal);
extern int getPtyMaster(char *, int);
extern void do_control (void);
extern void recycle_buf (struct buffer *);

@ -68,6 +68,7 @@ int init_network (void)
};
if (getsockname (server_socket, (struct sockaddr *) &server, &length))
{
close (server_socket);
l2tp_log (LOG_CRIT, "%s: Unable to read socket name.Terminating.\n",
__FUNCTION__);
return -EINVAL;
@ -112,6 +113,7 @@ int init_network (void)
int kernel_fd = socket(AF_PPPOX, SOCK_DGRAM, PX_PROTO_OL2TP);
if (kernel_fd < 0)
{
close(kernel_fd);
l2tp_log (LOG_INFO, "L2TP kernel support not detected (try modprobing l2tp_ppp and pppol2tp)\n");
kernel_support = 0;
}
@ -262,9 +264,14 @@ void control_xmit (void *b)
else
{
/*
* Adaptive timeout with exponential backoff
* Adaptive timeout with exponential backoff. The delay grows
* exponentialy, unless it's capped by configuration.
*/
tv.tv_sec = 1LL << (buf->retries-1);
unsigned shift_by = (buf->retries-1);
if (shift_by > 31)
shift_by = 31;
tv.tv_sec = 1LL << shift_by;
tv.tv_usec = 0;
schedule (tv, control_xmit, buf);
#ifdef DEBUG_CONTROL_XMIT
@ -572,31 +579,31 @@ void network_thread ()
}
refme=refhim=0;
refme=refhim=0;
struct cmsghdr *cmsg;
/* Process auxiliary received data in msgh */
for (cmsg = CMSG_FIRSTHDR(&msgh);
cmsg != NULL;
cmsg = CMSG_NXTHDR(&msgh,cmsg)) {
struct cmsghdr *cmsg;
/* Process auxiliary received data in msgh */
for (cmsg = CMSG_FIRSTHDR(&msgh);
cmsg != NULL;
cmsg = CMSG_NXTHDR(&msgh,cmsg)) {
#ifdef LINUX
/* extract destination(our) addr */
if (cmsg->cmsg_level == IPPROTO_IP && cmsg->cmsg_type == IP_PKTINFO) {
struct in_pktinfo* pktInfo = ((struct in_pktinfo*)CMSG_DATA(cmsg));
to = *pktInfo;
} else
/* extract destination(our) addr */
if (cmsg->cmsg_level == IPPROTO_IP && cmsg->cmsg_type == IP_PKTINFO) {
struct in_pktinfo* pktInfo = ((struct in_pktinfo*)CMSG_DATA(cmsg));
to = *pktInfo;
} else
#endif
/* extract IPsec info out */
if (gconfig.ipsecsaref && cmsg->cmsg_level == IPPROTO_IP
&& cmsg->cmsg_type == gconfig.sarefnum) {
unsigned int *refp;
refp = (unsigned int *)CMSG_DATA(cmsg);
refme =refp[0];
refhim=refp[1];
}
}
/* extract IPsec info out */
if (gconfig.ipsecsaref && cmsg->cmsg_level == IPPROTO_IP &&
cmsg->cmsg_type == gconfig.sarefnum) {
unsigned int *refp;
refp = (unsigned int *)CMSG_DATA(cmsg);
refme =refp[0];
refhim=refp[1];
}
}
/*
* some logic could be added here to verify that we only
@ -674,144 +681,140 @@ void network_thread ()
/*
* finished obvious sources, look for data from PPP connections.
*/
st = tunnels.head;
while (st)
for (st = tunnels.head; st; st = st->next)
{
sc = st->call_head;
while (sc)
for (sc = st->call_head; sc; sc = sc->next)
{
if ((sc->fd >= 0) && FD_ISSET (sc->fd, &readfds))
{
/* Got some payload to send */
int result;
if ((sc->fd < 0) || !FD_ISSET (sc->fd, &readfds))
continue;
/* Got some payload to send */
int result;
while ((result = read_packet (sc)) > 0)
while ((result = read_packet (sc)) > 0)
{
add_payload_hdr (sc->container, sc, sc->ppp_buf);
if (gconfig.packet_dump)
{
add_payload_hdr (sc->container, sc, sc->ppp_buf);
if (gconfig.packet_dump)
{
do_packet_dump (sc->ppp_buf);
}
sc->prx = sc->data_rec_seq_num;
if (sc->zlb_xmit)
{
deschedule (sc->zlb_xmit);
sc->zlb_xmit = NULL;
}
sc->tx_bytes += sc->ppp_buf->len;
sc->tx_pkts++;
unsigned char* tosval = get_inner_tos_byte(sc->ppp_buf);
unsigned char* typeval = get_inner_ppp_type(sc->ppp_buf);
int tosval_dec = (int)*tosval;
int typeval_dec = (int)*typeval;
if (typeval_dec != 33 )
tosval_dec=atoi(gconfig.controltos);
setsockopt(server_socket, IPPROTO_IP, IP_TOS, &tosval_dec, sizeof(tosval_dec));
udp_xmit (sc->ppp_buf, st);
recycle_payload (sc->ppp_buf, sc->container->peer);
do_packet_dump (sc->ppp_buf);
}
if (result != 0)
sc->prx = sc->data_rec_seq_num;
if (sc->zlb_xmit)
{
l2tp_log (LOG_WARNING,
"%s: tossing read packet, error = %s (%d). Closing call.\n",
__FUNCTION__, strerror (-result), -result);
strcpy (sc->errormsg, strerror (-result));
sc->needclose = -1;
deschedule (sc->zlb_xmit);
sc->zlb_xmit = NULL;
}
sc->tx_bytes += sc->ppp_buf->len;
sc->tx_pkts++;
unsigned char* tosval = get_inner_tos_byte(sc->ppp_buf);
unsigned char* typeval = get_inner_ppp_type(sc->ppp_buf);
int tosval_dec = (int)*tosval;
int typeval_dec = (int)*typeval;
if (typeval_dec != 33 )
tosval_dec=atoi(gconfig.controltos);
setsockopt(server_socket, IPPROTO_IP, IP_TOS, &tosval_dec, sizeof(tosval_dec));
udp_xmit (sc->ppp_buf, st);
recycle_payload (sc->ppp_buf, sc->container->peer);
}
sc = sc->next;
}
st = st->next;
}
if (result != 0)
{
l2tp_log (LOG_WARNING,
"%s: tossing read packet, error = %s (%d). Closing call.\n",
__FUNCTION__, strerror (-result), -result);
strcpy (sc->errormsg, strerror (-result));
sc->needclose = -1;
}
} // for (sc..
} // for (st..
}
}
#ifdef USE_KERNEL
int connect_pppol2tp(struct tunnel *t) {
if (kernel_support) {
int ufd = -1, fd2 = -1;
int flags;
struct sockaddr_pppol2tp sax;
struct sockaddr_in server;
memset(&server, 0, sizeof(struct sockaddr_in));
server.sin_family = AF_INET;
server.sin_addr.s_addr = gconfig.listenaddr;
server.sin_port = htons (gconfig.port);
if ((ufd = socket (PF_INET, SOCK_DGRAM, 0)) < 0)
{
l2tp_log (LOG_CRIT, "%s: Unable to allocate UDP socket. Terminating.\n",
__FUNCTION__);
return -EINVAL;
};
if (!kernel_support)
return 0;
int ufd = -1, fd2 = -1;
int flags;
struct sockaddr_pppol2tp sax;
struct sockaddr_in server;
memset(&server, 0, sizeof(struct sockaddr_in));
server.sin_family = AF_INET;
server.sin_addr.s_addr = gconfig.listenaddr;
server.sin_port = htons (gconfig.port);
if ((ufd = socket (PF_INET, SOCK_DGRAM, 0)) < 0)
{
l2tp_log (LOG_CRIT, "%s: Unable to allocate UDP socket. Terminating.\n",
__FUNCTION__);
return -EINVAL;
};
flags=1;
setsockopt(ufd, SOL_SOCKET, SO_REUSEADDR, &flags, sizeof(flags));
flags=1;
setsockopt(ufd, SOL_SOCKET, SO_REUSEADDR, &flags, sizeof(flags));
#ifdef SO_NO_CHECK
setsockopt(ufd, SOL_SOCKET, SO_NO_CHECK, &flags, sizeof(flags));
setsockopt(ufd, SOL_SOCKET, SO_NO_CHECK, &flags, sizeof(flags));
#endif
if (bind (ufd, (struct sockaddr *) &server, sizeof (server)))
{
close (ufd);
l2tp_log (LOG_CRIT, "%s: Unable to bind UDP socket: %s. Terminating.\n",
__FUNCTION__, strerror(errno), errno);
return -EINVAL;
};
server = t->peer;
flags = fcntl(ufd, F_GETFL);
if (flags == -1 || fcntl(ufd, F_SETFL, flags | O_NONBLOCK) == -1) {
l2tp_log (LOG_WARNING, "%s: Unable to set UDP socket nonblock.\n",
__FUNCTION__);
return -EINVAL;
}
if (connect (ufd, (struct sockaddr *) &server, sizeof(server)) < 0) {
l2tp_log (LOG_CRIT, "%s: Unable to connect UDP peer. Terminating.\n",
__FUNCTION__);
close(ufd);
return -EINVAL;
}
if (bind (ufd, (struct sockaddr *) &server, sizeof (server)))
{
close (ufd);
l2tp_log (LOG_CRIT, "%s: Unable to bind UDP socket: %s. Terminating.\n",
__FUNCTION__, strerror(errno), errno);
return -EINVAL;
};
server = t->peer;
flags = fcntl(ufd, F_GETFL);
if (flags == -1 || fcntl(ufd, F_SETFL, flags | O_NONBLOCK) == -1) {
l2tp_log (LOG_WARNING, "%s: Unable to set UDP socket nonblock.\n",
__FUNCTION__);
return -EINVAL;
}
if (connect (ufd, (struct sockaddr *) &server, sizeof(server)) < 0) {
l2tp_log (LOG_CRIT, "%s: Unable to connect UDP peer. Terminating.\n",
__FUNCTION__);
close(ufd);
return -EINVAL;
}
t->udp_fd=ufd;
t->udp_fd=ufd;
fd2 = socket(AF_PPPOX, SOCK_DGRAM, PX_PROTO_OL2TP);
if (fd2 < 0) {
l2tp_log (LOG_WARNING, "%s: Unable to allocate PPPoL2TP socket.\n",
__FUNCTION__);
return -EINVAL;
}
flags = fcntl(fd2, F_GETFL);
if (flags == -1 || fcntl(fd2, F_SETFL, flags | O_NONBLOCK) == -1) {
l2tp_log (LOG_WARNING, "%s: Unable to set PPPoL2TP socket nonblock.\n",
__FUNCTION__);
close(fd2);
return -EINVAL;
}
memset(&sax, 0, sizeof(sax));
sax.sa_family = AF_PPPOX;
sax.sa_protocol = PX_PROTO_OL2TP;
sax.pppol2tp.fd = t->udp_fd;
sax.pppol2tp.addr.sin_addr.s_addr = t->peer.sin_addr.s_addr;
sax.pppol2tp.addr.sin_port = t->peer.sin_port;
sax.pppol2tp.addr.sin_family = AF_INET;
sax.pppol2tp.s_tunnel = t->ourtid;
sax.pppol2tp.d_tunnel = t->tid;
if ((connect(fd2, (struct sockaddr *)&sax, sizeof(sax))) < 0) {
l2tp_log (LOG_WARNING, "%s: Unable to connect PPPoL2TP socket. %d %s\n",
__FUNCTION__, errno, strerror(errno));
close(fd2);
return -EINVAL;
}
t->pppox_fd = fd2;
}
fd2 = socket(AF_PPPOX, SOCK_DGRAM, PX_PROTO_OL2TP);
if (fd2 < 0) {
l2tp_log (LOG_WARNING, "%s: Unable to allocate PPPoL2TP socket.\n",
__FUNCTION__);
return -EINVAL;
}
flags = fcntl(fd2, F_GETFL);
if (flags == -1 || fcntl(fd2, F_SETFL, flags | O_NONBLOCK) == -1) {
l2tp_log (LOG_WARNING, "%s: Unable to set PPPoL2TP socket nonblock.\n",
__FUNCTION__);
close(fd2);
return -EINVAL;
}
memset(&sax, 0, sizeof(sax));
sax.sa_family = AF_PPPOX;
sax.sa_protocol = PX_PROTO_OL2TP;
sax.pppol2tp.fd = t->udp_fd;
sax.pppol2tp.addr.sin_addr.s_addr = t->peer.sin_addr.s_addr;
sax.pppol2tp.addr.sin_port = t->peer.sin_port;
sax.pppol2tp.addr.sin_family = AF_INET;
sax.pppol2tp.s_tunnel = t->ourtid;
sax.pppol2tp.d_tunnel = t->tid;
if ((connect(fd2, (struct sockaddr *)&sax, sizeof(sax))) < 0) {
l2tp_log (LOG_WARNING, "%s: Unable to connect PPPoL2TP socket. %d %s\n",
__FUNCTION__, errno, strerror(errno));
close(fd2);
return -EINVAL;
}
t->pppox_fd = fd2;
return 0;
}
#endif

@ -43,4 +43,11 @@ struct in_pktinfo {
#endif
#if defined __UCLIBC__ && !defined UCLIBC_SUSV3_LEGACY_MACROS
# define index(x, y) strchr(x, y)
# define bcopy(S1, S2, LEN) ((void)memmove(S2, S1, LEN))
# define bzero(S1, LEN) ((void)memset(S1, 0, LEN))
# define bcmp(S1,S2,LEN) ((memcmp(S2, S1, LEN)==0)?0:1)
#endif /* defined __UCLIBC__ && !defined UCLIBC_SUSV3_LEGACY_MACROS */
#endif /* _OSPORT_H_ */

@ -1,6 +1,6 @@
Summary: Layer 2 Tunnelling Protocol Daemon (RFC 2661)
Name: xl2tpd
Version: 1.3.13
Version: 1.3.14
Release: 1%{?dist}
License: GPLv2
Url: http://www.xelerance.com/software/xl2tpd/

@ -2,7 +2,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=xl2tpd
PKG_VERSION:=1.3.13
PKG_VERSION:=1.3.14
PKG_RELEASE:=1
PKG_MD5SUM:=ab5656eb5a3d1973f7f69b039675332e-NEEDSUPDATING

@ -1,6 +1,6 @@
Summary: Layer 2 Tunnelling Protocol Daemon (RFC 2661)
Name: xl2tpd
Version: 1.3.13
Version: 1.3.14
Release: 1%{?dist}
License: GPLv2
Url: http://www.xelerance.com/software/xl2tpd/

@ -1,6 +1,6 @@
Summary: Layer 2 Tunnelling Protocol Daemon (RFC 2661)
Name: xl2tpd
Version: 1.3.13
Version: 1.3.14
Release: 1%{?dist}
License: GPLv2
Url: http://www.xelerance.com/software/xl2tpd/

@ -47,38 +47,37 @@ struct tunnel_list tunnels;
int rand_source;
int ppd = 1; /* Packet processing delay */
int control_fd; /* descriptor of control area */
char *args;
char *dial_no_tmp; /* jz: Dialnumber for Outgoing Call */
static char *dial_no_tmp; /* jz: Dialnumber for Outgoing Call */
int switch_io = 0; /* jz: Switch for Incoming or Outgoing Call */
static void open_controlfd(void);
volatile sig_atomic_t sigterm_received;
volatile sig_atomic_t sigint_received;
volatile sig_atomic_t sigchld_received;
volatile sig_atomic_t sigusr1_received;;
volatile sig_atomic_t sighup_received;
static volatile sig_atomic_t sigterm_received;
static volatile sig_atomic_t sigint_received;
static volatile sig_atomic_t sigchld_received;
static volatile sig_atomic_t sigusr1_received;;
static volatile sig_atomic_t sighup_received;
struct control_requests_handler {
char type;
int (*handler) (FILE* resf, char* bufp);
};
int control_handle_available(FILE* resf, char* bufp);
int control_handle_lns_add_modify(FILE* resf, char* bufp);
int control_handle_lns_status(FILE* resf, char* bufp);
int control_handle_tunnel(FILE* respf, char* bufp);
int control_handle_lac_connect(FILE* resf, char* bufp);
int control_handle_lac_outgoing_call(FILE* resf, char* bufp);
int control_handle_lac_hangup(FILE* resf, char* bufp);
int control_handle_lac_disconnect(FILE* resf, char* bufp);
int control_handle_lac_add_modify(FILE* resf, char* bufp);
int control_handle_lac_remove(FILE* resf, char* bufp);
int control_handle_lac_status();
int control_handle_lns_remove(FILE* resf, char* bufp);
struct control_requests_handler control_handlers[] = {
static int control_handle_available(FILE* resf, char* bufp);
static int control_handle_lns_add_modify(FILE* resf, char* bufp);
static int control_handle_lns_status(FILE* resf, char* bufp);
static int control_handle_tunnel(FILE* respf, char* bufp);
static int control_handle_lac_connect(FILE* resf, char* bufp);
static int control_handle_lac_outgoing_call(FILE* resf, char* bufp);
static int control_handle_lac_hangup(FILE* resf, char* bufp);
static int control_handle_lac_disconnect(FILE* resf, char* bufp);
static int control_handle_lac_add_modify(FILE* resf, char* bufp);
static int control_handle_lac_remove(FILE* resf, char* bufp);
static int control_handle_lac_status();
static int control_handle_lns_remove(FILE* resf, char* bufp);
static struct control_requests_handler control_handlers[] = {
{CONTROL_PIPE_REQ_AVAILABLE, &control_handle_available},
{CONTROL_PIPE_REQ_LNS_ADD_MODIFY, &control_handle_lns_add_modify},
{CONTROL_PIPE_REQ_LNS_STATUS, &control_handle_lns_status},
@ -95,7 +94,7 @@ struct control_requests_handler control_handlers[] = {
{0, NULL}
};
void init_tunnel_list (struct tunnel_list *t)
static void init_tunnel_list (struct tunnel_list *t)
{
t->head = NULL;
t->count = 0;
@ -103,7 +102,7 @@ void init_tunnel_list (struct tunnel_list *t)
}
/* Now sends to syslog instead - MvO */
void show_status (void)
static void show_status (void)
{
struct schedule_entry *se;
struct tunnel *t;
@ -208,7 +207,7 @@ void show_status (void)
l2tp_log (LOG_WARNING, "================================\n");
}
void null_handler(int sig)
static void null_handler(int sig)
{
UNUSED(sig);
/* FIXME
@ -217,13 +216,13 @@ void null_handler(int sig)
*/
}
void status_handler (int sig)
static void status_handler (int sig)
{
UNUSED(sig);
show_status ();
}
void child_handler (int sig)
static void child_handler (int sig)
{
UNUSED(sig);
/*
@ -300,7 +299,7 @@ void child_handler (int sig)
}
}
void death_handler (int signal)
static void death_handler (int signal)
{
/*
* If we get here, somebody terminated us with a kill or a control-c.
@ -345,31 +344,31 @@ void death_handler (int signal)
exit (1);
}
void sigterm_handler(int sig)
static void sigterm_handler(int sig)
{
UNUSED(sig);
sigterm_received = 1;
}
void sigint_handler(int sig)
static void sigint_handler(int sig)
{
UNUSED(sig);
sigint_received = 1;
}
void sigchld_handler(int sig)
static void sigchld_handler(int sig)
{
UNUSED(sig);
sigchld_received = 1;
}
void sigusr1_handler(int sig)
static void sigusr1_handler(int sig)
{
UNUSED(sig);
sigusr1_received = 1;
}
void sighup_handler(int sig)
static void sighup_handler(int sig)
{
UNUSED(sig);
sighup_received = 1;
@ -450,18 +449,18 @@ int start_pppd (struct call *c, struct ppp_opts *opts)
stropt[pos++] = strdup ("plugin");
stropt[pos++] = strdup ("pppol2tp.so");
stropt[pos++] = strdup ("pppol2tp");
stropt[pos] = malloc (10);
snprintf (stropt[pos], 10, "%d", fd2);
stropt[pos] = malloc (11);
snprintf (stropt[pos], 11, "%d", fd2);
pos++;
if (c->container->lns) {
stropt[pos++] = strdup ("pppol2tp_lns_mode");
stropt[pos++] = strdup ("pppol2tp_tunnel_id");
stropt[pos] = malloc (10);
snprintf (stropt[pos], 10, "%d", c->container->ourtid);
stropt[pos] = malloc (11);
snprintf (stropt[pos], 11, "%d", c->container->ourtid);
pos++;
stropt[pos++] = strdup ("pppol2tp_session_id");
stropt[pos] = malloc (10);
snprintf (stropt[pos], 10, "%d", c->ourcid);
stropt[pos] = malloc (11);
snprintf (stropt[pos], 11, "%d", c->ourcid);
pos++;
}
}
@ -695,7 +694,7 @@ void destroy_tunnel (struct tunnel *t)
free (t);
}
struct tunnel *l2tp_call (char *host, int port, struct lac *lac,
static struct tunnel *l2tp_call (char *host, int port, struct lac *lac,
struct lns *lns)
{
/*
@ -746,7 +745,7 @@ struct tunnel *l2tp_call (char *host, int port, struct lac *lac,
return tmp->container;
}
void magic_lac_tunnel (void *data)
static void magic_lac_tunnel (void *data)
{
struct lac *lac;
lac = (struct lac *) data;
@ -772,7 +771,7 @@ void magic_lac_tunnel (void *data)
}
}
struct call *lac_call (int tid, struct lac *lac, struct lns *lns)
static struct call *lac_call (int tid, struct lac *lac, struct lns *lns)
{
struct tunnel *t = tunnels.head;
struct call *tmp;
@ -839,7 +838,7 @@ void magic_lac_dial (void *data)
lac_call (lac->t->ourtid, lac, NULL);
}
void lac_hangup (int cid)
static void lac_hangup (int cid)
{
struct tunnel *t = tunnels.head;
struct call *tmp;
@ -866,7 +865,7 @@ void lac_hangup (int cid)
return;
}
void lac_disconnect (int tid)
static void lac_disconnect (int tid)
{
struct tunnel *t = tunnels.head;
while (t)
@ -937,7 +936,7 @@ struct tunnel *new_tunnel ()
return tmp;
}
void write_res (FILE* res_file, const char *fmt, ...)
static void write_res (FILE* res_file, const char *fmt, ...)
{
if (!res_file || ferror (res_file) || feof (res_file))
return;
@ -947,7 +946,7 @@ void write_res (FILE* res_file, const char *fmt, ...)
va_end (args);
}
int parse_one_line (char* bufp, int context, void* tc)
static int parse_one_line (char* bufp, int context, void* tc)
{
/* FIXME: I should check for incompatible options */
char *s, *d, *t;
@ -1004,15 +1003,15 @@ int parse_one_line (char* bufp, int context, void* tc)
return 0;
}
int parse_one_line_lac (char* bufp, struct lac *tc){
static int parse_one_line_lac (char* bufp, struct lac *tc){
return parse_one_line(bufp, CONTEXT_LAC, tc);
}
int parse_one_line_lns (char* bufp, struct lns *tc){
static int parse_one_line_lns (char* bufp, struct lns *tc){
return parse_one_line(bufp, CONTEXT_LNS, tc);
}
struct lns* find_lns_by_name(char* name){
static struct lns* find_lns_by_name(char* name){
struct lns *cursor;
/* ml: First check to see if we are searching for default */
@ -1032,7 +1031,7 @@ struct lns* find_lns_by_name(char* name){
return NULL; /* ml: Ok we could not find anything*/
}
int control_handle_available(FILE* resf, char* bufp) {
static int control_handle_available(FILE* resf, char* bufp) {
UNUSED(bufp);
struct lac *lac;
struct lns *lns;
@ -1084,7 +1083,7 @@ int control_handle_available(FILE* resf, char* bufp) {
return 1;
}
int control_handle_lns_add_modify(FILE* resf, char* bufp){
static int control_handle_lns_add_modify(FILE* resf, char* bufp){
struct lns *lns;
char* tunstr;
char delims[] = " ";
@ -1117,7 +1116,7 @@ int control_handle_lns_add_modify(FILE* resf, char* bufp){
return 1;
}
int control_handle_lns_remove(FILE* resf, char* bufp){
static int control_handle_lns_remove(FILE* resf, char* bufp){
char *tunstr;
struct lns* lns;
struct lns* prev_lns;
@ -1165,7 +1164,7 @@ int control_handle_lns_remove(FILE* resf, char* bufp){
return 1;
}
int control_handle_lns_status(FILE* resf, char* bufp){
static int control_handle_lns_status(FILE* resf, char* bufp){
struct lns *lns;
char* tunstr;
char delims[] = " ";
@ -1223,7 +1222,7 @@ int control_handle_lns_status(FILE* resf, char* bufp){
return 1;
}
int control_handle_tunnel(FILE* resf, char* bufp){
static int control_handle_tunnel(FILE* resf, char* bufp){
char* host;
host = strchr (bufp, ' ') + 1;
#ifdef DEBUG_CONTROL
@ -1237,7 +1236,7 @@ int control_handle_tunnel(FILE* resf, char* bufp){
return 1;
}
int control_handle_lac_connect(FILE* resf, char* bufp){
static int control_handle_lac_connect(FILE* resf, char* bufp){
char* tunstr = NULL;
char* authname= NULL;
char* password = NULL;
@ -1298,7 +1297,7 @@ int control_handle_lac_connect(FILE* resf, char* bufp){
return 1;
}
int control_handle_lac_outgoing_call(FILE* resf, char* bufp){
static int control_handle_lac_outgoing_call(FILE* resf, char* bufp){
char* sub_str;
char* tunstr;
char* tmp_ptr;
@ -1353,7 +1352,7 @@ int control_handle_lac_outgoing_call(FILE* resf, char* bufp){
return 1;
}
int control_handle_lac_hangup(FILE* resf, char* bufp){
static int control_handle_lac_hangup(FILE* resf, char* bufp){
char* callstr;
int call;
@ -1368,7 +1367,7 @@ int control_handle_lac_hangup(FILE* resf, char* bufp){
return 1;
}
int control_handle_lac_disconnect(FILE* resf, char* bufp){
static int control_handle_lac_disconnect(FILE* resf, char* bufp){
char* tunstr;
struct lac* lac;
int tunl = 0;
@ -1414,7 +1413,7 @@ int control_handle_lac_disconnect(FILE* resf, char* bufp){
return 1;
}
int control_handle_lac_add_modify(FILE* resf, char* bufp){
static int control_handle_lac_add_modify(FILE* resf, char* bufp){
char* tunstr;
struct lac* lac;
char delims[] = " ";
@ -1477,7 +1476,7 @@ int control_handle_lac_add_modify(FILE* resf, char* bufp){
return 1;
}
int control_handle_lac_remove(FILE* resf, char* bufp){
static int control_handle_lac_remove(FILE* resf, char* bufp){
char *tunstr;
struct lac* lac;
struct lac* prev_lac;
@ -1542,7 +1541,7 @@ int control_handle_lac_remove(FILE* resf, char* bufp){
return 1;
}
int control_handle_lac_status(){
static int control_handle_lac_status(){
show_status ();
return 1;
}
@ -1643,7 +1642,7 @@ void do_control ()
}
void usage(void) {
static void usage(void) {
printf("\nxl2tpd version: %s\n", SERVER_VERSION);
printf("Usage: xl2tpd [-c <config file>] [-s <secret file>] [-p <pid file>]\n"
" [-C <control file>] [-D] [-l] [-q <tos decimal value for control>]\n"
@ -1652,7 +1651,7 @@ void usage(void) {
exit(1);
}
void init_args(int argc, char *argv[])
static void init_args(int argc, char *argv[])
{
int i=0;
@ -1747,7 +1746,7 @@ void init_args(int argc, char *argv[])
}
void daemonize() {
static void daemonize() {
int pid=0;
int i;
@ -1845,7 +1844,7 @@ static void open_controlfd()
}
}
void init (int argc,char *argv[])
static void init (int argc,char *argv[])
{
struct lac *lac;
struct in_addr listenaddr;
@ -1922,4 +1921,3 @@ int main (int argc, char *argv[])
network_thread ();
return 0;
}

Loading…
Cancel
Save