Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
bpftune: wrong format specifier leads to negative values for tunables
should be %ld, was using %d so we saw for example:

Jul 14 04:14:50 hostname bpftune[1237369]: Due to need to increase max buffer size to maximize throughput change net.ipv4.tcp_rmem(min default max) from (4096 87380 1734723440) -> (4096 87380 -2126562996)

Reported-by: https://github.com/gecon
Signed-off-by: Alan Maguire <[email protected]>
  • Loading branch information
alan-maguire committed Jul 14, 2023
commit 03f6dcbb4d4a4e11a4cbebe08ab66261c1f14025
2 changes: 1 addition & 1 deletion src/neigh_table_tuner.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ static int set_gc_thresh3(struct bpftuner *tuner, struct tbl_stats *stats)
stats->dev, strerror(-ret));
} else {
bpftuner_tunable_update(tuner, tunable, NEIGH_TABLE_FULL, 0,
"updated gc_thresh3 for %s table, dev '%s' (ifindex %d) from %d to %d\n",
"updated gc_thresh3 for %s table, dev '%s' (ifindex %d) from %ld to %ld\n",
tbl_name, stats->dev, stats->ifindex,
stats->max, new_gc_thresh3);
}
Expand Down
4 changes: 2 additions & 2 deletions src/net_buffer_tuner.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void event_handler(struct bpftuner *tuner,
bpftuner_tunable_sysctl_write(tuner, id, scenario,
event->netns_cookie, 1,
(long int *)event->update[0].new,
"Due to excessive drops, change %s from (%d) -> (%d)\n",
"Due to excessive drops, change %s from (%ld) -> (%ld)\n",
tunable,
event->update[0].old[0],
event->update[0].new[0]);
Expand All @@ -86,7 +86,7 @@ void event_handler(struct bpftuner *tuner,
bpftuner_tunable_sysctl_write(tuner, id, scenario,
event->netns_cookie, 1,
(long int *)event->update[0].new,
"To prioritize small flows, change %s from (%d) -> (%d)\n",
"To prioritize small flows, change %s from (%ld) -> (%ld)\n",
tunable,
event->update[0].old[0],
event->update[0].new[0]);
Expand Down
2 changes: 1 addition & 1 deletion src/route_table_tuner.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void event_handler(struct bpftuner *tuner,
bpftuner_tunable_sysctl_write(tuner, id, ROUTE_TABLE_FULL,
event->netns_cookie, 1,
event->update[0].new,
"Due to dst table filling up, change net.ipv6.route.max_size from %d -> %d\n",
"Due to dst table filling up, change net.ipv6.route.max_size from %ld -> %ld\n",
event->update[0].old[0],
event->update[0].new[0]);
break;
Expand Down
6 changes: 3 additions & 3 deletions src/tcp_buffer_tuner.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ void event_handler(struct bpftuner *tuner,

if (!bpf_map_lookup_elem(tuner->corr_map_fd, &key, &c)) {
corr = corr_compute(&c);
bpftune_log(LOG_INFO, "covar for '%s' netns %ld (new %ld %ld %ld): %LF ; corr %LF\n",
bpftune_log(LOG_DEBUG, "covar for '%s' netns %ld (new %ld %ld %ld): %LF ; corr %LF\n",
tunable, key.netns_cookie, new[0], new[1], new[2],
covar_compute(&c), corr);
if (corr > CORR_THRESHOLD && scenario == TCP_BUFFER_INCREASE)
Expand All @@ -229,7 +229,7 @@ void event_handler(struct bpftuner *tuner,
case TCP_BUFFER_TCP_MEM:
bpftuner_tunable_sysctl_write(tuner, id, scenario,
event->netns_cookie, 3, new,
"Due to %s change %s(min pressure max) from (%d %d %d) -> (%d %d %d)\n",
"Due to %s change %s(min pressure max) from (%ld %ld %ld) -> (%ld %ld %ld)\n",
lowmem, tunable, old[0], old[1], old[2],
new[0], new[1], new[2]);

Expand All @@ -250,7 +250,7 @@ void event_handler(struct bpftuner *tuner,
}
bpftuner_tunable_sysctl_write(tuner, id, scenario,
event->netns_cookie, 3, new,
"Due to %s change %s(min default max) from (%d %d %d) -> (%d %d %d)\n",
"Due to %s change %s(min default max) from (%ld %ld %ld) -> (%ld %ld %ld)\n",
reason, tunable,
old[0], old[1], old[2],
new[0], new[1], new[2]);
Expand Down