Index: mpd/src/bund.c =================================================================== --- mpd/src/bund.c (revision 1.214) +++ mpd/src/bund.c (revision 1.215) @@ -890,7 +890,7 @@ } else if (!b->peer_mrru) { /* If no multilink, use peer MRU */ mtu = MIN(b->links[the_link]->lcp.peer_mru, - b->links[the_link]->type->mtu); + PhysGetMtu(b->links[the_link], 0)); } else { /* Multilink, use peer MRRU */ mtu = MIN(b->peer_mrru, MP_MAX_MRRU); Index: mpd/src/lcp.c =================================================================== --- mpd/src/lcp.c (revision 1.89) +++ mpd/src/lcp.c (revision 1.90) @@ -225,7 +225,7 @@ lcp->peer_reject = 0; /* Initialize normal LCP stuff */ - lcp->peer_mru = l->conf.mtu; + lcp->peer_mru = PhysGetMtu(l, 1); lcp->want_mru = PhysGetMru(l, 1); if (l->type && (lcp->want_mru > PhysGetMru(l, 0))) lcp->want_mru = PhysGetMru(l, 0); @@ -792,7 +792,7 @@ /* If we have got request, forget the previous values */ if (mode == MODE_REQ) { - lcp->peer_mru = l->conf.mtu; + lcp->peer_mru = PhysGetMtu(l, 1); lcp->peer_accmap = 0xffffffff; lcp->peer_acfcomp = FALSE; lcp->peer_protocomp = FALSE; Index: mpd/src/phys.c =================================================================== --- mpd/src/phys.c (revision 1.79) +++ mpd/src/phys.c (revision 1.80) @@ -465,6 +465,29 @@ } /* + * PhysGetMtu() + */ + +u_short +PhysGetMtu(Link l, int conf) +{ + PhysType const pt = l->type; + + if (pt) { + if (pt->getmtu) + return ((*pt->getmtu)(l, conf)); + if (conf == 0) { + if (pt->mtu) + return (pt->mtu); + else + return (0); + } else + return (l->conf.mtu); + } else + return (0); +} + +/* * PhysGetMru() */ Index: mpd/src/phys.h =================================================================== --- mpd/src/phys.h (revision 1.42) +++ mpd/src/phys.h (revision 1.43) @@ -63,6 +63,7 @@ /* returns the calling number (IP, MAC, whatever) */ int (*callednum)(Link l, void *buf, size_t buf_len); /* returns the called number (IP, MAC, whatever) */ + u_short (*getmtu)(Link l, int conf); /* returns actual MTU */ u_short (*getmru)(Link l, int conf); /* returns actual MRU */ }; typedef struct phystype *PhysType; @@ -99,6 +100,7 @@ extern int PhysGetPeerIface(Link l, char *buf, size_t buf_len); extern int PhysGetCallingNum(Link l, char *buf, size_t buf_len); extern int PhysGetCalledNum(Link l, char *buf, size_t buf_len); + extern u_short PhysGetMtu(Link l, int conf); extern u_short PhysGetMru(Link l, int conf); extern int PhysIsBusy(Link l); Index: mpd/src/pppoe.c =================================================================== --- mpd/src/pppoe.c (revision 1.140) +++ mpd/src/pppoe.c (revision 1.141) @@ -26,6 +26,7 @@ /* * DEFINITIONS */ + #define PPPOE_MTU 1492 /* allow room for PPPoE overhead */ #define PPPOE_MRU 1492 @@ -149,6 +150,7 @@ static int PppoeCalledNum(Link l, void *buf, size_t buf_len); static int PppoeSelfName(Link l, void *buf, size_t buf_len); static int PppoePeerName(Link l, void *buf, size_t buf_len); +static u_short PppoeGetMtu(Link l, int conf); static u_short PppoeGetMru(Link l, int conf); static void PppoeCtrlReadEvent(int type, void *arg); static void PppoeConnectTimeout(void *arg); @@ -192,6 +194,7 @@ .callednum = PppoeCalledNum, .selfname = PppoeSelfName, .peername = PppoePeerName, + .getmtu = PppoeGetMtu, .getmru = PppoeGetMru }; @@ -697,7 +700,7 @@ Printf("\tIface Hook : %s\r\n", pe->hook); Printf("\tSession : %s\r\n", pe->session); #ifdef NGM_PPPOE_SETMAXP_COOKIE - Printf("\tMax-Payload : %d\r\n", pe->max_payload); + Printf("\tMax-Payload : %u\r\n", pe->max_payload); #endif Printf("\tMAC format : %s\r\n", buf); Printf("PPPoE status:\r\n"); @@ -850,6 +853,20 @@ } static u_short +PppoeGetMtu(Link l, int conf) +{ + PppoeInfo const pppoe = (PppoeInfo)l->info; + + if (pppoe->max_payload > 0 && pppoe->mp_reply > 0) + return (pppoe->max_payload); + else + if (conf == 0) + return (l->type->mtu); + else + return (l->conf.mtu); +} + +static u_short PppoeGetMru(Link l, int conf) { PppoeInfo const pppoe = (PppoeInfo)l->info; @@ -1702,7 +1719,7 @@ if (ac != 1) return(-1); ap = atoi(av[0]); - if (ap < ETHER_MIN_LEN + 8 || ap > ETHER_MAX_LEN - 8) + if (ap < PPPOE_MRU || ap > ETHER_MAX_LEN - 8) Error("PPP-Max-Payload value \"%s\"", av[0]); pi->max_payload = ap; break;