Cake - FQ_codel the next generation
 help / color / mirror / Atom feed
* [Cake] Fixing iproute2 compile
@ 2015-10-19 16:01 Toke Høiland-Jørgensen
  2015-10-19 16:31 ` Kevin Darbyshire-Bryant
  2015-10-19 16:41 ` Kevin Darbyshire-Bryant
  0 siblings, 2 replies; 9+ messages in thread
From: Toke Høiland-Jørgensen @ 2015-10-19 16:01 UTC (permalink / raw)
  To: cake

So finally got iproute2 to compile out of the kau.toke.dk repo. The
patch below was needed to cake. Posting it here rather than just
committing in the hope of getting someone (Jonathan?) to take a look at
it and fix it everywhere it's needed :)

-Toke

diff --git a/tc/q_cake.c b/tc/q_cake.c
index 4d64405..1384a46 100644
--- a/tc/q_cake.c
+++ b/tc/q_cake.c
@@ -495,7 +496,7 @@ static int cake_print_xstats(struct qdisc_util *qu, FILE *f,
 
 	} else if (stnc->version >= 1 && stnc->version < 0xFF
 				&& stnc->max_tins == TC_CAKE_MAX_TINS
-				&& RTA_PAYLOAD(xstats) >= offsetof(*stnc, capacity_estimate))
+				&& RTA_PAYLOAD(xstats) >= offsetof(typeof(*stnc), capacity_estimate))
 	{
 		int i;
 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Cake] Fixing iproute2 compile
  2015-10-19 16:01 [Cake] Fixing iproute2 compile Toke Høiland-Jørgensen
@ 2015-10-19 16:31 ` Kevin Darbyshire-Bryant
  2015-10-20 15:33   ` Toke Høiland-Jørgensen
  2015-10-19 16:41 ` Kevin Darbyshire-Bryant
  1 sibling, 1 reply; 9+ messages in thread
From: Kevin Darbyshire-Bryant @ 2015-10-19 16:31 UTC (permalink / raw)
  To: Toke Høiland-Jørgensen; +Cc: cake


[-- Attachment #1.1: Type: text/plain, Size: 1300 bytes --]

That fix has already been committed. Or something darn close to it https://kau.toke.dk/git/cake/iproute2/commit/?id=ef1bbd6718c7c2d30814d5b1e3ee6882a668b6d8

--
Cheers,

Kevin@Darbyshire-Bryant.me.uk
Sent from my phone, apologies for brevity, spelling & top posting

> On 19 Oct 2015, at 17:01, Toke Høiland-Jørgensen <toke@toke.dk> wrote:
> 
> So finally got iproute2 to compile out of the kau.toke.dk repo. The
> patch below was needed to cake. Posting it here rather than just
> committing in the hope of getting someone (Jonathan?) to take a look at
> it and fix it everywhere it's needed :)
> 
> -Toke
> 
> diff --git a/tc/q_cake.c b/tc/q_cake.c
> index 4d64405..1384a46 100644
> --- a/tc/q_cake.c
> +++ b/tc/q_cake.c
> @@ -495,7 +496,7 @@ static int cake_print_xstats(struct qdisc_util *qu, FILE *f,
> 
>    } else if (stnc->version >= 1 && stnc->version < 0xFF
>                && stnc->max_tins == TC_CAKE_MAX_TINS
> -                && RTA_PAYLOAD(xstats) >= offsetof(*stnc, capacity_estimate))
> +                && RTA_PAYLOAD(xstats) >= offsetof(typeof(*stnc), capacity_estimate))
>    {
>        int i;
> 
> _______________________________________________
> Cake mailing list
> Cake@lists.bufferbloat.net
> https://lists.bufferbloat.net/listinfo/cake

[-- Attachment #1.2: Type: text/html, Size: 2418 bytes --]

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 3062 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Cake] Fixing iproute2 compile
  2015-10-19 16:01 [Cake] Fixing iproute2 compile Toke Høiland-Jørgensen
  2015-10-19 16:31 ` Kevin Darbyshire-Bryant
@ 2015-10-19 16:41 ` Kevin Darbyshire-Bryant
  2015-10-19 21:17   ` Kevin Darbyshire-Bryant
  1 sibling, 1 reply; 9+ messages in thread
From: Kevin Darbyshire-Bryant @ 2015-10-19 16:41 UTC (permalink / raw)
  To: Toke Høiland-Jørgensen; +Cc: cake

