version 1.1.1.3, 2016/11/01 09:56:12
|
version 1.1.1.4, 2021/03/17 00:39:23
|
Line 144
|
Line 144
|
static void L2tpNodeUpdate(Link l); |
static void L2tpNodeUpdate(Link l); |
static int L2tpListen(Link l); |
static int L2tpListen(Link l); |
static void L2tpUnListen(Link l); |
static void L2tpUnListen(Link l); |
static int L2tpSetCommand(Context ctx, int ac, char *av[], void *arg); | static int L2tpSetCommand(Context ctx, int ac, const char *const av[], const void *arg); |
|
|
/* L2TP control callbacks */ |
/* L2TP control callbacks */ |
static ppp_l2tp_ctrl_connected_t ppp_l2tp_ctrl_connected_cb; |
static ppp_l2tp_ctrl_connected_t ppp_l2tp_ctrl_connected_cb; |
Line 220
|
Line 220
|
L2tpSetCommand, NULL, 2, (void *) SET_ENABLE }, |
L2tpSetCommand, NULL, 2, (void *) SET_ENABLE }, |
{ "disable [opt ...]", "Disable option", |
{ "disable [opt ...]", "Disable option", |
L2tpSetCommand, NULL, 2, (void *) SET_DISABLE }, |
L2tpSetCommand, NULL, 2, (void *) SET_DISABLE }, |
{ NULL }, | { NULL, NULL, NULL, NULL, 0, NULL }, |
}; |
}; |
|
|
/* |
/* |
* INTERNAL VARIABLES |
* INTERNAL VARIABLES |
*/ |
*/ |
|
|
static struct confinfo gConfList[] = { | static const struct confinfo gConfList[] = { |
{ 0, L2TP_CONF_OUTCALL, "outcall" }, |
{ 0, L2TP_CONF_OUTCALL, "outcall" }, |
{ 0, L2TP_CONF_HIDDEN, "hidden" }, |
{ 0, L2TP_CONF_HIDDEN, "hidden" }, |
{ 0, L2TP_CONF_LENGTH, "length" }, |
{ 0, L2TP_CONF_LENGTH, "length" }, |
Line 236
|
Line 236
|
{ 0, 0, NULL }, |
{ 0, 0, NULL }, |
}; |
}; |
|
|
int L2tpListenUpdateSheduled = 0; | static struct ghash *gL2tpServers; |
struct pppTimer L2tpListenUpdateTimer; | static struct ghash *gL2tpTuns; |
| static int one = 1; |
|
|
struct ghash *gL2tpServers; |
|
struct ghash *gL2tpTuns; |
|
int one = 1; |
|
|
|
/* |
/* |
* L2tpTInit() |
* L2tpTInit() |
*/ |
*/ |
Line 587 L2tpOpen(Link l)
|
Line 584 L2tpOpen(Link l)
|
goto fail; |
goto fail; |
} |
} |
|
|
if (!u_addrempty(&tun->self_addr)) { | if (!u_addrempty(&tun->self_addr) || tun->self_port != 0) { |
/* Bind socket to a new port */ |
/* Bind socket to a new port */ |
u_addrtosockaddr(&tun->self_addr,tun->self_port,&sas); |
u_addrtosockaddr(&tun->self_addr,tun->self_port,&sas); |
if (NgSendMsg(csock, namebuf, NGM_KSOCKET_COOKIE, |
if (NgSendMsg(csock, namebuf, NGM_KSOCKET_COOKIE, |
Line 860 L2tpPeerMacAddr(Link l, void *buf, size_t buf_len)
|
Line 857 L2tpPeerMacAddr(Link l, void *buf, size_t buf_len)
|
{ |
{ |
L2tpInfo const l2tp = (L2tpInfo) l->info; |
L2tpInfo const l2tp = (L2tpInfo) l->info; |
|
|
|
if (buf_len < 18) |
|
return 1; |
if (l2tp->tun && l2tp->tun->peer_iface[0]) { |
if (l2tp->tun && l2tp->tun->peer_iface[0]) { |
ether_ntoa_r((struct ether_addr *)l2tp->tun->peer_mac_addr, buf); |
ether_ntoa_r((struct ether_addr *)l2tp->tun->peer_mac_addr, buf); |
return (0); |
return (0); |
Line 1057 ppp_l2tp_ctrl_terminated_cb(struct ppp_l2tp_ctrl *ctrl
|
Line 1056 ppp_l2tp_ctrl_terminated_cb(struct ppp_l2tp_ctrl *ctrl
|
struct l2tp_tun *tun = ppp_l2tp_ctrl_get_cookie(ctrl); |
struct l2tp_tun *tun = ppp_l2tp_ctrl_get_cookie(ctrl); |
int k; |
int k; |
|
|
|
(void)result; |
Log(LG_PHYS, ("L2TP: Control connection %p terminated: %d (%s)", |
Log(LG_PHYS, ("L2TP: Control connection %p terminated: %d (%s)", |
ctrl, error, errmsg)); |
ctrl, error, errmsg)); |
|
|
Line 1190 ppp_l2tp_initiated_cb(struct ppp_l2tp_ctrl *ctrl,
|
Line 1190 ppp_l2tp_initiated_cb(struct ppp_l2tp_ctrl *ctrl,
|
pi->tun = tun; |
pi->tun = tun; |
tun->active_sessions++; |
tun->active_sessions++; |
pi->sess = sess; |
pi->sess = sess; |
if (ptrs->callingnum && ptrs->callingnum->number) | if (ptrs->callingnum) |
strlcpy(pi->callingnum, ptrs->callingnum->number, sizeof(pi->callingnum)); |
strlcpy(pi->callingnum, ptrs->callingnum->number, sizeof(pi->callingnum)); |
if (ptrs->callednum && ptrs->callednum->number) | if (ptrs->callednum) |
strlcpy(pi->callednum, ptrs->callednum->number, sizeof(pi->callednum)); |
strlcpy(pi->callednum, ptrs->callednum->number, sizeof(pi->callednum)); |
|
|
*include_length = (Enabled(&pi->conf.options, L2TP_CONF_LENGTH)?1:0); |
*include_length = (Enabled(&pi->conf.options, L2TP_CONF_LENGTH)?1:0); |
Line 1389 L2tpServerEvent(int type, void *arg)
|
Line 1389 L2tpServerEvent(int type, void *arg)
|
u_int16_t win; |
u_int16_t win; |
int k; |
int k; |
|
|
|
(void)type; |
/* Allocate buffer */ |
/* Allocate buffer */ |
buf = Malloc(MB_PHYS, bufsize); |
buf = Malloc(MB_PHYS, bufsize); |
|
|
Line 1722 L2tpNodeUpdate(Link l)
|
Line 1723 L2tpNodeUpdate(Link l)
|
*/ |
*/ |
|
|
static int |
static int |
L2tpSetCommand(Context ctx, int ac, char *av[], void *arg) | L2tpSetCommand(Context ctx, int ac, const char *const av[], const void *arg) |
{ |
{ |
L2tpInfo const l2tp = (L2tpInfo) ctx->lnk->info; |
L2tpInfo const l2tp = (L2tpInfo) ctx->lnk->info; |
char **fqdn_peer_addr = &l2tp->conf.fqdn_peer_addr; |
char **fqdn_peer_addr = &l2tp->conf.fqdn_peer_addr; |
Line 1802 L2tpSetCommand(Context ctx, int ac, char *av[], void *
|
Line 1803 L2tpSetCommand(Context ctx, int ac, char *av[], void *
|
*/ |
*/ |
|
|
int |
int |
L2tpsStat(Context ctx, int ac, char *av[], void *arg) | L2tpsStat(Context ctx, int ac, const char *const av[], const void *arg) |
{ |
{ |
struct l2tp_tun *tun; |
struct l2tp_tun *tun; |
struct ghash_walk walk; |
struct ghash_walk walk; |
char buf1[64], buf2[64], buf3[64]; |
char buf1[64], buf2[64], buf3[64]; |
|
|
|
(void)ac; |
|
(void)av; |
|
(void)arg; |
|
|
Printf("Active L2TP tunnels:\r\n"); |
Printf("Active L2TP tunnels:\r\n"); |
ghash_walk_init(gL2tpTuns, &walk); |
ghash_walk_init(gL2tpTuns, &walk); |