aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorDamjan Marion <dmarion@me.com>2022-10-12 16:02:18 +0200
committerDamjan Marion <dmarion@me.com>2022-10-12 16:04:13 +0200
commitdd298e804a25dbebc9e284b3b2d0dfd9bf674ad8 (patch)
treecd91568dc9f1947c04d97eb95e15ae06d5d0ec06 /src/plugins
parent0f8f4351b03f9350a406ad1d63f97d1f4b59fec2 (diff)
misc: fix issues reported by clang-15
Type: improvement Change-Id: I3fbbda0378b72843ecd39a7e8592dedc9757793a Signed-off-by: Damjan Marion <dmarion@me.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/dhcp/dhcp6_proxy_node.c6
-rw-r--r--src/plugins/ikev2/ikev2.c9
-rw-r--r--src/plugins/ikev2/ikev2_priv.h2
-rw-r--r--src/plugins/ioam/analyse/ioam_summary_export.c3
-rw-r--r--src/plugins/ioam/lib-pot/math64.h31
-rw-r--r--src/plugins/ioam/udp-ping/udp_ping_export.c4
-rw-r--r--src/plugins/lb/api.c2
-rw-r--r--src/plugins/lisp/lisp-cp/control.h2
-rw-r--r--src/plugins/nat/det44/det44.h2
-rw-r--r--src/plugins/quic/quic.c2
-rw-r--r--src/plugins/srv6-ad/node.c2
-rw-r--r--src/plugins/srv6-am/node.c3
-rw-r--r--src/plugins/srv6-as/node.c3
13 files changed, 23 insertions, 48 deletions
diff --git a/src/plugins/dhcp/dhcp6_proxy_node.c b/src/plugins/dhcp/dhcp6_proxy_node.c
index 11207690969..ad0b70498a0 100644
--- a/src/plugins/dhcp/dhcp6_proxy_node.c
+++ b/src/plugins/dhcp/dhcp6_proxy_node.c
@@ -136,8 +136,8 @@ dhcpv6_proxy_to_server_input (vlib_main_t * vm,
dhcp_proxy_main_t *dpm = &dhcp_proxy_main;
from = vlib_frame_vector_args (from_frame);
n_left_from = from_frame->n_vectors;
- u32 pkts_to_server = 0, pkts_to_client = 0, pkts_no_server = 0;
- u32 pkts_no_interface_address = 0, pkts_no_exceeding_max_hop = 0;
+ u32 pkts_to_server = 0, pkts_to_client = 0;
+ u32 pkts_no_interface_address = 0;
u32 pkts_no_src_address = 0;
u32 pkts_wrong_msg_type = 0;
u32 pkts_too_big = 0;
@@ -236,7 +236,6 @@ dhcpv6_proxy_to_server_input (vlib_main_t * vm,
{
error0 = DHCPV6_PROXY_ERROR_NO_SERVER;
next0 = DHCPV6_PROXY_TO_SERVER_INPUT_NEXT_DROP;
- pkts_no_server++;
goto do_trace;
}
@@ -274,7 +273,6 @@ dhcpv6_proxy_to_server_input (vlib_main_t * vm,
{
error0 = DHCPV6_RELAY_PKT_DROP_MAX_HOPS;
next0 = DHCPV6_PROXY_TO_SERVER_INPUT_NEXT_DROP;
- pkts_no_exceeding_max_hop++;
goto do_trace;
}
diff --git a/src/plugins/ikev2/ikev2.c b/src/plugins/ikev2/ikev2.c
index 32331ffa6e4..f0eaa7a4355 100644
--- a/src/plugins/ikev2/ikev2.c
+++ b/src/plugins/ikev2/ikev2.c
@@ -4445,7 +4445,7 @@ ikev2_resolve_responder_hostname (vlib_main_t *vm, ikev2_responder_t *r)
u8 *name;
int rv;
- if (!km->dns_resolve_name)
+ if (!km->dns_resolve_name_ptr)
return clib_error_return (0, "cannot load symbols from dns plugin");
t0->request_type = DNS_API_PENDING_NAME_TO_IP;
@@ -4453,7 +4453,8 @@ ikev2_resolve_responder_hostname (vlib_main_t *vm, ikev2_responder_t *r)
* whereas DNS resolver expects a NULL-terminated C-string */
name = vec_dup (r->hostname);
vec_terminate_c_string (name);
- rv = km->dns_resolve_name (name, &ep, t0, rn);
+ rv = ((__typeof__ (dns_resolve_name) *) km->dns_resolve_name_ptr) (name, &ep,
+ t0, rn);
vec_free (name);
if (rv < 0)
return clib_error_return (0, "dns lookup failure");
@@ -5443,9 +5444,9 @@ ikev2_lazy_init (ikev2_main_t *km)
km->punt_hdl = vlib_punt_client_register ("ikev2");
- km->dns_resolve_name =
+ km->dns_resolve_name_ptr =
vlib_get_plugin_symbol ("dns_plugin.so", "dns_resolve_name");
- if (!km->dns_resolve_name)
+ if (!km->dns_resolve_name_ptr)
ikev2_log_error ("cannot load symbols from dns plugin");
/* wake up ikev2 process */
diff --git a/src/plugins/ikev2/ikev2_priv.h b/src/plugins/ikev2/ikev2_priv.h
index 4ce147890d5..faa0ca75d66 100644
--- a/src/plugins/ikev2/ikev2_priv.h
+++ b/src/plugins/ikev2/ikev2_priv.h
@@ -532,7 +532,7 @@ typedef struct
u8 dpd_disabled;
/* pointer to name resolver function in dns plugin */
- int (*dns_resolve_name) ();
+ void *dns_resolve_name_ptr;
/* flag indicating whether lazy init is done or not */
int lazy_init_done;
diff --git a/src/plugins/ioam/analyse/ioam_summary_export.c b/src/plugins/ioam/analyse/ioam_summary_export.c
index ceec1551bea..09884fdb019 100644
--- a/src/plugins/ioam/analyse/ioam_summary_export.c
+++ b/src/plugins/ioam/analyse/ioam_summary_export.c
@@ -275,7 +275,6 @@ ioam_send_flows (flow_report_main_t *frm, ipfix_exporter_t *exp,
ipfix_set_header_t *s = NULL;
ip4_header_t *ip;
udp_header_t *udp;
- u32 records_this_buffer;
u16 new_l0, old_l0;
ip_csum_t sum0;
vlib_main_t *vm = vlib_get_main ();
@@ -329,13 +328,11 @@ ioam_send_flows (flow_report_main_t *frm, ipfix_exporter_t *exp,
h->sequence_number = stream->sequence_number++;
h->sequence_number = clib_host_to_net_u32 (h->sequence_number);
next_offset = (u32) (((u8 *) (s + 1)) - (u8 *) tp);
- records_this_buffer = 0;
}
next_offset = ioam_analyse_add_ipfix_record (fr, record,
b0, next_offset,
&temp, &temp, 0, 0);
- records_this_buffer++;
/* Flush data if packet len is about to reach path mtu */
if (next_offset > (exp->path_mtu - 250))
diff --git a/src/plugins/ioam/lib-pot/math64.h b/src/plugins/ioam/lib-pot/math64.h
index 4c608a37de4..2084c25fa58 100644
--- a/src/plugins/ioam/lib-pot/math64.h
+++ b/src/plugins/ioam/lib-pot/math64.h
@@ -51,23 +51,23 @@ static inline void mul64by64(u64 a, u64 b, u64 * hi, u64 * lo)
static inline u64 mod128by64(u64 x, u64 y, u64 m, double di)
{
- u64 q1, q2, q;
- u64 p1, p0;
- double dq;
+ u64 q1, q2;
+ u64 p1, p0;
+ double dq;
- /* calculate quotient first pass 53 bits */
- dq = (TWO64 * (double)x + (double)y) * di;
+ /* calculate quotient first pass 53 bits */
+ dq = (TWO64 * (double) x + (double) y) * di;
- if (dq >= TWO64)
- q1 = 0xfffffffffffff800L;
- else
- q1 = dq;
+ if (dq >= TWO64)
+ q1 = 0xfffffffffffff800L;
+ else
+ q1 = dq;
- /* q1 * m to compare the product to the dividend. */
- mul64by64(q1, m, &p1, &p0);
+ /* q1 * m to compare the product to the dividend. */
+ mul64by64 (q1, m, &p1, &p0);
- /* Adjust quotient. is it > actual result: */
- if (x < p1 || (x == p1 && y < p0))
+ /* Adjust quotient. is it > actual result: */
+ if (x < p1 || (x == p1 && y < p0))
{
/* q1 > quotient. calculate abs remainder */
x = p1 - (x + (p0 < y));
@@ -77,7 +77,6 @@ static inline u64 mod128by64(u64 x, u64 y, u64 m, double di)
q2 = (u64) ((TWO64 * (double)x + (double)y) * di);
mul64by64(q2, m, &p1, &p0);
- q = q1 - q2;
if (x < p1 || (x == p1 && y <= p0))
{
y = p0 - y;
@@ -86,7 +85,6 @@ static inline u64 mod128by64(u64 x, u64 y, u64 m, double di)
{
y = p0 - y;
y += m;
- q--;
}
}
else
@@ -97,12 +95,10 @@ static inline u64 mod128by64(u64 x, u64 y, u64 m, double di)
q2 = (u64) ((TWO64 * (double)x + (double)y) * di);
mul64by64(q2, m, &p1, &p0);
- q = q1 + q2;
if (x < p1 || (x == p1 && y < p0))
{
y = y - p0;
y += m;
- q--;
}
else
{
@@ -110,7 +106,6 @@ static inline u64 mod128by64(u64 x, u64 y, u64 m, double di)
if (y >= m)
{
y -= m;
- q++;
}
}
}
diff --git a/src/plugins/ioam/udp-ping/udp_ping_export.c b/src/plugins/ioam/udp-ping/udp_ping_export.c
index 3dc1436a1a9..de0bad7a855 100644
--- a/src/plugins/ioam/udp-ping/udp_ping_export.c
+++ b/src/plugins/ioam/udp-ping/udp_ping_export.c
@@ -45,7 +45,6 @@ udp_ping_send_flows (flow_report_main_t *frm, ipfix_exporter_t *exp,
ipfix_set_header_t *s = NULL;
ip4_header_t *ip;
udp_header_t *udp;
- u32 records_this_buffer;
u16 new_l0, old_l0;
ip_csum_t sum0;
vlib_main_t *vm = vlib_get_main ();
@@ -99,7 +98,6 @@ udp_ping_send_flows (flow_report_main_t *frm, ipfix_exporter_t *exp,
h->sequence_number =
clib_host_to_net_u32 (h->sequence_number);
next_offset = (u32) (((u8 *) (s + 1)) - (u8 *) tp);
- records_this_buffer = 0;
}
next_offset = ioam_analyse_add_ipfix_record (fr,
@@ -115,8 +113,6 @@ udp_ping_send_flows (flow_report_main_t *frm, ipfix_exporter_t *exp,
//memcpy (b0->data + next_offset, &pak_sent, sizeof(u32));
//next_offset += sizeof(u32);
- records_this_buffer++;
-
/* Flush data if packet len is about to reach path mtu */
if (next_offset > (exp->path_mtu - UDP_PING_EXPORT_RECORD_SIZE))
{
diff --git a/src/plugins/lb/api.c b/src/plugins/lb/api.c
index 3aa745c5559..bf4a50ddb04 100644
--- a/src/plugins/lb/api.c
+++ b/src/plugins/lb/api.c
@@ -209,7 +209,6 @@ static void send_lb_as_details
lb_main_t *lbm = &lb_main;
int msg_size = 0;
u32 *as_index;
- u32 asindex = 0;
/* construct as list under this vip */
lb_as_t *as;
@@ -233,7 +232,6 @@ static void send_lb_as_details
rmp->in_use_since = htonl(as->last_used);
vl_api_send_msg (reg, (u8 *) rmp);
- asindex++;
}
}
diff --git a/src/plugins/lisp/lisp-cp/control.h b/src/plugins/lisp/lisp-cp/control.h
index 524f5028465..e65ceafd431 100644
--- a/src/plugins/lisp/lisp-cp/control.h
+++ b/src/plugins/lisp/lisp-cp/control.h
@@ -299,7 +299,7 @@ extern vlib_node_registration_t lisp_cp_input_node;
extern vlib_node_registration_t lisp_cp_lookup_ip4_node;
extern vlib_node_registration_t lisp_cp_lookup_ip6_node;
-clib_error_t *lisp_cp_init ();
+clib_error_t *lisp_cp_init (vlib_main_t *);
always_inline lisp_cp_main_t *
vnet_lisp_cp_get_main ()
diff --git a/src/plugins/nat/det44/det44.h b/src/plugins/nat/det44/det44.h
index 20dc8b1aec9..7d290f4a956 100644
--- a/src/plugins/nat/det44/det44.h
+++ b/src/plugins/nat/det44/det44.h
@@ -229,7 +229,7 @@ plugin_enabled ()
extern vlib_node_registration_t det44_in2out_node;
extern vlib_node_registration_t det44_out2in_node;
-int det44_plugin_enable ();
+int det44_plugin_enable (det44_config_t);
int det44_plugin_disable ();
int det44_interface_add_del (u32 sw_if_index, u8 is_inside, int is_del);
diff --git a/src/plugins/quic/quic.c b/src/plugins/quic/quic.c
index 39651244057..5106031c681 100644
--- a/src/plugins/quic/quic.c
+++ b/src/plugins/quic/quic.c
@@ -2674,7 +2674,6 @@ quic_get_counter_value (u32 event_code)
u32 code, i;
u64 c, sum = 0;
- int index = 0;
vm = vlib_get_main ();
em = &vm->error_main;
@@ -2689,7 +2688,6 @@ quic_get_counter_value (u32 event_code)
if (i < vec_len (em->counters_last_clear))
c -= em->counters_last_clear[i];
sum += c;
- index++;
}
return sum;
}
diff --git a/src/plugins/srv6-ad/node.c b/src/plugins/srv6-ad/node.c
index 9d4ea44e19b..f04d4ac2114 100644
--- a/src/plugins/srv6-ad/node.c
+++ b/src/plugins/srv6-ad/node.c
@@ -203,7 +203,6 @@ srv6_ad_localsid_fn (vlib_main_t * vm,
{
ip6_sr_main_t *sm = &sr_main;
u32 n_left_from, next_index, *from, *to_next;
- u32 cnt_packets = 0;
from = vlib_frame_vector_args (frame);
n_left_from = frame->n_vectors;
@@ -264,7 +263,6 @@ srv6_ad_localsid_fn (vlib_main_t * vm,
vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next,
n_left_to_next, bi0, next0);
- cnt_packets++;
}
vlib_put_next_frame (vm, node, next_index, n_left_to_next);
diff --git a/src/plugins/srv6-am/node.c b/src/plugins/srv6-am/node.c
index dd71e60d5a2..dd2b1c4d542 100644
--- a/src/plugins/srv6-am/node.c
+++ b/src/plugins/srv6-am/node.c
@@ -142,7 +142,6 @@ srv6_am_localsid_fn (vlib_main_t * vm,
{
ip6_sr_main_t *sm = &sr_main;
u32 n_left_from, next_index, *from, *to_next;
- u32 cnt_packets = 0;
from = vlib_frame_vector_args (frame);
n_left_from = frame->n_vectors;
@@ -203,8 +202,6 @@ srv6_am_localsid_fn (vlib_main_t * vm,
vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next,
n_left_to_next, bi0, next0);
-
- cnt_packets++;
}
vlib_put_next_frame (vm, node, next_index, n_left_to_next);
diff --git a/src/plugins/srv6-as/node.c b/src/plugins/srv6-as/node.c
index 9e84a9848e5..4beb8dfd7ac 100644
--- a/src/plugins/srv6-as/node.c
+++ b/src/plugins/srv6-as/node.c
@@ -169,7 +169,6 @@ srv6_as_localsid_fn (vlib_main_t * vm,
{
ip6_sr_main_t *sm = &sr_main;
u32 n_left_from, next_index, *from, *to_next;
- u32 cnt_packets = 0;
from = vlib_frame_vector_args (frame);
n_left_from = frame->n_vectors;
@@ -227,8 +226,6 @@ srv6_as_localsid_fn (vlib_main_t * vm,
vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next,
n_left_to_next, bi0, next0);
-
- cnt_packets++;
}
vlib_put_next_frame (vm, node, next_index, n_left_to_next);