[-- Attachment #1: Type: text/plain, Size: 1298 bytes --]

Hold the phone...

My guess is a difference in definition of offsetof as potentially defined in tc/include/Utils.h

But very hard to tell on my phone!

--
Cheers,

Kevin@Darbyshire-Bryant.me.uk
Sent from my phone, apologies for brevity, spelling & top posting

> On 19 Oct 2015, at 17:01, Toke Høiland-Jørgensen <toke@toke.dk> wrote:
> 
> So finally got iproute2 to compile out of the kau.toke.dk repo. The
> patch below was needed to cake. Posting it here rather than just
> committing in the hope of getting someone (Jonathan?) to take a look at
> it and fix it everywhere it's needed :)
> 
> -Toke
> 
> diff --git a/tc/q_cake.c b/tc/q_cake.c
> index 4d64405..1384a46 100644
> --- a/tc/q_cake.c
> +++ b/tc/q_cake.c
> @@ -495,7 +496,7 @@ static int cake_print_xstats(struct qdisc_util *qu, FILE *f,
> 
>    } else if (stnc->version >= 1 && stnc->version < 0xFF
>                && stnc->max_tins == TC_CAKE_MAX_TINS
> -                && RTA_PAYLOAD(xstats) >= offsetof(*stnc, capacity_estimate))
> +                && RTA_PAYLOAD(xstats) >= offsetof(typeof(*stnc), capacity_estimate))
>    {
>        int i;
> 
> _______________________________________________
> Cake mailing list
> Cake@lists.bufferbloat.net
> https://lists.bufferbloat.net/listinfo/cake

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 3062 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Cake] Fixing iproute2 compile
  2015-10-19 16:41 ` Kevin Darbyshire-Bryant
@ 2015-10-19 21:17   ` Kevin Darbyshire-Bryant
  2015-10-20  9:13     ` Kevin Darbyshire-Bryant
  0 siblings, 1 reply; 9+ messages in thread
From: Kevin Darbyshire-Bryant @ 2015-10-19 21:17 UTC (permalink / raw)
  To: Toke Høiland-Jørgensen; +Cc: cake

[-- Attachment #1: Type: text/plain, Size: 1929 bytes --]

I think the problem is we're not including stddef.h which defines offsetof.  Later versions of iproute include a def in Utils.h but that wasn't in v4.0.0 which is what tokes repo is based on. Tc-adv is a bit more recent. 

--
Cheers,

Kevin@Darbyshire-Bryant.me.uk
Sent from my phone, apologies for brevity, spelling & top posting

> On 19 Oct 2015, at 17:41, Kevin Darbyshire-Bryant <kevin@darbyshire-bryant.me.uk> wrote:
> 
> Hold the phone...
> 
> My guess is a difference in definition of offsetof as potentially defined in tc/include/Utils.h
> 
> But very hard to tell on my phone!
> 
> --
> Cheers,
> 
> Kevin@Darbyshire-Bryant.me.uk
> Sent from my phone, apologies for brevity, spelling & top posting
> 
>> On 19 Oct 2015, at 17:01, Toke Høiland-Jørgensen <toke@toke.dk> wrote:
>> 
>> So finally got iproute2 to compile out of the kau.toke.dk repo. The
>> patch below was needed to cake. Posting it here rather than just
>> committing in the hope of getting someone (Jonathan?) to take a look at
>> it and fix it everywhere it's needed :)
>> 
>> -Toke
>> 
>> diff --git a/tc/q_cake.c b/tc/q_cake.c
>> index 4d64405..1384a46 100644
>> --- a/tc/q_cake.c
>> +++ b/tc/q_cake.c
>> @@ -495,7 +496,7 @@ static int cake_print_xstats(struct qdisc_util *qu, FILE *f,
>> 
>>   } else if (stnc->version >= 1 && stnc->version < 0xFF
>>               && stnc->max_tins == TC_CAKE_MAX_TINS
>> -                && RTA_PAYLOAD(xstats) >= offsetof(*stnc, capacity_estimate))
>> +                && RTA_PAYLOAD(xstats) >= offsetof(typeof(*stnc), capacity_estimate))
>>   {
>>       int i;
>> 
>> _______________________________________________
>> Cake mailing list
>> Cake@lists.bufferbloat.net
>> https://lists.bufferbloat.net/listinfo/cake
> _______________________________________________
> Cake mailing list
> Cake@lists.bufferbloat.net
> https://lists.bufferbloat.net/listinfo/cake

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 3062 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Cake] Fixing iproute2 compile
  2015-10-19 21:17   ` Kevin Darbyshire-Bryant
@ 2015-10-20  9:13     ` Kevin Darbyshire-Bryant
  2015-10-20 15:38       ` Toke Høiland-Jørgensen
  0 siblings, 1 reply; 9+ messages in thread
From: Kevin Darbyshire-Bryant @ 2015-10-20  9:13 UTC (permalink / raw)
  To: cake

