iptables-1.4.12-libxt_TCPMSS.c-unbreak-build-without-ipv6.patch 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. From b5bfbb9fcac3d4c87bcf6da55ed40d63d456017d Mon Sep 17 00:00:00 2001
  2. From: Peter Korsgaard <jacmet@sunsite.dk>
  3. Date: Fri, 22 Jul 2011 07:19:09 +0200
  4. Subject: [PATCH] libxt_TCPMSS.c: unbreak build without ipv6 after ea2a02f7
  5. ea2a02f7 (libxt_TCPMSS: use guided option parser) added an netinet/ip6.h
  6. include, which is not available on systems without ipv6.
  7. The ip.h / ipv6.h includes are only used to know the size of struct
  8. iphdr / ip6_hdr, so simply hardcode those instead.
  9. Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
  10. ---
  11. extensions/libxt_TCPMSS.c | 13 +++++++------
  12. 1 files changed, 7 insertions(+), 6 deletions(-)
  13. diff --git a/extensions/libxt_TCPMSS.c b/extensions/libxt_TCPMSS.c
  14. index 2266326..310dd17 100644
  15. --- a/extensions/libxt_TCPMSS.c
  16. +++ b/extensions/libxt_TCPMSS.c
  17. @@ -4,8 +4,6 @@
  18. */
  19. #include <stdio.h>
  20. #include <xtables.h>
  21. -#include <netinet/ip.h>
  22. -#include <netinet/ip6.h>
  23. #include <linux/netfilter/xt_TCPMSS.h>
  24. enum {
  25. @@ -13,6 +11,9 @@ enum {
  26. O_CLAMP_MSS,
  27. };
  28. +#define IPHDRSIZE 20 /* sizeof(struct iphdr) */
  29. +#define IP6HDRSIZE 40 /* sizeof(struct ip6_hdr) */
  30. +
  31. struct mssinfo {
  32. struct xt_entry_target t;
  33. struct xt_tcpmss_info mss;
  34. @@ -29,17 +30,17 @@ hdrsize);
  35. static void TCPMSS_help(void)
  36. {
  37. - __TCPMSS_help(sizeof(struct iphdr));
  38. + __TCPMSS_help(IPHDRSIZE);
  39. }
  40. static void TCPMSS_help6(void)
  41. {
  42. - __TCPMSS_help(sizeof(struct ip6_hdr));
  43. + __TCPMSS_help(IP6HDRSIZE);
  44. }
  45. static const struct xt_option_entry TCPMSS4_opts[] = {
  46. {.name = "set-mss", .id = O_SET_MSS, .type = XTTYPE_UINT16,
  47. - .min = 0, .max = UINT16_MAX - sizeof(struct iphdr),
  48. + .min = 0, .max = UINT16_MAX - IPHDRSIZE,
  49. .flags = XTOPT_PUT, XTOPT_POINTER(struct xt_tcpmss_info, mss)},
  50. {.name = "clamp-mss-to-pmtu", .id = O_CLAMP_MSS, .type = XTTYPE_NONE},
  51. XTOPT_TABLEEND,
  52. @@ -47,7 +48,7 @@ static const struct xt_option_entry TCPMSS4_opts[] = {
  53. static const struct xt_option_entry TCPMSS6_opts[] = {
  54. {.name = "set-mss", .id = O_SET_MSS, .type = XTTYPE_UINT16,
  55. - .min = 0, .max = UINT16_MAX - sizeof(struct ip6_hdr),
  56. + .min = 0, .max = UINT16_MAX - IP6HDRSIZE,
  57. .flags = XTOPT_PUT, XTOPT_POINTER(struct xt_tcpmss_info, mss)},
  58. {.name = "clamp-mss-to-pmtu", .id = O_CLAMP_MSS, .type = XTTYPE_NONE},
  59. XTOPT_TABLEEND,
  60. --
  61. 1.7.5.4