summaryrefslogtreecommitdiffstats
path: root/xtoptions.c
Commit message (Collapse)AuthorAgeFilesLines
* src: move all iptables pieces into a separate directoryJan Engelhardt2011-06-071-1155/+0
| | | | | | (Unclutter top-level dir) Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* libxtables: have xtopt_parse_mint interpret partially-spec'd rangesJan Engelhardt2011-05-251-13/+19
| | | | | | | | | | | | | When ":n" or "n:" is specified, it will now be interpreted as "0:n" and "n:<max>", respecitvely. nvals will always reflect the number of (expanded) components. This restores the functionality of options that take such partially-unspecified ranges. This makes it possible to nuke the per-matchdata init functions of some extensions and simply the extensions postparsing to the point where it only needs to check for nvals==1 or ==2. Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* libxtables: unclutter xtopt_parse_mintJan Engelhardt2011-05-241-54/+94
| | | | | | ..by moving type-based actions into their own function. Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* libxtables: make multiint parser have greater rangeJan Engelhardt2011-05-241-11/+27
| | | | | | | | Since parse_mint can handle XTTYPE_UINT64RC, it must allow numbers larger than UINT32_MAX. Cc: JP Abgrall <jpa@google.com> Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* libxtables: use uintmax for xtables_strtoulJan Engelhardt2011-05-241-3/+3
| | | | | | | | | | | | | | | Addendum to 2305d5fb42fc059f38fc1bdf53411dbeecdb310b. I noticed that unsigned long long is not consistently used, for example, min/max are still just unsigned long, and strtoul is being called. Instead of changing it to unsigned long long, just use uintmax functions right away so this does not need size-related changing in the future. Cc: JP Abgrall <jpa@google.com> Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* libxtables: more detailed error message on multi-int parsingJan Engelhardt2011-05-241-4/+5
| | | | | | Now shows where exactly the error is. Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* libxt_quota: make sure uint64 is not truncatedJP Abgrall2011-05-201-2/+2
| | | | | The xtables_strtoul() would cram a long long into a long. The parse_int would try to cram a UINT64 into a long.
* libxtables: retract _NE types and use a flag insteadJan Engelhardt2011-05-181-8/+5
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* libxtables: collapse double protocol parsingJan Engelhardt2011-05-121-13/+1
| | | | | | | Un-dent xtables_parse_protocol, and make xtopt_parse_protocol make use of it. Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* libxtables: avoid running into .also checks when option not usedJan Engelhardt2011-05-121-0/+3
| | | | | | | If a particular option was not specified, it should not be subject to .also checks in xtables_option_fcheck2 either. Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* libxtables: XTTYPE_ETHERMAC supportJan Engelhardt2011-05-091-0/+26
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* libxtables: XTTYPE_PROTOCOL supportJan Engelhardt2011-05-091-0/+25
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* libxt_multiport: use guided option parserJan Engelhardt2011-05-091-0/+2
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* libxtables: XTTYPE_HOSTMASK supportJan Engelhardt2011-05-091-0/+29
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* libxtables: XTTYPE_PLEN supportJan Engelhardt2011-05-091-14/+27
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* libxtables: flag invalid uses of XTOPT_PUTJan Engelhardt2011-05-091-1/+2
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* libxtables: do not overlay addr and mask parts, and cleanupJan Engelhardt2011-05-091-19/+31
| | | | | | | | | XTTYPE_HOSTMASK will require that what has now become haddr, hmask/hlen are not overlays of another. Thus relax the structure and always set all members of the {haddr, hmask, hlen} triplet now for all types that touch any of the members. Add some more comments and clean out ONEHOST.
* libxtables: support for XTTYPE_PLENMASKJan Engelhardt2011-05-091-0/+43
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* libxtables: XTTYPE_DOUBLE supportJan Engelhardt2011-05-091-0/+25
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* libxtables: fix assignment in wrong offset (XTTYPE_UINT*RC)Jan Engelhardt2011-05-081-1/+1
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* libxtables: XTTYPE_PORTRC supportJan Engelhardt2011-05-011-0/+59
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* libxt_TOS: use guided option parserJan Engelhardt2011-05-011-0/+81
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* xtoptions: respect return value in xtables_getportbynameJan Engelhardt2011-04-141-0/+2
| | | | | | If ret was negative, ntohs may make it positive, which is undesired. Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* libxtables: XTTYPE_PORT supportJan Engelhardt2011-04-131-0/+51
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* libxtables: XTTYPE_ONEHOST supportJan Engelhardt2011-04-131-0/+59
| | | | | | | | The bonus of the POSIX socket API is that it is almost protocol-agnostic and that there are ready-made functions to take over the gist of address parsing and packing. Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* libxtables: XTTYPE_SYSLOGLEVEL supportJan Engelhardt2011-04-131-0/+48
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* libxtables: pass struct xt_entry_{match,target} to x6 parserJan Engelhardt2011-04-131-0/+2
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* libxtables: XTTYPE_UINT16 supportJan Engelhardt2011-04-131-0/+8
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* libxtables: XTTYPE_UINT64RC supportJan Engelhardt2011-04-131-0/+8
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* libxtables: XTTYPE_UINT8RC supportJan Engelhardt2011-04-131-3/+11
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* libxtables: XTTYPE_UINT16RC supportJan Engelhardt2011-04-131-7/+21
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* libxtables: linked-list name<->id mapJan Engelhardt2011-04-131-0/+99
| | | | | | This consolidates the maps from libxt_devgroup and libxt_realm. Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* libxtables: XTTYPE_UINT64 supportJan Engelhardt2011-04-131-2/+10
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* libxtables: XTTYPE_MARKMASK32 supportJan Engelhardt2011-04-131-0/+29
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* libxtables: XTTYPE_STRING supportJan Engelhardt2011-04-061-0/+25
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* libxtables: XTTYPE_UINT32RC supportJan Engelhardt2011-04-061-1/+54
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* libxtables: XTTYPE_UINT8 supportJan Engelhardt2011-04-061-1/+9
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* libxtables: min-max option supportJan Engelhardt2011-04-061-0/+5
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* libxtables: XTTYPE_UINT32 supportJan Engelhardt2011-04-061-2/+24
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* libxtables: provide better final_checkJan Engelhardt2011-04-061-0/+40
| | | | | | | | This passes the per-extension data block to the new x6_fcheck function pointer, which can then do last alterations without using hacks like global variables (think libxt_statistic). Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* libxtables: guided option parserJan Engelhardt2011-04-061-0/+299
This patchset seeks to drastically reduce the code in the individual extensions by centralizing their argument parsing (breakdown of strings), validation, and in part, assignment. As a secondary goal, this reduces the number of static storage duration variables in flight. Signed-off-by: Jan Engelhardt <jengelh@medozas.de>