[Cake] [PATCH 1/2] cake: print_uint format fixes

Kevin Darbyshire-Bryant kevin at darbyshire-bryant.me.uk
Sun Mar 11 18:10:51 EDT 2018



> On 11 Mar 2018, at 20:49, Toke Høiland-Jørgensen <toke at toke.dk> wrote:
> 
> Thank you for the patch! :)
> 
>> Signed-off-by: Kevin Darbyshire-Bryant <ldir at darbyshire-bryant.me.uk>
>> ---
>> tc/q_cake.c | 15 ++++++++-------
>> 1 file changed, 8 insertions(+), 7 deletions(-)
>> 
>> diff --git a/tc/q_cake.c b/tc/q_cake.c
>> index 44cadb63..f888bd2a 100644
>> --- a/tc/q_cake.c
>> +++ b/tc/q_cake.c
>> @@ -47,6 +47,7 @@
>> #include <netinet/in.h>
>> #include <arpa/inet.h>
>> #include <string.h>
>> +#include <inttypes.h>
>> 
>> #include "utils.h"
>> #include "tc_util.h"
>> @@ -557,10 +558,10 @@ static int cake_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
>> 	else if (!raw)
>> 		print_string(PRINT_ANY, "atm", "%s ", "noatm");
>> 
>> -	print_uint(PRINT_ANY, "overhead", "overhead %d ", overhead);
>> +	print_uint(PRINT_ANY, "overhead", "overhead %" PRId64 " ",
>> overhead);
> 
> Guess this should actually be print_int(), since overhead can be
> negative?

Tried it, and you’d sort of guess wrong.  I’ll write it up tomorrow ‘properly’ but ‘int’ is int length whereas uint is uint64 length.  On big endian it goes wrong.

Anyway, glad you’ve tested on something little endian.  I’ll try to submit a patch upstream as requested…very busy over next 3 days doing $dayjob so may take a little while.  Thanks for boosting confidence that I’ve not broken it on architectures it used to work on :-)

> 
> -Toke


Cheers,

Kevin D-B

012C ACB2 28C6 C53E 9775  9123 B3A2 389B 9DE2 334A



More information about the Cake mailing list