diff options
-rw-r--r-- | accel-pppd/ppp/lcp_opt_mru.c | 13 | ||||
-rw-r--r-- | accel-pppd/ppp/ppp.c | 12 | ||||
-rw-r--r-- | accel-pppd/ppp/ppp.h | 3 |
3 files changed, 18 insertions, 10 deletions
diff --git a/accel-pppd/ppp/lcp_opt_mru.c b/accel-pppd/ppp/lcp_opt_mru.c index c944331..9a28817 100644 --- a/accel-pppd/ppp/lcp_opt_mru.c +++ b/accel-pppd/ppp/lcp_opt_mru.c @@ -111,27 +111,20 @@ static int mru_recv_conf_req(struct ppp_lcp_t *lcp, struct lcp_option_t *opt, ui return LCP_OPT_NAK; mru_opt->mtu = ntohs(opt16->val); + lcp->ppp->mtu = mru_opt->mtu; + return LCP_OPT_ACK; } static int mru_recv_conf_ack(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); - struct ifreq ifr = { - .ifr_mtu = mru_opt->mtu, - }; - - strcpy(ifr.ifr_name, lcp->ppp->ses.ifname); if (ioctl(lcp->ppp->chan_fd, PPPIOCSMRU, &mru_opt->mru) && errno != EIO && errno != ENOTTY) log_ppp_error("lcp:mru: failed to set channel MRU: %s\n", strerror(errno)); - if (ioctl(lcp->ppp->unit_fd, PPPIOCSMRU, &mru_opt->mru)) - log_ppp_error("lcp:mru: failed to set MRU: %s\n", strerror(errno)); - - if (ioctl(sock_fd, SIOCSIFMTU, &ifr)) - log_ppp_error("lcp:mru: failed to set MTU: %s\n", strerror(errno)); + lcp->ppp->mru = mru_opt->mru; return 0; } diff --git a/accel-pppd/ppp/ppp.c b/accel-pppd/ppp/ppp.c index 9772b84..2bc0ab3 100644 --- a/accel-pppd/ppp/ppp.c +++ b/accel-pppd/ppp/ppp.c @@ -77,6 +77,7 @@ void __export ppp_init(struct ppp_t *ppp) int __export establish_ppp(struct ppp_t *ppp) { struct pppunit_cache *uc = NULL; + struct ifreq ifr; if (ap_shutdown) return -1; @@ -149,6 +150,17 @@ int __export establish_ppp(struct ppp_t *ppp) log_ppp_info1("connect: %s <--> %s(%s)\n", ppp->ses.ifname, ppp->ses.ctrl->name, ppp->ses.chan_name); + ifr.ifr_mtu = ppp->mtu; + strcpy(ifr.ifr_name, ppp->ses.ifname); + if (ioctl(sock_fd, SIOCSIFMTU, &ifr)) { + log_ppp_error("failed to set MTU: %s\n", strerror(errno)); + goto exit_close_unit; + } + if (ioctl(ppp->unit_fd, PPPIOCSMRU, &ppp->mru)) { + log_ppp_error("failed to set MRU: %s\n", strerror(errno)); + goto exit_close_unit; + } + init_layers(ppp); if (list_empty(&ppp->layers)) { diff --git a/accel-pppd/ppp/ppp.h b/accel-pppd/ppp/ppp.h index 73fe422..759e114 100644 --- a/accel-pppd/ppp/ppp.h +++ b/accel-pppd/ppp/ppp.h @@ -51,6 +51,9 @@ struct ppp_t int chan_idx; + int mtu; + int mru; + void *buf; int buf_size; |