[systemd-devel] [PATCH 1/2] Update IFA_MAX adding IFA_FLAGS

Lennart Poettering lennart at poettering.net
Wed Apr 8 11:17:10 PDT 2015


On Wed, 08.04.15 20:04, Alexander Sverdlin (alexander.sverdlin at gmail.com) wrote:

> Hello Lennart,
> 
> On 08/04/15 12:57, Lennart Poettering wrote:
> >> Fixes the following compilation problem:
> >> > src/libsystemd/sd-rtnl/rtnl-types.c:361:9: error: array index in initializer exceeds array bounds
> >> >          [IFA_FLAGS]             = { .type = NLA_U32 },
> >> >          ^
> >> > src/libsystemd/sd-rtnl/rtnl-types.c:361:9: error: (near initialization for 'rtnl_address_types')
> >> > 
> >> > Also include if_addr.h into missing.h so that it's possible to
> >> > redefine __IFA_MAX.
> > I feel a bit uneasy about changing definitions from the header
> 
> Hmm, that's what actually happened in 81577dc2, for instance...

Well, I think we should still avoid it (though I wasn't aware of this commit).

> > files. Adding is fine, but altering them is something we should be
> > carefuly with. Hence I commited a different fix now:
> 
> Oh, this is cryptic, especially for people familiar with netlink, but not introduced to patching
> missing.h... This is error prone, because one requires such not obvious construct in every place
> where IFA_FLAGS will be used. It will be eventually detected by compiler, but it's far more safe
> to redefine the IFA_MAX...

I think the lesson is really to stay away from IFA_MAX and similar definitions...

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list