mirror of
git://git.code.sf.net/p/xtables-addons/xtables-addons
synced 2025-09-23 04:54:58 +02:00
ipset: update to 5.3
This commit is contained in:
@@ -711,6 +711,14 @@ enum ipaddr_type {
|
||||
IPADDR_RANGE,
|
||||
};
|
||||
|
||||
static inline bool
|
||||
cidr_hostaddr(const char *str, uint8_t family)
|
||||
{
|
||||
char *a = cidr_separator(str);
|
||||
|
||||
return family == AF_INET ? STREQ(a, "/32") : STREQ(a, "/128");
|
||||
}
|
||||
|
||||
static int
|
||||
parse_ip(struct ipset_session *session,
|
||||
enum ipset_opt opt, const char *str, enum ipaddr_type addrtype)
|
||||
@@ -725,7 +733,8 @@ parse_ip(struct ipset_session *session,
|
||||
|
||||
switch (addrtype) {
|
||||
case IPADDR_PLAIN:
|
||||
if (range_separator(str) || cidr_separator(str))
|
||||
if (range_separator(str)
|
||||
|| (cidr_separator(str) && !cidr_hostaddr(str, family)))
|
||||
return syntax_err("plain IP address must be supplied: %s",
|
||||
str);
|
||||
break;
|
||||
@@ -836,7 +845,7 @@ ipset_parse_net(struct ipset_session *session,
|
||||
*/
|
||||
int
|
||||
ipset_parse_range(struct ipset_session *session,
|
||||
enum ipset_opt opt, const char *str)
|
||||
enum ipset_opt opt ASSERT_UNUSED, const char *str)
|
||||
{
|
||||
assert(session);
|
||||
assert(opt == IPSET_OPT_IP || opt == IPSET_OPT_IP2);
|
||||
@@ -1313,7 +1322,7 @@ ipset_parse_flag(struct ipset_session *session,
|
||||
*/
|
||||
int
|
||||
ipset_parse_typename(struct ipset_session *session,
|
||||
enum ipset_opt opt, const char *str)
|
||||
enum ipset_opt opt ASSERT_UNUSED, const char *str)
|
||||
{
|
||||
const struct ipset_type *type;
|
||||
const char *typename;
|
||||
|
@@ -89,7 +89,8 @@ ipset_print_ether(char *buf, unsigned int len,
|
||||
*/
|
||||
int
|
||||
ipset_print_family(char *buf, unsigned int len,
|
||||
const struct ipset_data *data, enum ipset_opt opt,
|
||||
const struct ipset_data *data,
|
||||
enum ipset_opt opt ASSERT_UNUSED,
|
||||
uint8_t env UNUSED)
|
||||
{
|
||||
uint8_t family;
|
||||
@@ -410,7 +411,8 @@ ipset_print_name(char *buf, unsigned int len,
|
||||
*/
|
||||
int
|
||||
ipset_print_port(char *buf, unsigned int len,
|
||||
const struct ipset_data *data, enum ipset_opt opt,
|
||||
const struct ipset_data *data,
|
||||
enum ipset_opt opt ASSERT_UNUSED,
|
||||
uint8_t env UNUSED)
|
||||
{
|
||||
const uint16_t *port;
|
||||
@@ -454,7 +456,8 @@ ipset_print_port(char *buf, unsigned int len,
|
||||
*/
|
||||
int
|
||||
ipset_print_proto(char *buf, unsigned int len,
|
||||
const struct ipset_data *data, enum ipset_opt opt,
|
||||
const struct ipset_data *data,
|
||||
enum ipset_opt opt ASSERT_UNUSED,
|
||||
uint8_t env UNUSED)
|
||||
{
|
||||
const struct protoent *protoent;
|
||||
@@ -490,7 +493,8 @@ ipset_print_proto(char *buf, unsigned int len,
|
||||
*/
|
||||
int
|
||||
ipset_print_icmp(char *buf, unsigned int len,
|
||||
const struct ipset_data *data, enum ipset_opt opt,
|
||||
const struct ipset_data *data,
|
||||
enum ipset_opt opt ASSERT_UNUSED,
|
||||
uint8_t env UNUSED)
|
||||
{
|
||||
const char *name;
|
||||
@@ -523,7 +527,8 @@ ipset_print_icmp(char *buf, unsigned int len,
|
||||
*/
|
||||
int
|
||||
ipset_print_icmpv6(char *buf, unsigned int len,
|
||||
const struct ipset_data *data, enum ipset_opt opt,
|
||||
const struct ipset_data *data,
|
||||
enum ipset_opt opt ASSERT_UNUSED,
|
||||
uint8_t env UNUSED)
|
||||
{
|
||||
const char *name;
|
||||
@@ -556,7 +561,8 @@ ipset_print_icmpv6(char *buf, unsigned int len,
|
||||
*/
|
||||
int
|
||||
ipset_print_proto_port(char *buf, unsigned int len,
|
||||
const struct ipset_data *data, enum ipset_opt opt,
|
||||
const struct ipset_data *data,
|
||||
enum ipset_opt opt ASSERT_UNUSED,
|
||||
uint8_t env UNUSED)
|
||||
{
|
||||
int size, offset = 0;
|
||||
|
@@ -100,6 +100,19 @@ ipset_saved_type(const struct ipset_session *session)
|
||||
return session->saved_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* ipset_session_lineno - set session lineno
|
||||
* @session: session structure
|
||||
*
|
||||
* Set session lineno to report parser errors correctly.
|
||||
*/
|
||||
void
|
||||
ipset_session_lineno(struct ipset_session *session, uint32_t lineno)
|
||||
{
|
||||
assert(session);
|
||||
session->lineno = lineno;
|
||||
}
|
||||
|
||||
/*
|
||||
* Environment options
|
||||
*/
|
||||
|
Reference in New Issue
Block a user