From f180a0a7113a7d96924c04d620d2e84ed98e77d4 Mon Sep 17 00:00:00 2001 From: rabhis Date: Wed, 26 Jul 2017 23:38:48 +0530 Subject: fix: connection problem with clients having nomru option Fixed problem while connecting with clients in which mru not negotiating lcp option is set --- accel-pppd/ppp/lcp_opt_mru.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/accel-pppd/ppp/lcp_opt_mru.c b/accel-pppd/ppp/lcp_opt_mru.c index 486ade7b..2f321fb6 100644 --- a/accel-pppd/ppp/lcp_opt_mru.c +++ b/accel-pppd/ppp/lcp_opt_mru.c @@ -27,6 +27,7 @@ static int mru_send_conf_nak(struct ppp_lcp_t *lcp, struct lcp_option_t *opt, ui static int mru_recv_conf_req(struct ppp_lcp_t *lcp, struct lcp_option_t *opt, uint8_t *ptr); static int mru_recv_conf_ack(struct ppp_lcp_t *lcp, struct lcp_option_t *opt, uint8_t *ptr); static int mru_recv_conf_nak(struct ppp_lcp_t *lcp, struct lcp_option_t *opt, uint8_t *ptr); +static int mru_recv_conf_rej(struct ppp_lcp_t *lcp, struct lcp_option_t *opt, uint8_t *ptr); static void mru_print(void (*print)(const char *fmt, ...), struct lcp_option_t*, uint8_t *ptr); struct mru_option_t @@ -35,6 +36,7 @@ struct mru_option_t int mru; int mtu; int naked:1; + int rejected:1; }; static struct lcp_option_handler_t mru_opt_hnd= @@ -45,6 +47,7 @@ static struct lcp_option_handler_t mru_opt_hnd= .recv_conf_req = mru_recv_conf_req, .recv_conf_ack = mru_recv_conf_ack, .recv_conf_nak = mru_recv_conf_nak, + .recv_conf_rej = mru_recv_conf_rej, .free = mru_free, .print = mru_print, }; @@ -81,7 +84,7 @@ static int mru_send_conf_req(struct ppp_lcp_t *lcp, struct lcp_option_t *opt, ui struct mru_option_t *mru_opt = container_of(opt, typeof(*mru_opt), opt); struct lcp_opt16_t *opt16 = (struct lcp_opt16_t*)ptr; - if (mru_opt->naked) + if (mru_opt->naked || mru_opt->rejected) return 0; opt16->hdr.id = CI_MRU; @@ -141,6 +144,13 @@ static int mru_recv_conf_nak(struct ppp_lcp_t *lcp, struct lcp_option_t *opt, ui mru_opt->naked = 1; return 0; } +static int mru_recv_conf_rej(struct ppp_lcp_t *lcp, struct lcp_option_t *opt, uint8_t *ptr) +{ + struct mru_option_t *mru_opt = container_of(opt, typeof(*mru_opt), opt); + + mru_opt->rejected = 1; + return 0; +} static void mru_print(void (*print)(const char *fmt, ...), struct lcp_option_t *opt, uint8_t *ptr) { -- cgit v1.2.3