static void dccp_parse(struct xt_option_call *cb) { struct xt_dccp_info *einfo = cb->data; xtables_option_parse(cb); switch (cb->entry->id) { case O_SOURCE_PORT: einfo->flags |= XT_DCCP_SRC_PORTS; if (cb->invert) einfo->invflags |= XT_DCCP_SRC_PORTS; break; case O_DEST_PORT: einfo->flags |= XT_DCCP_DEST_PORTS; if (cb->invert) einfo->invflags |= XT_DCCP_DEST_PORTS; break; case O_DCCP_TYPES: einfo->flags |= XT_DCCP_TYPE; einfo->typemask = parse_dccp_types(cb->arg); if (cb->invert) einfo->invflags |= XT_DCCP_TYPE; break; case O_DCCP_OPTION: einfo->flags |= XT_DCCP_OPTION; if (cb->invert) einfo->invflags |= XT_DCCP_OPTION; break; } }
static int dccp_parse(int c, char **argv, int invert, unsigned int *flags, const void *entry, struct xt_entry_match **match) { struct xt_dccp_info *einfo = (struct xt_dccp_info *)(*match)->data; switch (c) { case '1': if (*flags & XT_DCCP_SRC_PORTS) xtables_error(PARAMETER_PROBLEM, "Only one `--source-port' allowed"); einfo->flags |= XT_DCCP_SRC_PORTS; xtables_check_inverse(optarg, &invert, &optind, 0, argv); parse_dccp_ports(optarg, einfo->spts); if (invert) einfo->invflags |= XT_DCCP_SRC_PORTS; *flags |= XT_DCCP_SRC_PORTS; break; case '2': if (*flags & XT_DCCP_DEST_PORTS) xtables_error(PARAMETER_PROBLEM, "Only one `--destination-port' allowed"); einfo->flags |= XT_DCCP_DEST_PORTS; xtables_check_inverse(optarg, &invert, &optind, 0, argv); parse_dccp_ports(optarg, einfo->dpts); if (invert) einfo->invflags |= XT_DCCP_DEST_PORTS; *flags |= XT_DCCP_DEST_PORTS; break; case '3': if (*flags & XT_DCCP_TYPE) xtables_error(PARAMETER_PROBLEM, "Only one `--dccp-types' allowed"); einfo->flags |= XT_DCCP_TYPE; xtables_check_inverse(optarg, &invert, &optind, 0, argv); einfo->typemask = parse_dccp_types(optarg); if (invert) einfo->invflags |= XT_DCCP_TYPE; *flags |= XT_DCCP_TYPE; break; case '4': if (*flags & XT_DCCP_OPTION) xtables_error(PARAMETER_PROBLEM, "Only one `--dccp-option' allowed"); einfo->flags |= XT_DCCP_OPTION; xtables_check_inverse(optarg, &invert, &optind, 0, argv); einfo->option = parse_dccp_option(optarg); if (invert) einfo->invflags |= XT_DCCP_OPTION; *flags |= XT_DCCP_OPTION; break; default: return 0; } return 1; }
static int parse(int c, char **argv, int invert, unsigned int *flags, const struct ipt_entry *entry, unsigned int *nfcache, struct ipt_entry_match **match) { struct ipt_dccp_info *einfo = (struct ipt_dccp_info *)(*match)->data; switch (c) { case '1': if (*flags & IPT_DCCP_SRC_PORTS) exit_error(PARAMETER_PROBLEM, "Only one `--source-port' allowed"); einfo->flags |= IPT_DCCP_SRC_PORTS; check_inverse(optarg, &invert, &optind, 0); parse_dccp_ports(argv[optind-1], einfo->spts); if (invert) einfo->invflags |= IPT_DCCP_SRC_PORTS; *flags |= IPT_DCCP_SRC_PORTS; break; case '2': if (*flags & IPT_DCCP_DEST_PORTS) exit_error(PARAMETER_PROBLEM, "Only one `--destination-port' allowed"); einfo->flags |= IPT_DCCP_DEST_PORTS; check_inverse(optarg, &invert, &optind, 0); parse_dccp_ports(argv[optind-1], einfo->dpts); if (invert) einfo->invflags |= IPT_DCCP_DEST_PORTS; *flags |= IPT_DCCP_DEST_PORTS; break; case '3': if (*flags & IPT_DCCP_TYPE) exit_error(PARAMETER_PROBLEM, "Only one `--dccp-types' allowed"); einfo->flags |= IPT_DCCP_TYPE; check_inverse(optarg, &invert, &optind, 0); einfo->typemask = parse_dccp_types(argv[optind-1]); if (invert) einfo->invflags |= IPT_DCCP_TYPE; *flags |= IPT_DCCP_TYPE; break; case '4': if (*flags & IPT_DCCP_OPTION) exit_error(PARAMETER_PROBLEM, "Only one `--dccp-option' allowed"); einfo->flags |= IPT_DCCP_OPTION; check_inverse(optarg, &invert, &optind, 0); einfo->option = parse_dccp_option(argv[optind-1]); if (invert) einfo->invflags |= IPT_DCCP_OPTION; *flags |= IPT_DCCP_OPTION; break; default: return 0; } return 1; }