| 1 | pppd: Cap MTU to the user configured value |
| 2 | |
| 3 | This patchs caps the calculated MTU value in lcp.c to the user specified "mru" |
| 4 | option value. Without this patch pppd would advertise a different MTU value |
| 5 | compared to what is set on the local interface in some cases. |
| 6 | |
| 7 | Signed-off-by: Jo-Philipp Wich <jow@openwrt.org> |
| 8 | |
| 9 | --- a/pppd/lcp.c |
| 10 | +++ b/pppd/lcp.c |
| 11 | @@ -1904,12 +1904,12 @@ lcp_up(f) |
| 12 | * the interface MTU is set to the lowest of that, the |
| 13 | * MTU we want to use, and our link MRU. |
| 14 | */ |
| 15 | - mtu = ho->neg_mru? ho->mru: PPP_MRU; |
| 16 | + mtu = MIN(ho->neg_mru? ho->mru: PPP_MRU, ao->mru); |
| 17 | mru = go->neg_mru? MAX(wo->mru, go->mru): PPP_MRU; |
| 18 | #ifdef HAVE_MULTILINK |
| 19 | if (!(multilink && go->neg_mrru && ho->neg_mrru)) |
| 20 | #endif /* HAVE_MULTILINK */ |
| 21 | - netif_set_mtu(f->unit, MIN(MIN(mtu, mru), ao->mru)); |
| 22 | + netif_set_mtu(f->unit, MIN(mtu, mru)); |
| 23 | ppp_send_config(f->unit, mtu, |
| 24 | (ho->neg_asyncmap? ho->asyncmap: 0xffffffff), |
| 25 | ho->neg_pcompression, ho->neg_accompression); |
| 26 | |