[-- Attachment #1: Type: text/plain, Size: 3505 bytes --]

Hi list,

Now that I've had a little more time to look at this and I'm not on a
train with exceptionally awful connectivity........

iproute2 commit 6256f8c9e45f01187b297a576e148534a393c990  introduced a
backup definition of 'offsetof' macro in utils.h presumably to cover the
case where it wasn't defined elsewhere.   Anything post that iproute2
commit (Dave's tc-adv repo as example) will have this macro defined
courtesy 'utils.h'.

According to various man pages, 'offsetof' should be defined as part of
'stddef.h' which q_cake.c does not include.  By including 'stddef.h' in
q_cake.c I can get q_cake.c to compile and I think that this is a more
correct solution than that proposed previously.  I'm sure someone will
come up with an even more correct solution :-)

For full disclosure I should point out that toke's iproute2 4.0.0 + cake
repo still fails to build completely on my Linux mint 17.2 box *BUT*
with the following diff it at least finishes 'cake' whereas it used to
blow up over 'offsetof' :-)

Kevin



diff --git a/tc/q_cake.c b/tc/q_cake.c
index 3ab93c2..8c3e9c8 100644
--- a/tc/q_cake.c
+++ b/tc/q_cake.c
@@ -37,6 +37,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <stddef.h>
 #include <unistd.h>
 #include <syslog.h>
 #include <fcntl.h>




