so the user know how we express it.
The base was added to all symbol tables, which are associated with
datatype->sym_tbl, so they are displayed in the right base.
Signed-off-by: Elise Lennion <elise.lennion@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
#define CONNLABEL_CONF DEFAULT_INCLUDE_PATH "/connlabel.conf"
static const struct symbol_table ct_state_tbl = {
+ .base = BASE_HEXADECIMAL,
.symbols = {
SYMBOL("invalid", NF_CT_STATE_INVALID_BIT),
SYMBOL("new", NF_CT_STATE_BIT(IP_CT_NEW)),
};
static const struct symbol_table ct_dir_tbl = {
+ .base = BASE_DECIMAL,
.symbols = {
SYMBOL("original", IP_CT_DIR_ORIGINAL),
SYMBOL("reply", IP_CT_DIR_REPLY),
/*
* There are more, but most of them don't make sense for filtering.
*/
+ .base = BASE_HEXADECIMAL,
.symbols = {
SYMBOL("expected", IPS_EXPECTED),
SYMBOL("seen-reply", IPS_SEEN_REPLY),
};
static const struct symbol_table nfproto_tbl = {
+ .base = BASE_DECIMAL,
.symbols = {
SYMBOL("ipv4", NFPROTO_IPV4),
SYMBOL("ipv6", NFPROTO_IPV6),
};
static const struct symbol_table icmp_code_tbl = {
+ .base = BASE_DECIMAL,
.symbols = {
SYMBOL("net-unreachable", ICMP_NET_UNREACH),
SYMBOL("host-unreachable", ICMP_HOST_UNREACH),
};
static const struct symbol_table icmpv6_code_tbl = {
+ .base = BASE_DECIMAL,
.symbols = {
SYMBOL("no-route", ICMPV6_NOROUTE),
SYMBOL("admin-prohibited", ICMPV6_ADM_PROHIBITED),
};
static const struct symbol_table icmpx_code_tbl = {
+ .base = BASE_DECIMAL,
.symbols = {
SYMBOL("port-unreachable", NFT_REJECT_ICMPX_PORT_UNREACH),
SYMBOL("admin-prohibited", NFT_REJECT_ICMPX_ADMIN_PROHIBITED),
printf("\n");
if (expr->dtype->sym_tbl != NULL) {
- printf("\npre-defined symbolic constants:\n");
+ printf("\npre-defined symbolic constants ");
+ if (expr->dtype->sym_tbl->base == BASE_DECIMAL)
+ printf("(in decimal):\n");
+ else
+ printf("(in hexadecimal):\n");
symbol_table_print(expr->dtype->sym_tbl, expr->dtype,
expr->byteorder);
}
HDR_TEMPLATE(__name, __dtype, struct ip6_mh, __member)
static const struct symbol_table mh_type_tbl = {
+ .base = BASE_DECIMAL,
.symbols = {
SYMBOL("binding-refresh-request", IP6_MH_TYPE_BRR),
SYMBOL("home-test-init", IP6_MH_TYPE_HOTI),
};
static const struct symbol_table addrtype_tbl = {
+ .base = BASE_DECIMAL,
.symbols = {
SYMBOL("unspec", RTN_UNSPEC),
SYMBOL("unicast", RTN_UNICAST),
};
static const struct symbol_table arphrd_tbl = {
+ .base = BASE_HEXADECIMAL,
.symbols = {
SYMBOL("ether", ARPHRD_ETHER),
SYMBOL("ppp", ARPHRD_PPP),
};
static const struct symbol_table pkttype_type_tbl = {
+ .base = BASE_DECIMAL,
.symbols = {
SYMBOL("host", PACKET_HOST),
SYMBOL("unicast", PACKET_HOST), /* backwards compat */
#include <netinet/ip_icmp.h>
static const struct symbol_table icmp_type_tbl = {
+ .base = BASE_DECIMAL,
.symbols = {
SYMBOL("echo-reply", ICMP_ECHOREPLY),
SYMBOL("destination-unreachable", ICMP_DEST_UNREACH),
#include <netinet/tcp.h>
static const struct symbol_table tcp_flag_tbl = {
+ .base = BASE_HEXADECIMAL,
.symbols = {
SYMBOL("fin", TCP_FLAG_FIN),
SYMBOL("syn", TCP_FLAG_SYN),
*/
static const struct symbol_table dccp_pkttype_tbl = {
+ .base = BASE_HEXADECIMAL,
.symbols = {
SYMBOL("request", DCCP_PKT_REQUEST),
SYMBOL("response", DCCP_PKT_RESPONSE),
#include <netinet/ip.h>
static const struct symbol_table dscp_type_tbl = {
+ .base = BASE_HEXADECIMAL,
.symbols = {
SYMBOL("cs0", 0x00),
SYMBOL("cs1", 0x08),
};
static const struct symbol_table ecn_type_tbl = {
+ .base = BASE_HEXADECIMAL,
.symbols = {
SYMBOL("not-ect", 0x00),
SYMBOL("ect1", 0x01),
#include <netinet/icmp6.h>
static const struct symbol_table icmp6_type_tbl = {
+ .base = BASE_DECIMAL,
.symbols = {
SYMBOL("destination-unreachable", ICMP6_DST_UNREACH),
SYMBOL("packet-too-big", ICMP6_PACKET_TOO_BIG),
#include <net/if_arp.h>
static const struct symbol_table arpop_tbl = {
+ .base = BASE_HEXADECIMAL,
.symbols = {
SYMBOL("request", __constant_htons(ARPOP_REQUEST)),
SYMBOL("reply", __constant_htons(ARPOP_REPLY)),
};
static const struct symbol_table ethertype_tbl = {
+ .base = BASE_HEXADECIMAL,
.symbols = {
SYMBOL("ip", __constant_htons(ETH_P_IP)),
SYMBOL("arp", __constant_htons(ETH_P_ARP)),