From c02c92d1fcaa1223caf9a5eef32bedcb78f1e714 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Wed, 18 May 2011 22:48:51 +0200 Subject: libxtables: retract _NE types and use a flag instead Signed-off-by: Jan Engelhardt --- include/xtables.h.in | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/xtables.h.in b/include/xtables.h.in index 38c0e5ee..f88813f5 100644 --- a/include/xtables.h.in +++ b/include/xtables.h.in @@ -64,10 +64,9 @@ struct in_addr; * %XTTYPE_HOSTMASK: one host or address, with an optional prefix length * (ptr: union nf_inet_addr; only host portion is stored) * %XTTYPE_PROTOCOL: protocol number/name from /etc/protocols (ptr: uint8_t) - * %XTTYPE_PORT: 16-bit port name or number - * %XTTYPE_PORT_NE: 16-bit port name or number, stored as network-endian - * %XTTYPE_PORTRC: colon-separated port range (names acceptable) - * %XTTYPE_PORTRC_NE: same as %XTTYPE_PORTRC, stored in network-endian + * %XTTYPE_PORT: 16-bit port name or number (supports %XTOPT_NBO) + * %XTTYPE_PORTRC: colon-separated port range (names acceptable), + * (supports %XTOPT_NBO) * %XTTYPE_PLEN: prefix length * %XTTYPE_PLENMASK: prefix length (ptr: union nf_inet_addr) * %XTTYPE_ETHERMAC: Ethernet MAC address in hex form @@ -91,9 +90,7 @@ enum xt_option_type { XTTYPE_HOSTMASK, XTTYPE_PROTOCOL, XTTYPE_PORT, - XTTYPE_PORT_NE, XTTYPE_PORTRC, - XTTYPE_PORTRC_NE, XTTYPE_PLEN, XTTYPE_PLENMASK, XTTYPE_ETHERMAC, @@ -104,12 +101,15 @@ enum xt_option_type { * %XTOPT_MAND: option is mandatory * %XTOPT_MULTI: option may be specified multiple times * %XTOPT_PUT: store value into memory at @ptroff + * %XTOPT_NBO: store value in network-byte order + * (only certain XTTYPEs recognize this) */ enum xt_option_flags { XTOPT_INVERT = 1 << 0, XTOPT_MAND = 1 << 1, XTOPT_MULTI = 1 << 2, XTOPT_PUT = 1 << 3, + XTOPT_NBO = 1 << 4, }; /** -- cgit v1.2.3 From 2305d5fb42fc059f38fc1bdf53411dbeecdb310b Mon Sep 17 00:00:00 2001 From: JP Abgrall Date: Wed, 18 May 2011 20:26:14 -0700 Subject: libxt_quota: make sure uint64 is not truncated The xtables_strtoul() would cram a long long into a long. The parse_int would try to cram a UINT64 into a long. --- include/xtables.h.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/xtables.h.in b/include/xtables.h.in index f88813f5..90eb1b2b 100644 --- a/include/xtables.h.in +++ b/include/xtables.h.in @@ -408,7 +408,7 @@ extern void xtables_register_matches(struct xtables_match *, unsigned int); extern void xtables_register_target(struct xtables_target *me); extern void xtables_register_targets(struct xtables_target *, unsigned int); -extern bool xtables_strtoul(const char *, char **, unsigned long *, +extern bool xtables_strtoul(const char *, char **, unsigned long long *, unsigned long, unsigned long); extern bool xtables_strtoui(const char *, char **, unsigned int *, unsigned int, unsigned int); -- cgit v1.2.3 From 0b7a140944738d67b9c4e6f09992c8407eefb18a Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Tue, 24 May 2011 02:30:23 +0200 Subject: libxtables: use uintmax for xtables_strtoul 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 Signed-off-by: Jan Engelhardt --- include/xtables.h.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/xtables.h.in b/include/xtables.h.in index 90eb1b2b..2565dd23 100644 --- a/include/xtables.h.in +++ b/include/xtables.h.in @@ -408,8 +408,8 @@ extern void xtables_register_matches(struct xtables_match *, unsigned int); extern void xtables_register_target(struct xtables_target *me); extern void xtables_register_targets(struct xtables_target *, unsigned int); -extern bool xtables_strtoul(const char *, char **, unsigned long long *, - unsigned long, unsigned long); +extern bool xtables_strtoul(const char *, char **, uintmax_t *, + uintmax_t, uintmax_t); extern bool xtables_strtoui(const char *, char **, unsigned int *, unsigned int, unsigned int); extern int xtables_service_to_port(const char *name, const char *proto); -- cgit v1.2.3