summaryrefslogtreecommitdiff
path: root/accel-pppd/ppp/ccp_mppe.c
diff options
context:
space:
mode:
authorKozlov Dmitry <dima@server>2011-08-16 14:52:25 +0400
committerKozlov Dmitry <dima@server>2011-08-16 14:52:25 +0400
commit8a948ec1a1697601282a20f3c0f09d912c24c923 (patch)
tree882b73e0a7dffc626805ae9d48e84d7afb2e32ec /accel-pppd/ppp/ccp_mppe.c
parentedcb36b3ae347f2e09c975c63a77199188b9e774 (diff)
downloadaccel-ppp-8a948ec1a1697601282a20f3c0f09d912c24c923.tar.gz
accel-ppp-8a948ec1a1697601282a20f3c0f09d912c24c923.zip
ppp:ccp_mppe: don't touch kernel compressor when sending ConfNak
Diffstat (limited to 'accel-pppd/ppp/ccp_mppe.c')
-rw-r--r--accel-pppd/ppp/ccp_mppe.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/accel-pppd/ppp/ccp_mppe.c b/accel-pppd/ppp/ccp_mppe.c
index 7acf568..ba86ef4 100644
--- a/accel-pppd/ppp/ccp_mppe.c
+++ b/accel-pppd/ppp/ccp_mppe.c
@@ -23,7 +23,9 @@
static struct ccp_option_t *mppe_init(struct ppp_ccp_t *ccp);
static void mppe_free(struct ppp_ccp_t *ccp, struct ccp_option_t *opt);
+static int __mppe_send_conf_req(struct ppp_ccp_t *ccp, struct ccp_option_t *opt, uint8_t *ptr, int setup_key);
static int mppe_send_conf_req(struct ppp_ccp_t *ccp, struct ccp_option_t *opt, uint8_t *ptr);
+static int mppe_send_conf_nak(struct ppp_ccp_t *ccp, struct ccp_option_t *opt, uint8_t *ptr);
static int mppe_recv_conf_req(struct ppp_ccp_t *ccp, struct ccp_option_t *opt, uint8_t *ptr);
static int mppe_recv_conf_nak(struct ppp_ccp_t *ccp, struct ccp_option_t *opt, uint8_t *ptr);
static int mppe_recv_conf_rej(struct ppp_ccp_t *ccp, struct ccp_option_t *opt, uint8_t *ptr);
@@ -44,7 +46,7 @@ struct mppe_option_t
static struct ccp_option_handler_t mppe_opt_hnd = {
.init = mppe_init,
.send_conf_req = mppe_send_conf_req,
- .send_conf_nak = mppe_send_conf_req,
+ .send_conf_nak = mppe_send_conf_nak,
.recv_conf_req = mppe_recv_conf_req,
.recv_conf_nak = mppe_recv_conf_nak,
.recv_conf_rej = mppe_recv_conf_rej,
@@ -129,7 +131,7 @@ static int decrease_mtu(struct ppp_t *ppp)
return 0;
}
-static int mppe_send_conf_req(struct ppp_ccp_t *ccp, struct ccp_option_t *opt, uint8_t *ptr)
+static int __mppe_send_conf_req(struct ppp_ccp_t *ccp, struct ccp_option_t *opt, uint8_t *ptr, int setup_key)
{
struct mppe_option_t *mppe_opt = container_of(opt,typeof(*mppe_opt),opt);
struct ccp_opt32_t *opt32 = (struct ccp_opt32_t*)ptr;
@@ -139,7 +141,7 @@ static int mppe_send_conf_req(struct ppp_ccp_t *ccp, struct ccp_option_t *opt, u
opt32->hdr.len = 6;
opt32->val = mppe_opt->mppe ? htonl(MPPE_S | MPPE_H) : 0;
- if (mppe_opt->mppe && setup_mppe_key(ccp->ppp->unit_fd, 0, mppe_opt->recv_key))
+ if (setup_key && mppe_opt->mppe && setup_mppe_key(ccp->ppp->unit_fd, 0, mppe_opt->recv_key))
return 0;
return 6;
@@ -147,6 +149,17 @@ static int mppe_send_conf_req(struct ppp_ccp_t *ccp, struct ccp_option_t *opt, u
return 0;
}
+static int mppe_send_conf_req(struct ppp_ccp_t *ccp, struct ccp_option_t *opt, uint8_t *ptr)
+{
+ return __mppe_send_conf_req(ccp, opt, ptr, 1);
+}
+
+static int mppe_send_conf_nak(struct ppp_ccp_t *ccp, struct ccp_option_t *opt, uint8_t *ptr)
+{
+ return __mppe_send_conf_req(ccp, opt, ptr, 0);
+}
+
+
static int mppe_recv_conf_req(struct ppp_ccp_t *ccp, struct ccp_option_t *opt, uint8_t *ptr)
{
struct mppe_option_t *mppe_opt = container_of(opt, typeof(*mppe_opt), opt);