summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/conntrack/build.c92
-rw-r--r--src/conntrack/objopt.c4
-rw-r--r--src/conntrack/snprintf_default.c58
-rw-r--r--src/expect/api.c28
4 files changed, 92 insertions, 90 deletions
diff --git a/src/conntrack/build.c b/src/conntrack/build.c
index 623774f..91eca7d 100644
--- a/src/conntrack/build.c
+++ b/src/conntrack/build.c
@@ -7,9 +7,9 @@
#include "internal/internal.h"
-void __build_tuple_ip(struct nfnlhdr *req,
- size_t size,
- const struct __nfct_tuple *t)
+static void __build_tuple_ip(struct nfnlhdr *req,
+ size_t size,
+ const struct __nfct_tuple *t)
{
struct nfattr *nest;
@@ -35,9 +35,9 @@ void __build_tuple_ip(struct nfnlhdr *req,
nfnl_nest_end(&req->nlh, nest);
}
-void __build_tuple_proto(struct nfnlhdr *req,
- size_t size,
- const struct __nfct_tuple *t)
+static void __build_tuple_proto(struct nfnlhdr *req,
+ size_t size,
+ const struct __nfct_tuple *t)
{
struct nfattr *nest;
@@ -214,10 +214,10 @@ __build_nat_seq_adj(struct nfnlhdr *req,
nfnl_nest_end(&req->nlh, nest);
}
-void __build_protonat(struct nfnlhdr *req,
- size_t size,
- const struct nf_conntrack *ct,
- const struct __nfct_nat *nat)
+static void __build_protonat(struct nfnlhdr *req,
+ size_t size,
+ const struct nf_conntrack *ct,
+ const struct __nfct_nat *nat)
{
struct nfattr *nest;
@@ -235,17 +235,17 @@ void __build_protonat(struct nfnlhdr *req,
nfnl_nest_end(&req->nlh, nest);
}
-void __build_nat(struct nfnlhdr *req,
- size_t size,
- const struct __nfct_nat *nat)
+static void __build_nat(struct nfnlhdr *req,
+ size_t size,
+ const struct __nfct_nat *nat)
{
nfnl_addattr_l(&req->nlh, size, CTA_NAT_MINIP,
&nat->min_ip, sizeof(u_int32_t));
}
-void __build_snat(struct nfnlhdr *req,
- size_t size,
- const struct nf_conntrack *ct)
+static void __build_snat(struct nfnlhdr *req,
+ size_t size,
+ const struct nf_conntrack *ct)
{
struct nfattr *nest;
@@ -255,9 +255,9 @@ void __build_snat(struct nfnlhdr *req,
nfnl_nest_end(&req->nlh, nest);
}
-void __build_snat_ipv4(struct nfnlhdr *req,
- size_t size,
- const struct nf_conntrack *ct)
+static void __build_snat_ipv4(struct nfnlhdr *req,
+ size_t size,
+ const struct nf_conntrack *ct)
{
struct nfattr *nest;
@@ -266,9 +266,9 @@ void __build_snat_ipv4(struct nfnlhdr *req,
nfnl_nest_end(&req->nlh, nest);
}
-void __build_snat_port(struct nfnlhdr *req,
- size_t size,
- const struct nf_conntrack *ct)
+static void __build_snat_port(struct nfnlhdr *req,
+ size_t size,
+ const struct nf_conntrack *ct)
{
struct nfattr *nest;
@@ -277,9 +277,9 @@ void __build_snat_port(struct nfnlhdr *req,
nfnl_nest_end(&req->nlh, nest);
}
-void __build_dnat(struct nfnlhdr *req,
- size_t size,
- const struct nf_conntrack *ct)
+static void __build_dnat(struct nfnlhdr *req,
+ size_t size,
+ const struct nf_conntrack *ct)
{
struct nfattr *nest;
@@ -289,9 +289,9 @@ void __build_dnat(struct nfnlhdr *req,
nfnl_nest_end(&req->nlh, nest);
}
-void __build_dnat_ipv4(struct nfnlhdr *req,
- size_t size,
- const struct nf_conntrack *ct)
+static void __build_dnat_ipv4(struct nfnlhdr *req,
+ size_t size,
+ const struct nf_conntrack *ct)
{
struct nfattr *nest;
@@ -300,9 +300,9 @@ void __build_dnat_ipv4(struct nfnlhdr *req,
nfnl_nest_end(&req->nlh, nest);
}
-void __build_dnat_port(struct nfnlhdr *req,
- size_t size,
- const struct nf_conntrack *ct)
+static void __build_dnat_port(struct nfnlhdr *req,
+ size_t size,
+ const struct nf_conntrack *ct)
{
struct nfattr *nest;
@@ -311,38 +311,38 @@ void __build_dnat_port(struct nfnlhdr *req,
nfnl_nest_end(&req->nlh, nest);
}
-void __build_status(struct nfnlhdr *req,
- size_t size,
- const struct nf_conntrack *ct)
+static void __build_status(struct nfnlhdr *req,
+ size_t size,
+ const struct nf_conntrack *ct)
{
nfnl_addattr32(&req->nlh, size, CTA_STATUS,
htonl(ct->status | IPS_CONFIRMED));
}
-void __build_timeout(struct nfnlhdr *req,
- size_t size,
- const struct nf_conntrack *ct)
+static void __build_timeout(struct nfnlhdr *req,
+ size_t size,
+ const struct nf_conntrack *ct)
{
nfnl_addattr32(&req->nlh, size, CTA_TIMEOUT, htonl(ct->timeout));
}
-void __build_mark(struct nfnlhdr *req,
- size_t size,
- const struct nf_conntrack *ct)
+static void __build_mark(struct nfnlhdr *req,
+ size_t size,
+ const struct nf_conntrack *ct)
{
nfnl_addattr32(&req->nlh, size, CTA_MARK, htonl(ct->mark));
}
-void __build_secmark(struct nfnlhdr *req,
- size_t size,
- const struct nf_conntrack *ct)
+static void __build_secmark(struct nfnlhdr *req,
+ size_t size,
+ const struct nf_conntrack *ct)
{
nfnl_addattr32(&req->nlh, size, CTA_SECMARK, htonl(ct->secmark));
}
-void __build_helper_name(struct nfnlhdr *req,
- size_t size,
- const struct nf_conntrack *ct)
+static void __build_helper_name(struct nfnlhdr *req,
+ size_t size,
+ const struct nf_conntrack *ct)
{
struct nfattr *nest;
diff --git a/src/conntrack/objopt.c b/src/conntrack/objopt.c
index d678f2d..4b36817 100644
--- a/src/conntrack/objopt.c
+++ b/src/conntrack/objopt.c
@@ -72,7 +72,7 @@ static void setobjopt_setup_repl(struct nf_conntrack *ct)
__autocomplete(ct, __DIR_REPL);
}
-setobjopt setobjopt_array[__NFCT_SOPT_MAX] = {
+static const setobjopt setobjopt_array[__NFCT_SOPT_MAX] = {
[NFCT_SOPT_UNDO_SNAT] = setobjopt_undo_snat,
[NFCT_SOPT_UNDO_DNAT] = setobjopt_undo_dnat,
[NFCT_SOPT_UNDO_SPAT] = setobjopt_undo_spat,
@@ -122,7 +122,7 @@ static int getobjopt_is_dpat(const struct nf_conntrack *ct)
ct->tuple[__DIR_ORIG].l4dst.tcp.port);
}
-getobjopt getobjopt_array[__NFCT_GOPT_MAX] = {
+static const getobjopt getobjopt_array[__NFCT_GOPT_MAX] = {
[NFCT_GOPT_IS_SNAT] = getobjopt_is_snat,
[NFCT_GOPT_IS_DNAT] = getobjopt_is_dnat,
[NFCT_GOPT_IS_SPAT] = getobjopt_is_spat,
diff --git a/src/conntrack/snprintf_default.c b/src/conntrack/snprintf_default.c
index 6749738..c89cce5 100644
--- a/src/conntrack/snprintf_default.c
+++ b/src/conntrack/snprintf_default.c
@@ -27,34 +27,36 @@ int __snprintf_protocol(char *buf,
ct->tuple[__DIR_ORIG].protonum));
}
-int __snprintf_timeout(char *buf,
- unsigned int len,
- const struct nf_conntrack *ct)
+static int __snprintf_timeout(char *buf,
+ unsigned int len,
+ const struct nf_conntrack *ct)
{
return snprintf(buf, len, "%u ", ct->timeout);
}
-int __snprintf_protoinfo(char *buf,
- unsigned int len,
- const struct nf_conntrack *ct)
+static int __snprintf_protoinfo(char *buf,
+ unsigned int len,
+ const struct nf_conntrack *ct)
{
return snprintf(buf, len, "%s ",
ct->protoinfo.tcp.state < TCP_CONNTRACK_MAX ?
states[ct->protoinfo.tcp.state] :
states[TCP_CONNTRACK_NONE]);
}
-int __snprintf_protoinfo_sctp(char *buf,
- unsigned int len,
- const struct nf_conntrack *ct)
+
+static int __snprintf_protoinfo_sctp(char *buf,
+ unsigned int len,
+ const struct nf_conntrack *ct)
{
return snprintf(buf, len, "%s ",
ct->protoinfo.sctp.state < SCTP_CONNTRACK_MAX ?
sctp_states[ct->protoinfo.sctp.state] :
sctp_states[SCTP_CONNTRACK_NONE]);
}
-int __snprintf_protoinfo_dccp(char *buf,
- unsigned int len,
- const struct nf_conntrack *ct)
+
+static int __snprintf_protoinfo_dccp(char *buf,
+ unsigned int len,
+ const struct nf_conntrack *ct)
{
return snprintf(buf, len, "%s ",
ct->protoinfo.dccp.state < DCCP_CONNTRACK_MAX ?
@@ -62,9 +64,9 @@ int __snprintf_protoinfo_dccp(char *buf,
sctp_states[DCCP_CONNTRACK_NONE]);
}
-int __snprintf_address_ipv4(char *buf,
- unsigned int len,
- const struct __nfct_tuple *tuple)
+static int __snprintf_address_ipv4(char *buf,
+ unsigned int len,
+ const struct __nfct_tuple *tuple)
{
int ret, size = 0, offset = 0;
struct in_addr src = { .s_addr = tuple->src.v4 };
@@ -79,9 +81,9 @@ int __snprintf_address_ipv4(char *buf,
return size;
}
-int __snprintf_address_ipv6(char *buf,
- unsigned int len,
- const struct __nfct_tuple *tuple)
+static int __snprintf_address_ipv6(char *buf,
+ unsigned int len,
+ const struct __nfct_tuple *tuple)
{
int ret, size = 0, offset = 0;
struct in6_addr src;
@@ -159,9 +161,9 @@ int __snprintf_proto(char *buf,
return size;
}
-int __snprintf_status_assured(char *buf,
- unsigned int len,
- const struct nf_conntrack *ct)
+static int __snprintf_status_assured(char *buf,
+ unsigned int len,
+ const struct nf_conntrack *ct)
{
int size = 0;
@@ -171,9 +173,9 @@ int __snprintf_status_assured(char *buf,
return size;
}
-int __snprintf_status_not_seen_reply(char *buf,
- unsigned int len,
- const struct nf_conntrack *ct)
+static int __snprintf_status_not_seen_reply(char *buf,
+ unsigned int len,
+ const struct nf_conntrack *ct)
{
int size = 0;
@@ -183,10 +185,10 @@ int __snprintf_status_not_seen_reply(char *buf,
return size;
}
-int __snprintf_counters(char *buf,
- unsigned int len,
- const struct nf_conntrack *ct,
- int dir)
+static int __snprintf_counters(char *buf,
+ unsigned int len,
+ const struct nf_conntrack *ct,
+ int dir)
{
return (snprintf(buf, len, "packets=%llu bytes=%llu ",
(unsigned long long) ct->counters[dir].packets,
diff --git a/src/expect/api.c b/src/expect/api.c
index 49f6ef1..7a11f53 100644
--- a/src/expect/api.c
+++ b/src/expect/api.c
@@ -433,12 +433,12 @@ int nfexp_attr_unset(struct nf_expect *exp,
* On error, -1 is returned and errno is appropiately set.
* On success, 0 is returned.
*/
-int nfexp_build_expect(struct nfnl_subsys_handle *ssh,
- void *req,
- size_t size,
- u_int16_t type,
- u_int16_t flags,
- const struct nf_expect *exp)
+static int nfexp_build_expect(struct nfnl_subsys_handle *ssh,
+ void *req,
+ size_t size,
+ u_int16_t type,
+ u_int16_t flags,
+ const struct nf_expect *exp)
{
assert(ssh != NULL);
assert(req != NULL);
@@ -477,11 +477,11 @@ int nfexp_build_expect(struct nfnl_subsys_handle *ssh,
* On success, 0 is returned. On error, -1 is returned and errno is set
* appropiately.
*/
-int nfexp_build_query(struct nfnl_subsys_handle *ssh,
- const enum nf_conntrack_query qt,
- const void *data,
- void *buffer,
- unsigned int size)
+static int nfexp_build_query(struct nfnl_subsys_handle *ssh,
+ const enum nf_conntrack_query qt,
+ const void *data,
+ void *buffer,
+ unsigned int size)
{
struct nfnlhdr *req = buffer;
const u_int8_t *family = data;
@@ -539,9 +539,9 @@ int nfexp_build_query(struct nfnl_subsys_handle *ssh,
* the message received is not of the requested type then 0 is returned,
* otherwise this function returns the message type parsed.
*/
-int nfexp_parse_expect(enum nf_conntrack_msg_type type,
- const struct nlmsghdr *nlh,
- struct nf_expect *exp)
+static int nfexp_parse_expect(enum nf_conntrack_msg_type type,
+ const struct nlmsghdr *nlh,
+ struct nf_expect *exp)
{
unsigned int flags;
int len = nlh->nlmsg_len;