Merge lp:~christian-roeller/hipl/whitelisting into lp:hipl
- whitelisting
- Merge into trunk
Status: | Superseded |
---|---|
Proposed branch: | lp:~christian-roeller/hipl/whitelisting |
Merge into: | lp:hipl |
Diff against target: |
180 lines (+76/-20) 2 files modified
hipd/netdev.c (+73/-20) hipd/netdev.h (+3/-0) |
To merge this branch: | bzr merge lp:~christian-roeller/hipl/whitelisting |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Stefan Götz (community) | Needs Fixing | ||
Diego Biurrun | Pending | ||
Review via email: mp+71355@code.launchpad.net |
This proposal supersedes a proposal from 2011-08-11.
This proposal has been superseded by a proposal from 2011-08-22.
Commit message
Description of the change
Change in the whitelisting of hipl:
The problem with the current whitelisting fuction is, that it only considers the interface-indexes. So when you for instance want to whitelist your eth0 interface, but there are also alias-interfaces for this interface on your machine, then a change for this alias-interfaces would also trigger an update, because these interfaces have the same interface-index for the kernel.
To have a more concrete possibility to whitelist interfaces, I extend the whitelist-structure with the interface-label. So that when you now whitelist your interface eth0, only changes on this interface would trigger an update and not for the alias-interfaces.
I did this by just checking for every incoming NEWADDR netlinkevent, if the corresponding label for this address is whitelisted or not.
So please have a look and just tell if you are fine with this...
Stefan Götz (stefan.goetz-deactivatedaccount) wrote : Posted in a previous version of this proposal | # |
Miika Komu (miika-iki) wrote : Posted in a previous version of this proposal | # |
Quick test report: seems to work without any troubles.
Christian Röller (christian-roeller) wrote : Posted in a previous version of this proposal | # |
Once my exam is over I have finally found the time to work on your improvement suggestions...
> Hi Christian!
>
> Thanks for this helpful contribution! My comments below:
>
> > > === modified file 'hipd/netdev.c'
> > > --- hipd/netdev.c 2011-05-31 18:21:28 +0000
> > > +++ hipd/netdev.c 2011-07-14 15:34:41 +0000
> > > -static void hip_netdev_
> > > +static void hip_netdev_
> char *const device_name)
>
> [L] cleanup: please add a 'const' modifier to the 'if_index' argument
> [L] cleanup: I guess that 'if_index' cannot be less than 0. If so, it would be
> nice to change its type to unsigned to communicate this fact to the caller.
Both done, you are right no reason here for dont make it unsigned and const...
>
> > > {
> > > if (hip_netdev_
> > > - hip_netdev_
> > > + hip_netdev_
> if_index;
> > > +
> strncpy(
> device_name, IF_NAMESIZE);
> [L] maintainability: it is more maintainable to use
> 'sizeof(
> the
> size of the 'if_label' field can be changed in the struct declaration without
> having to touch other code.
Good point I didnt take this into account, its changed now
>
> > > @@ -120,16 +127,18 @@
> > > }
> > >
> > > /**
> > > - * Test if the given network interface index is white listed.
> > > + * Test if the given network interface index plus label is white listed.
> > > *
> > > * @param if_index the index of the network interface to be tested
> > > + * @param device_name the label of the network interface to be tested
> > > * @return 1 if the index is whitelisted or zero otherwise
> > > */
> > > -static int hip_netdev_
> > > +static int hip_netdev_
>
> [M] policy: please apply full const correctness to the function arguments.
> [L] cleanup: it would be nice to change the type of 'if_index' to unsigned as
> it
> can never be < 0 (I guess)
Same as above, so done...
>
> > > {
> > > - int i = 0;
> > > + int i;
> > > for (i = 0; i < hip_netdev_
>
> [L] style: you could even place the declaration of 'i' in the for() header.
Yes I can, so I did... ;-) The actual writer did it like this, so I just adopt it...
>
> > > - if (hip_netdev_
> > > + if (hip_netdev_
> > > + !strncmp(
> IF_NAMESIZE)) {
>
> [L] maintainability: 'sizeof()' instead of 'IF_NAMESIZE', see above
Done...but I use sizeof()-1 to do not override the null-termination
>
> > > @@ -637,7 +645,7 @@
> > > HIP_IFEL(!(if_index = if_nametoindex(
> > > -1, "if_nametoindex failed\n");
> > > /* Check if our interface is in the whitelist */
> > > - if ((hip_netdev_
Stefan Götz (stefan.goetz-deactivatedaccount) wrote : Posted in a previous version of this proposal | # |
Hi Christian!
Thanks for your detailed reply! I was on holidays so that's why my answer is
quite late:
>>>> - if (hip_netdev_
>>>> + if (hip_netdev_
>>>> + !strncmp(
>> IF_NAMESIZE)) {
>>
>> [L] maintainability: 'sizeof()' instead of 'IF_NAMESIZE', see above
>
> Done...but I use sizeof()-1 to do not override the null-termination
Hm - in the case of the read-only 'strncmp()' function, I'm pretty sure that you
want to check both strings to their full extent, including the null-terminating
character. Otherwise, you can get false positives with unterminated strings (I
know, that's a pathological case, but still, passing 'sizeof() - 1' to
'strncmp()' seems logically incorrect to me).
>>>> +int hip_find_
>>
>> [M] policy: please ensure full const correctness
>
> I write to label and cast addr, so I cannot declare const, can I?
You can use 'const struct sockaddr *const addr' and cast it to 'const struct
sockaddr_in const* s4_in'. Similarly, you can use 'char *const label' as you do
not intend to or do change the pointer value.
>>>> + res = getifaddrs(
>>>> + for (ifa = myaddrs; ifa != NULL; ifa = ifa->ifa_next) {
>>>> + if (ifa->ifa_addr == NULL) continue;
>>>> + if (ifa->ifa_
>> ifa->ifa_
>>
>> [M] policy: HIPL always uses "long" if statements including braces and
>> newlines.
>> Please adhere to that style. Do you use the pre-commit hook for checking your
>> code style? I'm asking because I'm surprised that the checker does not catch
>> this.
>
> For me the statement doesnt include braces or a new line. Maybe I have changed it and forgot to commit it...maybe you can check it again...
Exactly my point: it *should* include braces and newlines but currently it does
not :-) It should read
if (ifa->ifa_addr == NULL) {
continue;
}
etc.
>> [L] maintainability: similar to the above cases, 'sizeof(s4_in)' would be more
>> easily maintainable and more obvious to read than 'sizeof(struct
>> sockaddr_in)'.
>> The same applies to the code below.
>>
>>>> + strncpy(label, ifa->ifa_name, IF_NAMESIZE);
>>
>> [L] 'sizeof()'
>
> Both done, like described above...
Just like 'strncmp()', 'strncpy()' should use the full character array - the
code should also check that the string to copy is not longer than the given
character array - 1 or otherwise return an error from the function. Only this
combination will ensure that the string is either copied correctly or an error
is detected under all circumstances.
>>>> + freeifaddrs(
>>>> + return 1;
>>>> + }
>>>> + }
>>>> + if (ifa->ifa_
>>>> + s6 = (struct sockaddr_in6 *)(ifa->ifa_addr);
>>>> + if (!memcmp(s6_in, s6, sizeof(struct sockaddr_in6))) {
>>>> + strncpy(label, ifa->ifa_name, IF_NAMESIZE);
>>>> + freeifaddrs(
>>>> + return 1;
>>
>> [L] styl...
Christian Röller (christian-roeller) wrote : Posted in a previous version of this proposal | # |
> Hi Christian!
>
> Thanks for your detailed reply! I was on holidays so that's why my answer is
> quite late:
No problem my first reply has also taken a while due to my exam preparations ;-)
>
> >>>> - if (hip_netdev_
> >>>> + if (hip_netdev_
> >>>> + !strncmp(
> >> IF_NAMESIZE)) {
> >>
> >> [L] maintainability: 'sizeof()' instead of 'IF_NAMESIZE', see above
> >
> > Done...but I use sizeof()-1 to do not override the null-termination
>
> Hm - in the case of the read-only 'strncmp()' function, I'm pretty sure that
> you
> want to check both strings to their full extent, including the null-
> terminating
> character. Otherwise, you can get false positives with unterminated strings (I
> know, that's a pathological case, but still, passing 'sizeof() - 1' to
> 'strncmp()' seems logically incorrect to me).
Yes of course...I never did it in the code. This was just a comment at the wrong position.
>
> >>>> +int hip_find_
> >>
> >> [M] policy: please ensure full const correctness
> >
> > I write to label and cast addr, so I cannot declare const, can I?
>
> You can use 'const struct sockaddr *const addr' and cast it to 'const struct
> sockaddr_in const* s4_in'. Similarly, you can use 'char *const label' as you
> do
> not intend to or do change the pointer value.
Yes you are right, did it.
>
> >>>> + res = getifaddrs(
> >>>> + for (ifa = myaddrs; ifa != NULL; ifa = ifa->ifa_next) {
> >>>> + if (ifa->ifa_addr == NULL) continue;
> >>>> + if (ifa->ifa_
> >> ifa->ifa_
> >>
> >> [M] policy: HIPL always uses "long" if statements including braces and
> >> newlines.
> >> Please adhere to that style. Do you use the pre-commit hook for checking
> your
> >> code style? I'm asking because I'm surprised that the checker does not
> catch
> >> this.
> >
> > For me the statement doesnt include braces or a new line. Maybe I have
> changed it and forgot to commit it...maybe you can check it again...
>
> Exactly my point: it *should* include braces and newlines but currently it
> does
> not :-) It should read
>
> if (ifa->ifa_addr == NULL) {
> continue;
> }
>
> etc.
Ah OK now I got your point...sorry ;-) I changed it
>
> >> [L] maintainability: similar to the above cases, 'sizeof(s4_in)' would be
> more
> >> easily maintainable and more obvious to read than 'sizeof(struct
> >> sockaddr_in)'.
> >> The same applies to the code below.
> >>
> >>>> + strncpy(label, ifa->ifa_name, IF_NAMESIZE);
> >>
> >> [L] 'sizeof()'
> >
> > Both done, like described above...
>
> Just like 'strncmp()', 'strncpy()' should use the full character array - the
> code should also check that the string to copy is not longer than the given
> character array - 1 or otherwise return an error from the function. Only this
> combination will ensure that the string is either copied correctly or an error
> is detected under all circumstances.
OK, I changed it in the following way:
I chec...
Stefan Götz (stefan.goetz-deactivatedaccount) : Posted in a previous version of this proposal | # |
Diego Biurrun (diego-biurrun) wrote : Posted in a previous version of this proposal | # |
review needs-fixing
On Thu, Jul 14, 2011 at 03:34:45PM +0000, Christian Röller wrote:
> Christian Röller has proposed merging lp:~christian-roeller/hipl/whitelisting into lp:hipl.
Formatting is messed-up. Didn't you install the uncrustify pre-commit
hook as described in doc/HACKING? Why?
Diego
Christian Röller (christian-roeller) wrote : Posted in a previous version of this proposal | # |
> review needs-fixing
>
> On Thu, Jul 14, 2011 at 03:34:45PM +0000, Christian Röller wrote:
> > Christian Röller has proposed merging lp:~christian-
> roeller/
>
> Formatting is messed-up. Didn't you install the uncrustify pre-commit
> hook as described in doc/HACKING? Why?
>
> Diego
Sorry for that, I checked now my modifications with the stylechecker and correct everything it complained about.
Diego Biurrun (diego-biurrun) wrote : Posted in a previous version of this proposal | # |
On Mon, Aug 01, 2011 at 09:19:26AM +0000, Christian Röller wrote:
> > On Thu, Jul 14, 2011 at 03:34:45PM +0000, Christian Röller wrote:
> > > Christian Röller has proposed merging lp:~christian-
> > roeller/
> >
> > Formatting is messed-up. Didn't you install the uncrustify pre-commit
> > hook as described in doc/HACKING? Why?
>
> Sorry for that, I checked now my modifications with the stylechecker
> and correct everything it complained about.
I'm not trying to pass blame around. I want to know why some of our
processes are not working as intended, so that we can fix them.
Why were you not running uncrustify? Did you just forget to install
the hook (no big deal, we all make mistakes and we have review for a
reason) or did you not know about it? Where would we have to advertise
it so that the next newcomer is informed of its existence?
Diego
Christian Röller (christian-roeller) wrote : Posted in a previous version of this proposal | # |
> On Mon, Aug 01, 2011 at 09:19:26AM +0000, Christian Röller wrote:
> > > On Thu, Jul 14, 2011 at 03:34:45PM +0000, Christian Röller wrote:
> > > > Christian Röller has proposed merging lp:~christian-
> > > roeller/
> > >
> > > Formatting is messed-up. Didn't you install the uncrustify pre-commit
> > > hook as described in doc/HACKING? Why?
> >
> > Sorry for that, I checked now my modifications with the stylechecker
> > and correct everything it complained about.
>
> I'm not trying to pass blame around. I want to know why some of our
> processes are not working as intended, so that we can fix them.
>
> Why were you not running uncrustify? Did you just forget to install
> the hook (no big deal, we all make mistakes and we have review for a
> reason) or did you not know about it? Where would we have to advertise
> it so that the next newcomer is informed of its existence?
>
> Diego
I have heard that there is a hook for this, but as this is my first share,
I just forgot to install it.
So in this case it was just my fault...
But for the next newcomers, it would be nice to advertise the HACKING doc a
little bit more, because it is very helpful and I don't know about it. I just
heard about the stylechecker through the grapevine.
So sorry again and thanks for the infos...
Christian
Diego Biurrun (diego-biurrun) wrote : Posted in a previous version of this proposal | # |
On Mon, Aug 01, 2011 at 09:59:28AM +0000, Christian Röller wrote:
> > On Mon, Aug 01, 2011 at 09:19:26AM +0000, Christian Röller wrote:
> > > > On Thu, Jul 14, 2011 at 03:34:45PM +0000, Christian Röller wrote:
> > > > > Christian Röller has proposed merging lp:~christian-
> > > > roeller/
> > > >
> > > > Formatting is messed-up. Didn't you install the uncrustify pre-commit
> > > > hook as described in doc/HACKING? Why?
> > >
> > > Sorry for that, I checked now my modifications with the stylechecker
> > > and correct everything it complained about.
> >
> > I'm not trying to pass blame around. I want to know why some of our
> > processes are not working as intended, so that we can fix them.
> >
> > Why were you not running uncrustify? Did you just forget to install
> > the hook (no big deal, we all make mistakes and we have review for a
> > reason) or did you not know about it? Where would we have to advertise
> > it so that the next newcomer is informed of its existence?
>
> I have heard that there is a hook for this, but as this is my first share,
> I just forgot to install it.
> So in this case it was just my fault...
I repeat: I'm not trying to pass blame around. Stop apologizing please.
> But for the next newcomers, it would be nice to advertise the HACKING doc a
> little bit more, because it is very helpful and I don't know about it. I just
> heard about the stylechecker through the grapevine.
I've updated INSTALL and the PISA wiki slightly. There's still room for
improvement though.
Diego
Christian Röller (christian-roeller) wrote : Posted in a previous version of this proposal | # |
Hi,
sorry for my long absence, it was again exam-time ;-)
So I correct everything, which were mentioned. Are there more improvement suggestions or any other reasons why it should not be merged in this version?
Otherwise I would do so.
I merged it locally and as there are only a few changes in two files, it works without any trouble.
The same applies for the compiling.
Regards,
Christian
René Hummen (rene-hummen) wrote : Posted in a previous version of this proposal | # |
Diego, have your comments been tackled? If so, please approve the merge request.
Diego Biurrun (diego-biurrun) wrote : Posted in a previous version of this proposal | # |
On Wed, Aug 10, 2011 at 02:07:38PM +0000, Christian Röller wrote:
>
> So I correct everything, which were mentioned. Are there more
> improvement suggestions or any other reasons why it should not be
> merged in this version?
> Otherwise I would do so.
The general idea is that you resubmit a fixed merge proposal.
Diego
Diego Biurrun (diego-biurrun) wrote : Posted in a previous version of this proposal | # |
On Wed, Aug 10, 2011 at 02:39:35PM +0000, René Hummen wrote:
> Diego, have your comments been tackled? If so, please approve the merge request.
There was no updated merge request, so the answer is no.
Diego
Christian Röller (christian-roeller) wrote : Posted in a previous version of this proposal | # |
> On Wed, Aug 10, 2011 at 02:39:35PM +0000, René Hummen wrote:
> > Diego, have your comments been tackled? If so, please approve the merge
> request.
>
> There was no updated merge request, so the answer is no.
>
> Diego
I correct the code style violations with revision 5987.
What do you mean with updated merge request? I answered on your needs-fixing comment and correct it.
I did the same for Stefan's needs-fixing request and he approved it.
What should I rather have done?
Christian
René Hummen (rene-hummen) wrote : Posted in a previous version of this proposal | # |
On 10.08.2011, at 17:11, Christian Röller wrote:
>> On Wed, Aug 10, 2011 at 02:39:35PM +0000, René Hummen wrote:
>>> Diego, have your comments been tackled? If so, please approve the merge
>> request.
>>
>> There was no updated merge request, so the answer is no.
>>
>> Diego
>
> I correct the code style violations with revision 5987.
> What do you mean with updated merge request? I answered on your needs-fixing comment and correct it.
> I did the same for Stefan's needs-fixing request and he approved it.
> What should I rather have done?
In the top right corner of your merge proposal page on the Launchpad website, you can follow the link "Resubmit proposal". Don't check the option to "start afresh" in order to keep the discussion history intact and for others to follow the whole conversation.
Ciao,
René
--
Dipl.-Inform. Rene Hummen, Ph.D. Student
Chair of Communication and Distributed Systems
RWTH Aachen University, Germany
tel: +49 241 80 20772
web: http://
Diego Biurrun (diego-biurrun) wrote : Posted in a previous version of this proposal | # |
On Wed, Aug 10, 2011 at 03:11:23PM +0000, Christian Röller wrote:
> > On Wed, Aug 10, 2011 at 02:39:35PM +0000, René Hummen wrote:
> > > Diego, have your comments been tackled? If so, please approve the merge
> > request.
> >
> > There was no updated merge request, so the answer is no.
>
> I correct the code style violations with revision 5987.
> What do you mean with updated merge request? I answered on your
> needs-fixing comment and correct it.
> I did the same for Stefan's needs-fixing request and he approved it.
> What should I rather have done?
Maybe you did fix it in your branch, but how would we know? We never
had a chance to see and review it. What you should do now is send
another merge request from your updated branch.
Diego
Diego Biurrun (diego-biurrun) wrote : Posted in a previous version of this proposal | # |
On Wed, Aug 10, 2011 at 03:28:27PM +0000, Christian Röller wrote:
> Christian Röller has proposed merging lp:~christian-roeller/hipl/whitelisting into lp:hipl.
Did you run
make alltests
tools/
with this branch?
> --- hipd/netdev.c 2011-05-25 09:22:19 +0000
> +++ hipd/netdev.c 2011-08-10 15:28:20 +0000
> @@ -99,19 +99,26 @@
> -static void hip_netdev_
> +static void hip_netdev_
Please keep lines below 80 characters where easily possible, like here.
More examples below...
> @@ -1122,6 +1131,68 @@
>
> /**
> + * This functions gives you the interface label for a given ip4 or ip6 addr.
IPv4, IPv6 address
> + * @param addr address for which you want to know the label
> + * @param label pointer where the function stores the label
> + * @return one on success, zero on error and write the label in param label
Is the label written in both cases?
> +int hip_find_
> +{
> +
> + if (addr->sa_family == AF_INET) {
> + s4_in = (const struct sockaddr_in *const) (addr);
> + }
> + if (addr->sa_family == AF_INET6) {
> + s6_in = (const struct sockaddr_in6 *const) (addr);
> + }
An else will save you a comparison here.
> + getifaddrs(
> + for (ifa = myaddrs; ifa != NULL; ifa = ifa->ifa_next) {
> + if (ifa->ifa_addr == NULL) {
> + continue;
> + }
> + if (ifa->ifa_
> + continue;
> + }
These two could be merged.
> + if (ifa->ifa_
> + s4 = (struct sockaddr_in *) (ifa->ifa_addr);
pointless ()
> + if (ifa->ifa_
> + s6 = (struct sockaddr_in6 *) (ifa->ifa_addr);
pointless ()
As above, if you use else here, you could save a comparison.
> + if (!memcmp(s4_in, s4, sizeof(s4))) {
> + if (strlen(
> + strncpy(label, ifa->ifa_name, sizeof(label) - 1);
> + res = 1;
> + } else {
> + res = 0;
> + }
> + break;
> + if (!memcmp(s6_in, s6, sizeof(s6))) {
> + if (strlen(
> + strncpy(label, ifa->ifa_name, sizeof(label) - 1);
> + res = 1;
> + } else {
> + res = 0;
> + }
> + break;
Isn't there a way to avoid this code duplication?
Diego
Diego Biurrun (diego-biurrun) : Posted in a previous version of this proposal | # |
Stefan Götz (stefan.goetz-deactivatedaccount) wrote : Posted in a previous version of this proposal | # |
Fixing Diego's comments sure won't hurt, but otherwise I'm okay with this.
Christian Röller (christian-roeller) wrote : Posted in a previous version of this proposal | # |
> On Wed, Aug 10, 2011 at 03:28:27PM +0000, Christian Röller wrote:
> > Christian Röller has proposed merging lp:~christian-
> roeller/
>
> Did you run
>
> make alltests
> tools/hipl_
Yes I run make alltests. It seems to be OK, I get no errors and it results with "archives ready for distribution".
I am not really sure how to use the autobuild script. How and from which machine can I run this script manually to build my branch?
Can it come to problems, although make and make alltests run without ones?
>
> with this branch?
>
> > --- hipd/netdev.c 2011-05-25 09:22:19 +0000
> > +++ hipd/netdev.c 2011-08-10 15:28:20 +0000
> > @@ -99,19 +99,26 @@
> > -static void hip_netdev_
> > +static void hip_netdev_
> if_index, const char *const device_name)
>
> Please keep lines below 80 characters where easily possible, like here.
Done...
>
> More examples below...
>
> > @@ -1122,6 +1131,68 @@
> >
> > /**
> > + * This functions gives you the interface label for a given ip4 or ip6
> addr.
>
> IPv4, IPv6 address
Done...
>
> > + * @param addr address for which you want to know the label
> > + * @param label pointer where the function stores the label
> > + * @return one on success, zero on error and write the label in param label
>
> Is the label written in both cases?
Done...only if the address exists in the system
>
> > +int hip_find_
> *const label)
> > +{
> > +
> > + if (addr->sa_family == AF_INET) {
> > + s4_in = (const struct sockaddr_in *const) (addr);
> > + }
> > + if (addr->sa_family == AF_INET6) {
> > + s6_in = (const struct sockaddr_in6 *const) (addr);
> > + }
>
> An else will save you a comparison here.
>
> > + getifaddrs(
> > + for (ifa = myaddrs; ifa != NULL; ifa = ifa->ifa_next) {
> > + if (ifa->ifa_addr == NULL) {
> > + continue;
> > + }
> > + if (ifa->ifa_
> != AF_INET6) {
> > + continue;
> > + }
>
> These two could be merged.
>
> > + if (ifa->ifa_
> > + s4 = (struct sockaddr_in *) (ifa->ifa_addr);
>
> pointless ()
>
> > + if (ifa->ifa_
> > + s6 = (struct sockaddr_in6 *) (ifa->ifa_addr);
>
> pointless ()
>
> As above, if you use else here, you could save a comparison.
>
> > + if (!memcmp(s4_in, s4, sizeof(s4))) {
> > + if (strlen(
> > + strncpy(label, ifa->ifa_name, sizeof(label) - 1);
> > + res = 1;
> > + } else {
> > + res = 0;
> > + }
> > + break;
>
> > + if (!memcmp(s6_in, s6, sizeof(s6))) {
> > + if (strlen(
> > + strncpy(label, ifa->ifa_name, sizeof(label) - 1);
> > + res = 1;
> > + } else {
> > + ...
Diego Biurrun (diego-biurrun) wrote : Posted in a previous version of this proposal | # |
On Thu, Aug 11, 2011 at 11:47:26AM +0000, Christian Röller wrote:
> > On Wed, Aug 10, 2011 at 03:28:27PM +0000, Christian Röller wrote:
> > > Christian Röller has proposed merging lp:~christian-
> > roeller/
> >
> > Did you run
> >
> > make alltests
> > tools/hipl_
>
> Yes I run make alltests. It seems to be OK, I get no errors and it
> results with "archives ready for distribution". I am not really sure
> how to use the autobuild script. How and from which machine can I run
> this script manually to build my branch?
Did you try running or reading the script?
> Can it come to problems, although make and make alltests run without ones?
Yes.
Diego
Diego Biurrun (diego-biurrun) wrote : Posted in a previous version of this proposal | # |
review needs-fixing
On Thu, Aug 11, 2011 at 11:48:47AM +0000, Christian Röller wrote:
> Christian Röller has proposed merging lp:~christian-roeller/hipl/whitelisting into lp:hipl.
>
> --- hipd/netdev.c 2011-05-25 09:22:19 +0000
> +++ hipd/netdev.c 2011-08-11 11:48:38 +0000
> @@ -99,19 +99,27 @@
> if (hip_netdev_
> - hip_netdev_
> + hip_netdev_
> + strncpy(
This is an opportunity for breaking a line, as is
> @@ -119,17 +127,20 @@
>
> -static int hip_netdev_
> +static int hip_netdev_
this one
> + if (hip_netdev_
> + for (unsigned int i = 0; i < hip_netdev_
> + if (hip_netdev_
> + !strncmp(
and this one.
> @@ -1122,6 +1132,40 @@
>
> /**
> + * This functions gives you the interface label for a given IPv4 or IPv6 address.
This sentence explains why starting a sentence with "this sentence" is
redundant and weird.
> + * @param addr address for which you want to know the label
> + * @param label pointer where the function stores the label
> + * @return one on success, zero on error and write the label in param label
> + * if the given addr exists in the system
address
The usual convention is to return zero on success, not one.
> +int hip_find_
long line
> +{
> + int res = 0;
> + struct ifaddrs *myaddrs, *ifa = NULL;
> +
> + getifaddrs(
> + for (ifa = myaddrs; ifa != NULL; ifa = ifa->ifa_next) {
> + if (ifa->ifa_addr == NULL ||
> + (ifa->ifa_
long line
> @@ -1213,6 +1252,18 @@
>
> + /* find interface label for address and check if it is whitelisted or not */
> + if (is_add) {
> + char label[IF_NAMESIZE];
> + if (hip_find_
> + if ((!hip_
> + HIP_DEBUG(
> + continue;
The conditions can be merged.
> --- hipd/netdev.h 2011-05-18 15:12:07 +0000
> +++ hipd/netdev.h 2011-08-11 11:48:38 +0000
> @@ -56,4 +56,6 @@
>
> +int hip_find_
long line
Diego
Christian Röller (christian-roeller) wrote : Posted in a previous version of this proposal | # |
> review needs-fixing
>
> On Thu, Aug 11, 2011 at 11:48:47AM +0000, Christian Röller wrote:
> > Christian Röller has proposed merging lp:~christian-
> roeller/
> >
> > --- hipd/netdev.c 2011-05-25 09:22:19 +0000
> > +++ hipd/netdev.c 2011-08-11 11:48:38 +0000
> > @@ -99,19 +99,27 @@
> > if (hip_netdev_
> > - hip_netdev_
> > + hip_netdev_
> if_index;
> > +
> strncpy(
> device_name, sizeof(
>
> This is an opportunity for breaking a line, as is
>
> > @@ -119,17 +127,20 @@
> >
> > -static int hip_netdev_
> > +static int hip_netdev_
> char *const device_name)
>
> this one
>
> > + if (hip_netdev_
> > + for (unsigned int i = 0; i < hip_netdev_
> > + if (hip_netdev_
> > + !strncmp(
> sizeof(
>
> and this one.
>
> > @@ -1122,6 +1132,40 @@
> >
> > /**
> > + * This functions gives you the interface label for a given IPv4 or IPv6
> address.
>
> This sentence explains why starting a sentence with "this sentence" is
> redundant and weird.
>
> > + * @param addr address for which you want to know the label
> > + * @param label pointer where the function stores the label
> > + * @return one on success, zero on error and write the label in param label
> > + * if the given addr exists in the system
>
> address
>
> The usual convention is to return zero on success, not one.
>
> > +int hip_find_
> *const label)
>
> long line
>
> > +{
> > + int res = 0;
> > + struct ifaddrs *myaddrs, *ifa = NULL;
> > +
> > + getifaddrs(
> > + for (ifa = myaddrs; ifa != NULL; ifa = ifa->ifa_next) {
> > + if (ifa->ifa_addr == NULL ||
> > + (ifa->ifa_
> ifa->ifa_
>
> long line
>
> > @@ -1213,6 +1252,18 @@
> >
> > + /* find interface label for address and check if it is
> whitelisted or not */
> > + if (is_add) {
> > + char label[IF_NAMESIZE];
> > + if (hip_find_
> > + if ((!hip_
> label))) {
> > + HIP_DEBUG(
> label);
> > + continue;
>
> The conditions can be merged.
>
> > --- hipd/netdev.h 2011-05-18 15:12:07 +0000
> > +++ hipd/netdev.h 2011-08-11 11:48:38 +0000
> > @@ -56,4 +56,6 @@
> >
> > +int hip_find_
> *const label);
>
> long line
>
> Diego
Everything done...
I also adapt the autobuild script to my local system conditi...
Stefan Götz (stefan.goetz-deactivatedaccount) wrote : | # |
Hi Christian!
Sorry for coming back late with required fixes :-(
> /**
> + * Gives you the interface label for a given IPv4 or IPv6 address.
> + *
> + * @param addr address for which you want to know the label
> + * @param label pointer where the function stores the label
> + * @return zero on success, one on error and write the label in param label
> + * if the given address exists in the system
> + */
> +int hip_find_
> + char *const label)
[M] safety: this function is not very safe in how it handles the length of the memory buffer pointed to by 'label'. Please either document clearly how large the memory buffer needs to be and what happens if it is not or add code that helps to avoid buffer overflows here.
[M] policy: since this is a new function, it needs to be checked by a unit test. I know it's a PITA but unit tests, for example, immediately point to such issues as the memory buffer handling.
Regards,
Stefan
Christian Röller (christian-roeller) wrote : | # |
> Hi Christian!
Hi
>
> Sorry for coming back late with required fixes :-(
no problem...
>
> > /**
> > + * Gives you the interface label for a given IPv4 or IPv6 address.
> > + *
> > + * @param addr address for which you want to know the label
> > + * @param label pointer where the function stores the label
> > + * @return zero on success, one on error and write the label in param label
> > + * if the given address exists in the system
> > + */
> > +int hip_find_
> > + char *const label)
>
> [M] safety: this function is not very safe in how it handles the length of the
> memory buffer pointed to by 'label'. Please either document clearly how large
> the memory buffer needs to be and what happens if it is not or add code that
> helps to avoid buffer overflows here.
What is exactly the safety problem here? Do you mean I should additionally mention that label
sould be at least as big as IF_NAMESIZE, so that every possible interfacelabel length would fit?
Because right now I check whether the found interfacelabel is not bigger than the associated memory for label. And only if this is the case I will write to label. And I never write more than sizeof(label) bytes to label. Is this not enough to avoid a buffer overflow?
Right now the function will just return 1 if label would be to small. Maybe I should introduce here a special return value to make the debugging easier for the caller. What do you think?
>
> [M] policy: since this is a new function, it needs to be checked by a unit
> test. I know it's a PITA but unit tests, for example, immediately point to
> such issues as the memory buffer handling.
>
> Regards,
> Stefan
Christian
Stefan Götz (stefan.goetz-deactivatedaccount) wrote : | # |
Hi Christian!
> > > +int hip_find_
> > > + char *const label)
> >
> > [M] safety: this function is not very safe in how it handles the length of
[...]
>
> What is exactly the safety problem here?
Nothing - sorry, I simply misread the code.
Stefan
- 5992. By Christian Röller
-
cosmetic: correct some typos
- 5993. By Christian Röller
-
cosmetic: alignments in function description hip_find_
label_for_ address - 5994. By Christian Röller
-
Increase the n by 1 in strncpy regarding the writing of the interfacelabel to guarantee null-termination.
- 5995. By Christian Röller
-
Add Unit-Tests for the new function hip_find_
label_for_ address in /hipd/netdev.c - 5996. By Christian Röller
-
Rebase with trunk.
- 5997. By Christian Röller
-
A few cosmetic changes and correct one mistake regarding the use of sizeof.
- 5998. By Christian Röller
-
Cosmetic issues in both files.
- 5999. By Christian Röller
-
Cosmetic issues in all files.
Unmerged revisions
- 5999. By Christian Röller
-
Cosmetic issues in all files.
- 5998. By Christian Röller
-
Cosmetic issues in both files.
- 5997. By Christian Röller
-
A few cosmetic changes and correct one mistake regarding the use of sizeof.
- 5996. By Christian Röller
-
Rebase with trunk.
- 5995. By Christian Röller
-
Add Unit-Tests for the new function hip_find_
label_for_ address in /hipd/netdev.c - 5994. By Christian Röller
-
Increase the n by 1 in strncpy regarding the writing of the interfacelabel to guarantee null-termination.
- 5993. By Christian Röller
-
cosmetic: alignments in function description hip_find_
label_for_ address - 5992. By Christian Röller
-
cosmetic: correct some typos
- 5991. By Christian Röller
-
cosmetic: typo in function description
- 5990. By Christian Röller
-
cosmetic: shorten a few things
Preview Diff
1 | === modified file 'hipd/netdev.c' | |||
2 | --- hipd/netdev.c 2011-05-25 09:22:19 +0000 | |||
3 | +++ hipd/netdev.c 2011-08-12 13:09:26 +0000 | |||
4 | @@ -99,19 +99,28 @@ | |||
5 | 99 | * size array. | 99 | * size array. |
6 | 100 | * Free slots are signaled by the value -1. | 100 | * Free slots are signaled by the value -1. |
7 | 101 | */ | 101 | */ |
10 | 102 | static int hip_netdev_white_list[HIP_NETDEV_MAX_WHITE_LIST]; | 102 | struct hip_netdev_whiteliste_entry { |
11 | 103 | static int hip_netdev_white_list_count = 0; | 103 | unsigned int if_index; |
12 | 104 | char if_label[IF_NAMESIZE]; | ||
13 | 105 | }; | ||
14 | 106 | static struct hip_netdev_whiteliste_entry hip_netdev_white_list[HIP_NETDEV_MAX_WHITE_LIST]; | ||
15 | 107 | static unsigned int hip_netdev_white_list_count = 0; | ||
16 | 104 | 108 | ||
17 | 105 | /** | 109 | /** |
19 | 106 | * Add a network interface index number to the list of white listed | 110 | * Add a network interface index number plus label to the list of white listed |
20 | 107 | * network interfaces. | 111 | * network interfaces. |
21 | 108 | * | 112 | * |
22 | 109 | * @param if_index the network interface index to be white listed | 113 | * @param if_index the network interface index to be white listed |
23 | 114 | * @param device_name the network interface label to be white listed | ||
24 | 110 | */ | 115 | */ |
26 | 111 | static void hip_netdev_white_list_add_index(int if_index) | 116 | static void hip_netdev_white_list_add_index_and_name(const unsigned int if_index, |
27 | 117 | const char *const device_name) | ||
28 | 112 | { | 118 | { |
29 | 113 | if (hip_netdev_white_list_count < HIP_NETDEV_MAX_WHITE_LIST) { | 119 | if (hip_netdev_white_list_count < HIP_NETDEV_MAX_WHITE_LIST) { |
31 | 114 | hip_netdev_white_list[hip_netdev_white_list_count++] = if_index; | 120 | hip_netdev_white_list[hip_netdev_white_list_count].if_index = if_index; |
32 | 121 | strncpy(hip_netdev_white_list[hip_netdev_white_list_count].if_label, | ||
33 | 122 | device_name, sizeof(hip_netdev_white_list[0].if_label) - 1); | ||
34 | 123 | hip_netdev_white_list_count++; | ||
35 | 115 | } else { | 124 | } else { |
36 | 116 | /* We should NEVER run out of white list slots!!! */ | 125 | /* We should NEVER run out of white list slots!!! */ |
37 | 117 | HIP_DIE("Error: ran out of space for white listed interfaces!\n"); | 126 | HIP_DIE("Error: ran out of space for white listed interfaces!\n"); |
38 | @@ -119,17 +128,22 @@ | |||
39 | 119 | } | 128 | } |
40 | 120 | 129 | ||
41 | 121 | /** | 130 | /** |
43 | 122 | * Test if the given network interface index is white listed. | 131 | * Test if the given network interface index plus label is white listed. |
44 | 123 | * | 132 | * |
45 | 124 | * @param if_index the index of the network interface to be tested | 133 | * @param if_index the index of the network interface to be tested |
46 | 134 | * @param device_name the label of the network interface to be tested | ||
47 | 125 | * @return 1 if the index is whitelisted or zero otherwise | 135 | * @return 1 if the index is whitelisted or zero otherwise |
48 | 126 | */ | 136 | */ |
50 | 127 | static int hip_netdev_is_in_white_list(int if_index) | 137 | static int hip_netdev_is_in_white_list(const unsigned int if_index, |
51 | 138 | const char *const device_name) | ||
52 | 128 | { | 139 | { |
57 | 129 | int i = 0; | 140 | if (hip_netdev_white_list_count > 0) { |
58 | 130 | for (i = 0; i < hip_netdev_white_list_count; i++) { | 141 | for (unsigned int i = 0; i < hip_netdev_white_list_count; i++) { |
59 | 131 | if (hip_netdev_white_list[i] == if_index) { | 142 | if (hip_netdev_white_list[i].if_index == if_index && |
60 | 132 | return 1; | 143 | !strncmp(hip_netdev_white_list[i].if_label, |
61 | 144 | device_name, sizeof(hip_netdev_white_list[0].if_label))) { | ||
62 | 145 | return 1; | ||
63 | 146 | } | ||
64 | 133 | } | 147 | } |
65 | 134 | } | 148 | } |
66 | 135 | return 0; | 149 | return 0; |
67 | @@ -148,19 +162,18 @@ | |||
68 | 148 | int sock = 0; | 162 | int sock = 0; |
69 | 149 | int ret = 0; | 163 | int ret = 0; |
70 | 150 | 164 | ||
72 | 151 | strncpy(ifr.ifr_name, device_name, IF_NAMESIZE); | 165 | strncpy(ifr.ifr_name, device_name, sizeof(ifr.ifr_name) - 1); |
73 | 152 | sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); | 166 | sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); |
74 | 153 | 167 | ||
75 | 154 | if (ioctl(sock, SIOCGIFINDEX, &ifr) == 0) { | 168 | if (ioctl(sock, SIOCGIFINDEX, &ifr) == 0) { |
76 | 155 | ret = 1; | 169 | ret = 1; |
78 | 156 | hip_netdev_white_list_add_index(ifr.ifr_ifindex); | 170 | hip_netdev_white_list_add_index_and_name(ifr.ifr_ifindex, device_name); |
79 | 157 | HIP_DEBUG("Adding device <%s> to white list with index <%i>.\n", | 171 | HIP_DEBUG("Adding device <%s> to white list with index <%i>.\n", |
80 | 158 | device_name, | 172 | device_name, |
81 | 159 | ifr.ifr_ifindex); | 173 | ifr.ifr_ifindex); |
82 | 160 | } else { | 174 | } else { |
83 | 161 | ret = 0; | 175 | ret = 0; |
84 | 162 | } | 176 | } |
85 | 163 | |||
86 | 164 | if (sock) { | 177 | if (sock) { |
87 | 165 | close(sock); | 178 | close(sock); |
88 | 166 | } | 179 | } |
89 | @@ -634,7 +647,7 @@ | |||
90 | 634 | HIP_IFEL(!(if_index = if_nametoindex(g_iface->ifa_name)), | 647 | HIP_IFEL(!(if_index = if_nametoindex(g_iface->ifa_name)), |
91 | 635 | -1, "if_nametoindex failed\n"); | 648 | -1, "if_nametoindex failed\n"); |
92 | 636 | /* Check if our interface is in the whitelist */ | 649 | /* Check if our interface is in the whitelist */ |
94 | 637 | if ((hip_netdev_white_list_count > 0) && (!hip_netdev_is_in_white_list(if_index))) { | 650 | if ((!hip_netdev_is_in_white_list(if_index, g_iface->ifa_name))) { |
95 | 638 | continue; | 651 | continue; |
96 | 639 | } | 652 | } |
97 | 640 | 653 | ||
98 | @@ -1122,6 +1135,40 @@ | |||
99 | 1122 | } | 1135 | } |
100 | 1123 | 1136 | ||
101 | 1124 | /** | 1137 | /** |
102 | 1138 | * Gives you the interface label for a given IPv4 or IPv6 address. | ||
103 | 1139 | * | ||
104 | 1140 | * @param addr address for which you want to know the label | ||
105 | 1141 | * @param label pointer where the function stores the label | ||
106 | 1142 | * @return zero on success, one on error and write the label in param label | ||
107 | 1143 | * if the given address exists in the system | ||
108 | 1144 | */ | ||
109 | 1145 | int hip_find_label_for_address(const struct sockaddr *const addr, | ||
110 | 1146 | char *const label) | ||
111 | 1147 | { | ||
112 | 1148 | int res = 1; | ||
113 | 1149 | struct ifaddrs *myaddrs, *ifa = NULL; | ||
114 | 1150 | |||
115 | 1151 | getifaddrs(&myaddrs); | ||
116 | 1152 | for (ifa = myaddrs; ifa != NULL; ifa = ifa->ifa_next) { | ||
117 | 1153 | if (ifa->ifa_addr == NULL || | ||
118 | 1154 | (ifa->ifa_addr->sa_family != AF_INET && | ||
119 | 1155 | ifa->ifa_addr->sa_family != AF_INET6)) { | ||
120 | 1156 | continue; | ||
121 | 1157 | } | ||
122 | 1158 | |||
123 | 1159 | if (!memcmp(addr, ifa->ifa_addr, sizeof(addr))) { | ||
124 | 1160 | if (strlen(ifa->ifa_name) <= sizeof(label) - 1) { | ||
125 | 1161 | strncpy(label, ifa->ifa_name, sizeof(label) - 1); | ||
126 | 1162 | res = 0; | ||
127 | 1163 | } | ||
128 | 1164 | break; | ||
129 | 1165 | } | ||
130 | 1166 | } | ||
131 | 1167 | freeifaddrs(myaddrs); | ||
132 | 1168 | return res; | ||
133 | 1169 | } | ||
134 | 1170 | |||
135 | 1171 | /** | ||
136 | 1125 | * Netlink event handler. Handles IPsec acquire messages (triggering | 1172 | * Netlink event handler. Handles IPsec acquire messages (triggering |
137 | 1126 | * of base exchange) and updates the cache of local addresses when | 1173 | * of base exchange) and updates the cache of local addresses when |
138 | 1127 | * address changes occur. | 1174 | * address changes occur. |
139 | @@ -1167,11 +1214,6 @@ | |||
140 | 1167 | rta = IFA_RTA(ifa); | 1214 | rta = IFA_RTA(ifa); |
141 | 1168 | l = msg->nlmsg_len - NLMSG_LENGTH(sizeof(*ifa)); | 1215 | l = msg->nlmsg_len - NLMSG_LENGTH(sizeof(*ifa)); |
142 | 1169 | 1216 | ||
143 | 1170 | /* Check if our interface is in the whitelist */ | ||
144 | 1171 | if ((hip_netdev_white_list_count > 0) && | ||
145 | 1172 | (!hip_netdev_is_in_white_list(ifindex))) { | ||
146 | 1173 | continue; | ||
147 | 1174 | } | ||
148 | 1175 | 1217 | ||
149 | 1176 | if ((ifa->ifa_family != AF_INET) && | 1218 | if ((ifa->ifa_family != AF_INET) && |
150 | 1177 | (ifa->ifa_family != AF_INET6)) { | 1219 | (ifa->ifa_family != AF_INET6)) { |
151 | @@ -1213,6 +1255,17 @@ | |||
152 | 1213 | HIP_DEBUG("Unknown addr family in addr\n"); | 1255 | HIP_DEBUG("Unknown addr family in addr\n"); |
153 | 1214 | } | 1256 | } |
154 | 1215 | 1257 | ||
155 | 1258 | /* find interface label for address and check if it is whitelisted or not */ | ||
156 | 1259 | if (is_add) { | ||
157 | 1260 | char label[IF_NAMESIZE]; | ||
158 | 1261 | if (!hip_find_label_for_address(addr, label) && | ||
159 | 1262 | !hip_netdev_is_in_white_list(ifa->ifa_index, label)) { | ||
160 | 1263 | HIP_DEBUG("Interface:<%s> is not whitelisted\n", label); | ||
161 | 1264 | continue; | ||
162 | 1265 | } | ||
163 | 1266 | } | ||
164 | 1267 | |||
165 | 1268 | |||
166 | 1216 | /* Trying to add an existing address or deleting a non-existing | 1269 | /* Trying to add an existing address or deleting a non-existing |
167 | 1217 | * address */ | 1270 | * address */ |
168 | 1218 | exists = hip_exists_address_in_list(addr, ifa->ifa_index); | 1271 | exists = hip_exists_address_in_list(addr, ifa->ifa_index); |
169 | 1219 | 1272 | ||
170 | === modified file 'hipd/netdev.h' | |||
171 | --- hipd/netdev.h 2011-05-18 15:12:07 +0000 | |||
172 | +++ hipd/netdev.h 2011-08-12 13:09:26 +0000 | |||
173 | @@ -56,4 +56,7 @@ | |||
174 | 56 | int hip_map_id_to_addr(const hip_hit_t *hit, const hip_lsi_t *lsi, | 56 | int hip_map_id_to_addr(const hip_hit_t *hit, const hip_lsi_t *lsi, |
175 | 57 | struct in6_addr *addr); | 57 | struct in6_addr *addr); |
176 | 58 | 58 | ||
177 | 59 | int hip_find_label_for_address(const struct sockaddr *const addr, | ||
178 | 60 | char *const label); | ||
179 | 61 | |||
180 | 59 | #endif /* HIP_HIPD_NETDEV_H */ | 62 | #endif /* HIP_HIPD_NETDEV_H */ |
Hi Christian!
Thanks for this helpful contribution! My comments below:
> > === modified file 'hipd/netdev.c' white_list_ add_index( int if_index) white_list_ add_index_ and_name( int if_index, const char *const device_name)
> > --- hipd/netdev.c 2011-05-31 18:21:28 +0000
> > +++ hipd/netdev.c 2011-07-14 15:34:41 +0000
> > -static void hip_netdev_
> > +static void hip_netdev_
[L] cleanup: please add a 'const' modifier to the 'if_index' argument
[L] cleanup: I guess that 'if_index' cannot be less than 0. If so, it would be
nice to change its type to unsigned to communicate this fact to the caller.
> > { white_list_ count < HIP_NETDEV_ MAX_WHITE_ LIST) { white_list[ hip_netdev_ white_list_ count++ ] = if_index; white_list[ hip_netdev_ white_list_ count]. if_index = if_index; hip_netdev_ white_list[ hip_netdev_ white_list_ count]. if_label, device_name, IF_NAMESIZE); hip_netdev_ white_list[ 0].if_label) ' than 'IF_NAMESIZE' because then the
> > if (hip_netdev_
> > - hip_netdev_
> > + hip_netdev_
> > + strncpy(
[L] maintainability: it is more maintainable to use
'sizeof(
size of the 'if_label' field can be changed in the struct declaration without
having to touch other code.
> > @@ -120,16 +127,18 @@ is_in_white_ list(int if_index) is_in_white_ list(int if_index, char *device_name)
> > }
> >
> > /**
> > - * Test if the given network interface index is white listed.
> > + * Test if the given network interface index plus label is white listed.
> > *
> > * @param if_index the index of the network interface to be tested
> > + * @param device_name the label of the network interface to be tested
> > * @return 1 if the index is whitelisted or zero otherwise
> > */
> > -static int hip_netdev_
> > +static int hip_netdev_
[M] policy: please apply full const correctness to the function arguments.
[L] cleanup: it would be nice to change the type of 'if_index' to unsigned as it
can never be < 0 (I guess)
> > { white_list_ count; i++) {
> > - int i = 0;
> > + int i;
> > for (i = 0; i < hip_netdev_
[L] style: you could even place the declaration of 'i' in the for() header.
> > - if (hip_netdev_ white_list[ i] == if_index) { white_list[ i].if_index == if_index && hip_netdev_ white_list[ i].if_label, device_name, IF_NAMESIZE)) {
> > + if (hip_netdev_
> > + !strncmp(
[L] maintainability: 'sizeof()' instead of 'IF_NAMESIZE', see above
> > @@ -637,7 +645,7 @@ g_iface- >ifa_name) ), white_list_ count > 0) && (!hip_netdev_ is_in_white_ list(if_ index)) ) { white_list_ count > 0) && (!hip_netdev_ is_in_white_ list(if_ index, g_iface- >ifa_name) )) {
> > HIP_IFEL(!(if_index = if_nametoindex(
> > -1, "if_nametoindex failed\n");
> > /* Check if our interface is in the whitelist */
> > - if ((hip_netdev_
> > + if ((hip_netdev_
[L] style: just a general comment: it would make more sense to move the '> 0' is_in_white_ list()' function so the caller does not
check into the 'hip_netdev_
need to have internal knowledge about the list implementation. Furthermore it's
a really silly performance optimization.
> > @@ -1125,6 +1133,55 @@
> > }
> >
> > /**
> > + * find interface label for a given ip4 or ip6 addr
...