• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/iptables-1.4.12.1/extensions/

Lines Matching defs:*

0 /* Shared library add-on to iptables to add TCPMSS target support.
3 * Copyright (c) 2000 Marc Boucher
5 #include "config.h"
6 #include <stdio.h>
7 #include <xtables.h>
8 #include <netinet/ip.h>
9 #include <linux/netfilter/xt_TCPMSS.h>
11 enum {
12 O_SET_MSS = 0,
13 O_CLAMP_MSS,
16 struct mssinfo {
17 struct xt_entry_target t;
18 struct xt_tcpmss_info mss;
21 static void __TCPMSS_help(int hdrsize)
23 printf(
24 "TCPMSS target mutually-exclusive options:\n"
25 " --set-mss value explicitly set MSS option to specified value\n"
26 " --clamp-mss-to-pmtu automatically clamp MSS value to (path_MTU - %d)\n",
27 hdrsize);
30 static void TCPMSS_help(void)
32 __TCPMSS_help(sizeof(struct iphdr));
35 static void TCPMSS_help6(void)
37 __TCPMSS_help(SIZEOF_STRUCT_IP6_HDR);
40 static const struct xt_option_entry TCPMSS4_opts[] = {
41 {.name = "set-mss", .id = O_SET_MSS, .type = XTTYPE_UINT16,
42 .min = 0, .max = UINT16_MAX - sizeof(struct iphdr),
43 .flags = XTOPT_PUT, XTOPT_POINTER(struct xt_tcpmss_info, mss)},
44 {.name = "clamp-mss-to-pmtu", .id = O_CLAMP_MSS, .type = XTTYPE_NONE},
45 XTOPT_TABLEEND,
48 static const struct xt_option_entry TCPMSS6_opts[] = {
49 {.name = "set-mss", .id = O_SET_MSS, .type = XTTYPE_UINT16,
50 .min = 0, .max = UINT16_MAX - SIZEOF_STRUCT_IP6_HDR,
51 .flags = XTOPT_PUT, XTOPT_POINTER(struct xt_tcpmss_info, mss)},
52 {.name = "clamp-mss-to-pmtu", .id = O_CLAMP_MSS, .type = XTTYPE_NONE},
53 XTOPT_TABLEEND,
56 static void TCPMSS_parse(struct xt_option_call *cb)
58 struct xt_tcpmss_info *mssinfo = cb->data;
60 xtables_option_parse(cb);
61 if (cb->entry->id == O_CLAMP_MSS)
62 mssinfo->mss = XT_TCPMSS_CLAMP_PMTU;
65 static void TCPMSS_check(struct xt_fcheck_call *cb)
67 if (cb->xflags == 0)
68 xtables_error(PARAMETER_PROBLEM,
69 "TCPMSS target: At least one parameter is required");
72 static void TCPMSS_print(const void *ip, const struct xt_entry_target *target,
73 int numeric)
75 const struct xt_tcpmss_info *mssinfo =
76 (const struct xt_tcpmss_info *)target->data;
77 if(mssinfo->mss == XT_TCPMSS_CLAMP_PMTU)
78 printf(" TCPMSS clamp to PMTU");
79 else
80 printf(" TCPMSS set %u", mssinfo->mss);
83 static void TCPMSS_save(const void *ip, const struct xt_entry_target *target)
85 const struct xt_tcpmss_info *mssinfo =
86 (const struct xt_tcpmss_info *)target->data;
88 if(mssinfo->mss == XT_TCPMSS_CLAMP_PMTU)
89 printf(" --clamp-mss-to-pmtu");
90 else
91 printf(" --set-mss %u", mssinfo->mss);
94 static struct xtables_target tcpmss_tg_reg[] = {
96 .family = NFPROTO_IPV4,
97 .name = "TCPMSS",
98 .version = XTABLES_VERSION,
99 .size = XT_ALIGN(sizeof(struct xt_tcpmss_info)),
100 .userspacesize = XT_ALIGN(sizeof(struct xt_tcpmss_info)),
101 .help = TCPMSS_help,
102 .print = TCPMSS_print,
103 .save = TCPMSS_save,
104 .x6_parse = TCPMSS_parse,
105 .x6_fcheck = TCPMSS_check,
106 .x6_options = TCPMSS4_opts,
109 .family = NFPROTO_IPV6,
110 .name = "TCPMSS",
111 .version = XTABLES_VERSION,
112 .size = XT_ALIGN(sizeof(struct xt_tcpmss_info)),
113 .userspacesize = XT_ALIGN(sizeof(struct xt_tcpmss_info)),
114 .help = TCPMSS_help6,
115 .print = TCPMSS_print,
116 .save = TCPMSS_save,
117 .x6_parse = TCPMSS_parse,
118 .x6_fcheck = TCPMSS_check,
119 .x6_options = TCPMSS6_opts,
123 void _init(void)
125 xtables_register_targets(tcpmss_tg_reg, ARRAY_SIZE(tcpmss_tg_reg));