207-lcp_mtu_max.patch 993 B

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