400-simplify_kernel_checks.patch 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. --- a/pppd/sys-linux.c
  2. +++ b/pppd/sys-linux.c
  3. @@ -203,7 +203,7 @@ static int driver_is_old = 0;
  4. static int restore_term = 0; /* 1 => we've munged the terminal */
  5. static struct termios inittermios; /* Initial TTY termios */
  6. -int new_style_driver = 0;
  7. +static const int new_style_driver = 1;
  8. static char loop_name[20];
  9. static unsigned char inbuf[512]; /* buffer for chars read from loopback */
  10. @@ -220,8 +220,8 @@ static int looped; /* 1 if using loop
  11. static int link_mtu; /* mtu for the link (not bundle) */
  12. static struct utsname utsname; /* for the kernel version */
  13. -static int kernel_version;
  14. #define KVERSION(j,n,p) ((j)*1000000 + (n)*1000 + (p))
  15. +static const int kernel_version = KVERSION(2,6,37);
  16. #define MAX_IFS 100
  17. @@ -1438,11 +1438,12 @@ int ccp_fatal_error (int unit)
  18. *
  19. * path_to_procfs - find the path to the proc file system mount point
  20. */
  21. -static char proc_path[MAXPATHLEN];
  22. -static int proc_path_len;
  23. +static char proc_path[MAXPATHLEN] = "/proc";
  24. +static int proc_path_len = 5;
  25. static char *path_to_procfs(const char *tail)
  26. {
  27. +#if 0
  28. struct mntent *mntent;
  29. FILE *fp;
  30. @@ -1464,6 +1465,7 @@ static char *path_to_procfs(const char *
  31. fclose (fp);
  32. }
  33. }
  34. +#endif
  35. strlcpy(proc_path + proc_path_len, tail,
  36. sizeof(proc_path) - proc_path_len);
  37. @@ -2116,15 +2118,19 @@ int ppp_available(void)
  38. int my_version, my_modification, my_patch;
  39. int osmaj, osmin, ospatch;
  40. +#if 0
  41. /* get the kernel version now, since we are called before sys_init */
  42. uname(&utsname);
  43. osmaj = osmin = ospatch = 0;
  44. sscanf(utsname.release, "%d.%d.%d", &osmaj, &osmin, &ospatch);
  45. kernel_version = KVERSION(osmaj, osmin, ospatch);
  46. +#endif
  47. fd = open("/dev/ppp", O_RDWR);
  48. if (fd >= 0) {
  49. +#if 0
  50. new_style_driver = 1;
  51. +#endif
  52. /* XXX should get from driver */
  53. driver_version = 2;
  54. @@ -2185,6 +2191,7 @@ int ppp_available(void)
  55. if (ok && ((ifr.ifr_hwaddr.sa_family & ~0xFF) != ARPHRD_PPP))
  56. ok = 0;
  57. + return ok;
  58. /*
  59. * This is the PPP device. Validate the version of the driver at this
  60. @@ -2678,6 +2685,7 @@ get_pty(master_fdp, slave_fdp, slave_nam
  61. }
  62. #endif /* TIOCGPTN */
  63. +#if 0
  64. if (sfd < 0) {
  65. /* the old way - scan through the pty name space */
  66. for (i = 0; i < 64; ++i) {
  67. @@ -2696,6 +2704,7 @@ get_pty(master_fdp, slave_fdp, slave_nam
  68. }
  69. }
  70. }
  71. +#endif
  72. if (sfd < 0)
  73. return 0;
  74. --- a/pppd/plugins/pppoatm/pppoatm.c
  75. +++ b/pppd/plugins/pppoatm/pppoatm.c
  76. @@ -171,14 +171,6 @@ static void disconnect_pppoatm(void)
  77. void plugin_init(void)
  78. {
  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. - "needed for PPPoATM");
  84. -#else
  85. - fatal("No PPPoATM support on this OS");
  86. -#endif
  87. info("PPPoATM plugin_init");
  88. add_options(pppoa_options);
  89. }
  90. --- a/pppd/plugins/rp-pppoe/plugin.c
  91. +++ b/pppd/plugins/rp-pppoe/plugin.c
  92. @@ -60,9 +60,6 @@ static char const RCSID[] =
  93. char pppd_version[] = VERSION;
  94. -/* From sys-linux.c in pppd -- MUST FIX THIS! */
  95. -extern int new_style_driver;
  96. -
  97. char *pppd_pppoe_service = NULL;
  98. static char *acName = NULL;
  99. static char *existingSession = NULL;
  100. @@ -340,10 +337,6 @@ PPPoEDevnameHook(char *cmd, char **argv,
  101. void
  102. plugin_init(void)
  103. {
  104. - if (!ppp_available() && !new_style_driver) {
  105. - fatal("Linux kernel does not support PPPoE -- are you running 2.4.x?");
  106. - }
  107. -
  108. add_options(Options);
  109. info("RP-PPPoE plugin version %s compiled against pppd %s",
  110. --- a/pppd/plugins/pppol2tp/pppol2tp.c 2010-11-15 12:12:43.000000000 +0000
  111. +++ b/pppd/plugins/pppol2tp/pppol2tp.c 2012-04-24 15:53:58.806260309 +0100
  112. @@ -488,12 +488,7 @@ static void pppol2tp_check_options(void)
  113. void plugin_init(void)
  114. {
  115. -#if defined(__linux__)
  116. - extern int new_style_driver; /* From sys-linux.c */
  117. - if (!ppp_available() && !new_style_driver)
  118. - fatal("Kernel doesn't support ppp_generic - "
  119. - "needed for PPPoL2TP");
  120. -#else
  121. +#if !defined(__linux__)
  122. fatal("No PPPoL2TP support on this OS");
  123. #endif
  124. add_options(pppol2tp_options);