summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--flowtop.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/flowtop.c b/flowtop.c
index 9cc7302..d988590 100644
--- a/flowtop.c
+++ b/flowtop.c
@@ -205,8 +205,6 @@ static void signal_handler(int number)
static void flow_entry_from_ct(struct flow_entry *n, struct nf_conntrack *ct);
static void flow_entry_get_extended(struct flow_entry *n);
-static bool nfct_is_dns(struct nf_conntrack *ct);
-
static void help(void)
{
printf("flowtop %s, top-like netfilter TCP/UDP/SCTP/.. flow tracking\n",
@@ -264,6 +262,14 @@ static inline void flow_list_init(struct flow_list *fl)
spinlock_init(&fl->lock);
}
+static inline bool nfct_is_dns(struct nf_conntrack *ct)
+{
+ uint16_t port_src = nfct_get_attr_u16(ct, ATTR_ORIG_PORT_SRC);
+ uint16_t port_dst = nfct_get_attr_u16(ct, ATTR_ORIG_PORT_DST);
+
+ return ntohs(port_src) == 53 || ntohs(port_dst) == 53;
+}
+
static void flow_list_new_entry(struct flow_list *fl, struct nf_conntrack *ct)
{
struct flow_entry *n;
@@ -532,17 +538,6 @@ enum flow_entry_direction {
flow_entry_dst,
};
-static bool nfct_is_dns(struct nf_conntrack *ct)
-{
- struct flow_entry fl;
- struct flow_entry *n = &fl;
-
- CP_NFCT(port_src, ATTR_ORIG_PORT_SRC, 16);
- CP_NFCT(port_dst, ATTR_ORIG_PORT_DST, 16);
-
- return ntohs(n->port_src) == 53 || ntohs(n->port_dst) == 53;
-}
-
#define SELFLD(dir,src_member,dst_member) \
(((dir) == flow_entry_src) ? n->src_member : n->dst_member)