On 19/10/15 22:17, Kevin Darbyshire-Bryant wrote:
> I think the problem is we're not including stddef.h which defines offsetof.  Later versions of iproute include a def in Utils.h but that wasn't in v4.0.0 which is what tokes repo is based on. Tc-adv is a bit more recent. 
>
> --
> Cheers,
>
> Kevin@Darbyshire-Bryant.me.uk
> Sent from my phone, apologies for brevity, spelling & top posting
>
>> On 19 Oct 2015, at 17:41, Kevin Darbyshire-Bryant <kevin@darbyshire-bryant.me.uk> wrote:
>>
>> Hold the phone...
>>
>> My guess is a difference in definition of offsetof as potentially defined in tc/include/Utils.h
>>
>> But very hard to tell on my phone!
>>
>> --
>> Cheers,
>>
>> Kevin@Darbyshire-Bryant.me.uk
>> Sent from my phone, apologies for brevity, spelling & top posting
>>
>>> On 19 Oct 2015, at 17:01, Toke Høiland-Jørgensen <toke@toke.dk> wrote:
>>>
>>> So finally got iproute2 to compile out of the kau.toke.dk repo. The
>>> patch below was needed to cake. Posting it here rather than just
>>> committing in the hope of getting someone (Jonathan?) to take a look at
>>> it and fix it everywhere it's needed :)
>>>
>>> -Toke
>>>
>>> diff --git a/tc/q_cake.c b/tc/q_cake.c
>>> index 4d64405..1384a46 100644
>>> --- a/tc/q_cake.c
>>> +++ b/tc/q_cake.c
>>> @@ -495,7 +496,7 @@ static int cake_print_xstats(struct qdisc_util *qu, FILE *f,
>>>
>>>   } else if (stnc->version >= 1 && stnc->version < 0xFF
>>>               && stnc->max_tins == TC_CAKE_MAX_TINS
>>> -                && RTA_PAYLOAD(xstats) >= offsetof(*stnc, capacity_estimate))
>>> +                && RTA_PAYLOAD(xstats) >= offsetof(typeof(*stnc), capacity_estimate))
>>>   {
>>>       int i;
>>>
>>> _______________________________________________
>>> Cake mailing list
>>> Cake@lists.bufferbloat.net
>>> https://lists.bufferbloat.net/listinfo/cake
>> _______________________________________________
>> Cake mailing list
>> Cake@lists.bufferbloat.net
>> https://lists.bufferbloat.net/listinfo/cake
>>
>>
>> _______________________________________________
>> Cake mailing list
>> Cake@lists.bufferbloat.net
>> https://lists.bufferbloat.net/listinfo/cake



[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4816 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Cake] Fixing iproute2 compile
  2015-10-19 16:31 ` Kevin Darbyshire-Bryant
@ 2015-10-20 15:33   ` Toke Høiland-Jørgensen
  0 siblings, 0 replies; 9+ messages in thread
From: Toke Høiland-Jørgensen @ 2015-10-20 15:33 UTC (permalink / raw)
  To: Kevin Darbyshire-Bryant; +Cc: cake

[-- Attachment #1: Type: text/plain, Size: 368 bytes --]

Kevin Darbyshire-Bryant <kevin@darbyshire-bryant.me.uk> writes:

> That fix has already been committed. Or something darn close to it
> https://kau.toke.dk/git/cake/iproute2/commit/?id=ef1bbd6718c7c2d30814d5b1e3ee6882a668b6d8

So it turns out I did 'git fetch' but forgot to do 'git pull', so didn't
get this commit. My bad, and just ignore the patch I posted.

-Toke

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Cake] Fixing iproute2 compile
  2015-10-20  9:13     ` Kevin Darbyshire-Bryant
@ 2015-10-20 15:38       ` Toke Høiland-Jørgensen
  2015-10-21 10:31         ` Kevin Darbyshire-Bryant
  0 siblings, 1 reply; 9+ messages in thread
From: Toke Høiland-Jørgensen @ 2015-10-20 15:38 UTC (permalink / raw)
  To: Kevin Darbyshire-Bryant; +Cc: cake

[-- Attachment #1: Type: text/plain, Size: 567 bytes --]

Kevin Darbyshire-Bryant <kevin@darbyshire-bryant.me.uk> writes:

> iproute2 commit 6256f8c9e45f01187b297a576e148534a393c990 introduced a
> backup definition of 'offsetof' macro in utils.h presumably to cover
> the case where it wasn't defined elsewhere. Anything post that
> iproute2 commit (Dave's tc-adv repo as example) will have this macro
> defined courtesy 'utils.h'.

Okay, so I just merged the net-next upstream branch of iproute2 into the
cake repository. It now builds for me on both Debian Wheezy (i.e.
ancient) and Arch Linux (i.e. fairly recent).

-Toke

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Cake] Fixing iproute2 compile
  2015-10-20 15:38       ` Toke Høiland-Jørgensen
@ 2015-10-21 10:31         ` Kevin Darbyshire-Bryant
  2015-10-21 11:38           ` Toke Høiland-Jørgensen
  0 siblings, 1 reply; 9+ messages in thread
From: Kevin Darbyshire-Bryant @ 2015-10-21 10:31 UTC (permalink / raw)
  To: Toke Høiland-Jørgensen; +Cc: cake

[-- Attachment #1: Type: text/plain, Size: 906 bytes --]



On 20/10/15 16:38, Toke Høiland-Jørgensen wrote:
> Kevin Darbyshire-Bryant <kevin@darbyshire-bryant.me.uk> writes:
>
>> iproute2 commit 6256f8c9e45f01187b297a576e148534a393c990 introduced a
>> backup definition of 'offsetof' macro in utils.h presumably to cover
>> the case where it wasn't defined elsewhere. Anything post that
>> iproute2 commit (Dave's tc-adv repo as example) will have this macro
>> defined courtesy 'utils.h'.
> Okay, so I just merged the net-next upstream branch of iproute2 into the
> cake repository. It now builds for me on both Debian Wheezy (i.e.
> ancient) and Arch Linux (i.e. fairly recent).
>
> -Toke
It builds here now on Mint too :-)

I still think including <stddef.h> in q_cake.c is the most sanitary way
to go.  gcc for example does its own version of the 'offsetof' macro.

Who do I ask and how do I go about commit access to kau.toke.dk ;-)



[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4816 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Cake] Fixing iproute2 compile
  2015-10-21 10:31         ` Kevin Darbyshire-Bryant
@ 2015-10-21 11:38           ` Toke Høiland-Jørgensen
  0 siblings, 0 replies; 9+ messages in thread
From: Toke Høiland-Jørgensen @ 2015-10-21 11:38 UTC (permalink / raw)
  To: Kevin Darbyshire-Bryant; +Cc: cake

Kevin Darbyshire-Bryant <kevin@darbyshire-bryant.me.uk> writes:

> It builds here now on Mint too :-)

Awesome.

> I still think including <stddef.h> in q_cake.c is the most sanitary
> way to go. gcc for example does its own version of the 'offsetof'
> macro.

I have no strong opinions on this either way.

> Who do I ask and how do I go about commit access to kau.toke.dk ;-)

Send me a public key, then I'll add you :)

-Toke

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-10-21 11:38 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-19 16:01 [Cake] Fixing iproute2 compile Toke Høiland-Jørgensen
2015-10-19 16:31 ` Kevin Darbyshire-Bryant
2015-10-20 15:33   ` Toke Høiland-Jørgensen
2015-10-19 16:41 ` Kevin Darbyshire-Bryant
2015-10-19 21:17   ` Kevin Darbyshire-Bryant
2015-10-20  9:13     ` Kevin Darbyshire-Bryant
2015-10-20 15:38       ` Toke Høiland-Jørgensen
2015-10-21 10:31         ` Kevin Darbyshire-Bryant
2015-10-21 11:38           ` Toke Høiland-Jørgensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox