107-debian_pppatm_cleanup.patch 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. --- a/pppd/plugins/pppoatm/pppoatm.c
  2. +++ b/pppd/plugins/pppoatm/pppoatm.c
  3. @@ -70,18 +70,20 @@ static int setdevname_pppoatm(const char
  4. {
  5. struct sockaddr_atmpvc addr;
  6. extern struct stat devstat;
  7. +
  8. if (device_got_set)
  9. return 0;
  10. - //info("PPPoATM setdevname_pppoatm: '%s'", cp);
  11. +
  12. memset(&addr, 0, sizeof addr);
  13. if (text2atm(cp, (struct sockaddr *) &addr, sizeof(addr),
  14. - T2A_PVC | T2A_NAME) < 0) {
  15. - if(doit)
  16. - info("atm does not recognize: %s", cp);
  17. + T2A_PVC | T2A_NAME | T2A_WILDCARD) < 0) {
  18. + if (doit)
  19. + info("cannot parse the ATM address: %s", cp);
  20. return 0;
  21. - }
  22. - if (!doit) return 1;
  23. - //if (!dev_set_ok()) return -1;
  24. + }
  25. + if (!doit)
  26. + return 1;
  27. +
  28. memcpy(&pvcaddr, &addr, sizeof pvcaddr);
  29. strlcpy(devnam, cp, sizeof devnam);
  30. devstat.st_mode = S_IFSOCK;
  31. @@ -93,7 +95,6 @@ static int setdevname_pppoatm(const char
  32. lcp_allowoptions[0].neg_asyncmap = 0;
  33. lcp_wantoptions[0].neg_pcompression = 0;
  34. }
  35. - info("PPPoATM setdevname_pppoatm - SUCCESS:%s", cp);
  36. device_got_set = 1;
  37. return 1;
  38. }
  39. @@ -108,6 +109,7 @@ static void no_device_given_pppoatm(void
  40. static void set_line_discipline_pppoatm(int fd)
  41. {
  42. struct atm_backend_ppp be;
  43. +
  44. be.backend_num = ATM_BACKEND_PPP;
  45. if (!llc_encaps)
  46. be.encaps = PPPOATM_ENCAPS_VC;
  47. @@ -115,6 +117,7 @@ static void set_line_discipline_pppoatm(
  48. be.encaps = PPPOATM_ENCAPS_LLC;
  49. else
  50. be.encaps = PPPOATM_ENCAPS_AUTODETECT;
  51. +
  52. if (ioctl(fd, ATM_SETBACKEND, &be) < 0)
  53. fatal("ioctl(ATM_SETBACKEND): %m");
  54. }
  55. @@ -175,16 +178,19 @@ static void send_config_pppoa(int mtu,
  56. {
  57. int sock;
  58. struct ifreq ifr;
  59. +
  60. if (mtu > pppoatm_max_mtu)
  61. error("Couldn't increase MTU to %d", mtu);
  62. +
  63. sock = socket(AF_INET, SOCK_DGRAM, 0);
  64. if (sock < 0)
  65. fatal("Couldn't create IP socket: %m");
  66. +
  67. strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
  68. ifr.ifr_mtu = mtu;
  69. if (ioctl(sock, SIOCSIFMTU, (caddr_t) &ifr) < 0)
  70. fatal("ioctl(SIOCSIFMTU): %m");
  71. - (void) close (sock);
  72. + close(sock);
  73. }
  74. static void recv_config_pppoa(int mru,
  75. @@ -198,7 +204,7 @@ static void recv_config_pppoa(int mru,
  76. void plugin_init(void)
  77. {
  78. -#if defined(__linux__)
  79. +#ifdef linux
  80. extern int new_style_driver; /* From sys-linux.c */
  81. if (!ppp_available() && !new_style_driver)
  82. fatal("Kernel doesn't support ppp_generic - "
  83. @@ -206,9 +212,9 @@ void plugin_init(void)
  84. #else
  85. fatal("No PPPoATM support on this OS");
  86. #endif
  87. - info("PPPoATM plugin_init");
  88. add_options(pppoa_options);
  89. }
  90. +
  91. struct channel pppoa_channel = {
  92. options: pppoa_options,
  93. process_extra_options: NULL,