version 1.1.1.3, 2021/03/17 00:39:23
|
version 1.1.1.3.2.1, 2023/09/27 11:08:00
|
Line 244 Notes
|
Line 244 Notes
|
************************************************************************/ |
************************************************************************/ |
|
|
static int ppp_l2tp_ctrl_setup_1(struct ppp_l2tp_ctrl *ctrl, |
static int ppp_l2tp_ctrl_setup_1(struct ppp_l2tp_ctrl *ctrl, |
struct ppp_l2tp_avp_ptrs *ptrs); | struct ppp_l2tp_avp_ptrs *ptrs, |
| struct ppp_l2tp_avp_list *avps); |
static int ppp_l2tp_ctrl_setup_2(struct ppp_l2tp_ctrl *ctrl, |
static int ppp_l2tp_ctrl_setup_2(struct ppp_l2tp_ctrl *ctrl, |
struct ppp_l2tp_avp_ptrs *ptrs); |
struct ppp_l2tp_avp_ptrs *ptrs); |
static void ppp_l2tp_ctrl_send(struct ppp_l2tp_ctrl *ctrl, |
static void ppp_l2tp_ctrl_send(struct ppp_l2tp_ctrl *ctrl, |
Line 1030 ppp_l2tp_sess_hooked(struct ppp_l2tp_sess *sess) {
|
Line 1031 ppp_l2tp_sess_hooked(struct ppp_l2tp_sess *sess) {
|
*/ |
*/ |
static int |
static int |
ppp_l2tp_ctrl_setup_1(struct ppp_l2tp_ctrl *ctrl, |
ppp_l2tp_ctrl_setup_1(struct ppp_l2tp_ctrl *ctrl, |
struct ppp_l2tp_avp_ptrs *ptrs) | struct ppp_l2tp_avp_ptrs *ptrs, |
| struct ppp_l2tp_avp_list *avps) |
{ |
{ |
/* Log */ |
/* Log */ |
Log(LOG_INFO, ("L2TP: connected to \"%s\", version=%u.%u", |
Log(LOG_INFO, ("L2TP: connected to \"%s\", version=%u.%u", |
Line 1091 ppp_l2tp_ctrl_setup_1(struct ppp_l2tp_ctrl *ctrl,
|
Line 1093 ppp_l2tp_ctrl_setup_1(struct ppp_l2tp_ctrl *ctrl,
|
MD5_Update(&md5ctx, &ptrs->challenge->value, ptrs->challenge->length); |
MD5_Update(&md5ctx, &ptrs->challenge->value, ptrs->challenge->length); |
MD5_Final(hash, &md5ctx); |
MD5_Final(hash, &md5ctx); |
|
|
if (ppp_l2tp_avp_list_append(ctrl->avps, 0, | if (ppp_l2tp_avp_list_append(avps, 0, |
0, AVP_CHALLENGE_RESPONSE, hash, sizeof(hash)) == -1) |
0, AVP_CHALLENGE_RESPONSE, hash, sizeof(hash)) == -1) |
return (0); |
return (0); |
} |
} |
Line 2084 ppp_l2tp_handle_SCCRQ(struct ppp_l2tp_ctrl *ctrl,
|
Line 2086 ppp_l2tp_handle_SCCRQ(struct ppp_l2tp_ctrl *ctrl,
|
|
|
ok: |
ok: |
/* Do control connection setup */ |
/* Do control connection setup */ |
if (ppp_l2tp_ctrl_setup_1(ctrl, ptrs) == -1) | if (ppp_l2tp_ctrl_setup_1(ctrl, ptrs, ctrl->avps) == -1) |
return (-1); |
return (-1); |
|
|
/* Send response and update state */ |
/* Send response and update state */ |
Line 2097 static int
|
Line 2099 static int
|
ppp_l2tp_handle_SCCRP(struct ppp_l2tp_ctrl *ctrl, |
ppp_l2tp_handle_SCCRP(struct ppp_l2tp_ctrl *ctrl, |
const struct ppp_l2tp_avp_list *avps, struct ppp_l2tp_avp_ptrs *ptrs) |
const struct ppp_l2tp_avp_list *avps, struct ppp_l2tp_avp_ptrs *ptrs) |
{ |
{ |
|
struct ppp_l2tp_avp_list *avps0; |
|
|
(void)avps; |
(void)avps; |
|
avps0 = ppp_l2tp_avp_list_create(); |
|
|
/* Do control connection setup */ |
/* Do control connection setup */ |
if (ppp_l2tp_ctrl_setup_1(ctrl, ptrs) == -1) | if ((ppp_l2tp_ctrl_setup_1(ctrl, ptrs, avps0) == -1) || |
| (ppp_l2tp_ctrl_setup_2(ctrl, ptrs) == -1)) { |
| ppp_l2tp_avp_list_destroy(&avps0); |
return (-1); |
return (-1); |
if (ppp_l2tp_ctrl_setup_2(ctrl, ptrs) == -1) | } |
return (-1); | |
|
|
/* Send response and update state */ |
/* Send response and update state */ |
ctrl->state = CS_ESTABLISHED; |
ctrl->state = CS_ESTABLISHED; |
ppp_l2tp_ctrl_send(ctrl, 0, SCCCN, ctrl->avps); | ppp_l2tp_ctrl_send(ctrl, 0, SCCCN, avps0); |
if (*ctrl->cb->ctrl_connected != NULL) |
if (*ctrl->cb->ctrl_connected != NULL) |
(*ctrl->cb->ctrl_connected)(ctrl); |
(*ctrl->cb->ctrl_connected)(ctrl); |
|
ppp_l2tp_avp_list_destroy(&avps0); |
return (0); |
return (0); |
} |
} |
|
|