diff options
author | Yuyang Huang <yuyanghuang@google.com> | 2024-02-26 15:37:32 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2024-02-26 15:37:32 +0000 |
commit | 3ccc810990ffa1d026eb5e8dbc4b2a2b7af3f0a8 (patch) | |
tree | 210e123d7b8d8fd272148da690582cd759c0f258 | |
parent | 685f93590096cc00444cba94d79c29d6ce6a4105 (diff) | |
parent | 083bb819cc66dba3ba361bd75f1535a690e0b1ac (diff) | |
download | apf-3ccc810990ffa1d026eb5e8dbc4b2a2b7af3f0a8.tar.gz |
v5: add missing function prototypes to address build errors. am: 083bb819cc
Original change: https://android-review.googlesource.com/c/platform/hardware/google/apf/+/2977191
Change-Id: I123673b92008120fdb2860d6cc71fb9cb030acc6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | apf_checksum.h | 6 | ||||
-rw-r--r-- | apf_defs.h | 2 | ||||
-rw-r--r-- | apf_dns.h | 8 | ||||
-rw-r--r-- | v5/Android.bp | 1 | ||||
-rw-r--r-- | v5/apf_interpreter.c | 20 | ||||
-rw-r--r-- | v5/apf_interpreter_source.c | 4 |
6 files changed, 23 insertions, 18 deletions
diff --git a/apf_checksum.h b/apf_checksum.h index 2c5468e..aa143a0 100644 --- a/apf_checksum.h +++ b/apf_checksum.h @@ -2,7 +2,7 @@ * Calculate big endian 16-bit sum of a buffer (max 128kB), * then fold and negate it, producing a 16-bit result in [0..FFFE]. */ -u16 calc_csum(u32 sum, const u8* const buf, const s32 len) { +FUNC(u16 calc_csum(u32 sum, const u8* const buf, const s32 len)) { s32 i; for (i = 0; i < len; ++i) sum += buf[i] * ((i & 1) ? 1 : 256); @@ -44,8 +44,8 @@ static u16 fix_udp_csum(u16 csum) { * * @return 6-bit DSCP value [0..63], garbage on parse error. */ -int csum_and_return_dscp(u8* const pkt, const s32 len, const u8 ip_ofs, - const u16 partial_csum, const u8 csum_start, const u8 csum_ofs, const bool udp) { +FUNC(int csum_and_return_dscp(u8* const pkt, const s32 len, const u8 ip_ofs, + const u16 partial_csum, const u8 csum_start, const u8 csum_ofs, const bool udp)) { if (csum_ofs < 255) { // note that calc_csum() treats negative lengths as zero u32 csum = calc_csum(partial_csum, pkt + csum_start, len - csum_start); @@ -37,3 +37,5 @@ typedef enum { #define IPV6_HLEN 40 #define TCP_HLEN 20 #define UDP_HLEN 8 + +#define FUNC(x) x; x @@ -12,11 +12,11 @@ * * @return 1 if matched, 0 if not matched, -1 if error in packet, -2 if error in program. */ -match_result_type match_single_name(const u8* needle, +FUNC(match_result_type match_single_name(const u8* needle, const u8* const needle_bound, const u8* const udp, const u32 udp_len, - u32* const ofs) { + u32* const ofs)) { u32 first_unread_offset = *ofs; bool is_qname_match = true; int lvl; @@ -75,11 +75,11 @@ match_result_type match_single_name(const u8* needle, * * @return 1 if matched, 0 if not matched, -1 if error in packet, -2 if error in program. */ -match_result_type match_names(const u8* needles, +FUNC(match_result_type match_names(const u8* needles, const u8* const needle_bound, const u8* const udp, const u32 udp_len, - const int question_type) { + const int question_type)) { if (udp_len < 12) return error_packet; /* lack of dns header */ /* dns header: be16 tid, flags, num_{questions,answers,authority,additional} */ diff --git a/v5/Android.bp b/v5/Android.bp index 8a4084a..19faf78 100644 --- a/v5/Android.bp +++ b/v5/Android.bp @@ -25,6 +25,7 @@ cc_defaults { "-Wall", "-Werror", "-Werror=implicit-fallthrough", + "-Werror=missing-prototypes", "-Werror=strict-prototypes", "-Wnullable-to-nonnull-conversion", "-Wsign-compare", diff --git a/v5/apf_interpreter.c b/v5/apf_interpreter.c index b8ce799..d86647a 100644 --- a/v5/apf_interpreter.c +++ b/v5/apf_interpreter.c @@ -72,6 +72,8 @@ typedef enum { #define IPV6_HLEN 40 #define TCP_HLEN 20 #define UDP_HLEN 8 + +#define FUNC(x) x; x /* End include of apf_defs.h */ /* Begin include of apf.h */ /* @@ -393,11 +395,11 @@ static u8 uppercase(u8 c) { * * @return 1 if matched, 0 if not matched, -1 if error in packet, -2 if error in program. */ -match_result_type match_single_name(const u8* needle, +FUNC(match_result_type match_single_name(const u8* needle, const u8* const needle_bound, const u8* const udp, const u32 udp_len, - u32* const ofs) { + u32* const ofs)) { u32 first_unread_offset = *ofs; bool is_qname_match = true; int lvl; @@ -456,11 +458,11 @@ match_result_type match_single_name(const u8* needle, * * @return 1 if matched, 0 if not matched, -1 if error in packet, -2 if error in program. */ -match_result_type match_names(const u8* needles, +FUNC(match_result_type match_names(const u8* needles, const u8* const needle_bound, const u8* const udp, const u32 udp_len, - const int question_type) { + const int question_type)) { if (udp_len < 12) return error_packet; /* lack of dns header */ /* dns header: be16 tid, flags, num_{questions,answers,authority,additional} */ @@ -510,7 +512,7 @@ match_result_type match_names(const u8* needles, * Calculate big endian 16-bit sum of a buffer (max 128kB), * then fold and negate it, producing a 16-bit result in [0..FFFE]. */ -u16 calc_csum(u32 sum, const u8* const buf, const s32 len) { +FUNC(u16 calc_csum(u32 sum, const u8* const buf, const s32 len)) { s32 i; for (i = 0; i < len; ++i) sum += buf[i] * ((i & 1) ? 1 : 256); @@ -552,8 +554,8 @@ static u16 fix_udp_csum(u16 csum) { * * @return 6-bit DSCP value [0..63], garbage on parse error. */ -int csum_and_return_dscp(u8* const pkt, const s32 len, const u8 ip_ofs, - const u16 partial_csum, const u8 csum_start, const u8 csum_ofs, const bool udp) { +FUNC(int csum_and_return_dscp(u8* const pkt, const s32 len, const u8 ip_ofs, + const u16 partial_csum, const u8 csum_start, const u8 csum_ofs, const bool udp)) { if (csum_ofs < 255) { /* note that calc_csum() treats negative lengths as zero */ u32 csum = calc_csum(partial_csum, pkt + csum_start, len - csum_start); @@ -596,7 +598,7 @@ extern void APF_TRACE_HOOK(u32 pc, const u32* regs, const u8* program, #define ENFORCE_UNSIGNED(c) ((c)==(u32)(c)) u32 apf_version(void) { - return 20240214; + return 20240226; } typedef struct { @@ -615,7 +617,7 @@ typedef struct { memory_type mem; /* Memory slot values. */ } apf_context; -int do_transmit_buffer(apf_context* ctx, u32 pkt_len, u8 dscp) { +FUNC(int do_transmit_buffer(apf_context* ctx, u32 pkt_len, u8 dscp)) { int ret = apf_transmit_buffer(ctx->caller_ctx, ctx->tx_buf, pkt_len, dscp); ctx->tx_buf = NULL; ctx->tx_buf_len = 0; diff --git a/v5/apf_interpreter_source.c b/v5/apf_interpreter_source.c index 66b0559..24dbbca 100644 --- a/v5/apf_interpreter_source.c +++ b/v5/apf_interpreter_source.c @@ -61,7 +61,7 @@ extern void APF_TRACE_HOOK(u32 pc, const u32* regs, const u8* program, #define ENFORCE_UNSIGNED(c) ((c)==(u32)(c)) u32 apf_version(void) { - return 20240214; + return 20240226; } typedef struct { @@ -80,7 +80,7 @@ typedef struct { memory_type mem; // Memory slot values. } apf_context; -int do_transmit_buffer(apf_context* ctx, u32 pkt_len, u8 dscp) { +FUNC(int do_transmit_buffer(apf_context* ctx, u32 pkt_len, u8 dscp)) { int ret = apf_transmit_buffer(ctx->caller_ctx, ctx->tx_buf, pkt_len, dscp); ctx->tx_buf = NULL; ctx->tx_buf_len = 0; |