These unnecessary double prefixes (hip_ and netdev_) for symbols not
visible outside of this file are annoying.
In a perfect world, you would do a quick search and replace on trunk and
merge that back into your branch, but I don't want to pile too much
extra work on you. However, if you have a minute and the motivation..
Maybe you could drop them for the new code, but feel free to ignore me.
> -static int hip_netdev_is_in_white_list(int if_index)
> +static int hip_netdev_is_in_white_list(const unsigned int if_index,
> + const char *const device_name)
Oh look, this file only had a hip_ prefix - yay for consistency in HIPL,
even in the same file :)
> @@ -1120,6 +1133,44 @@
>
> /**
> + * 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.
> + * @param sizeoflabel Size of the passed label parameter, should be chosen big enough
> + * to be able to store every possible interface name plus null-termination.
extra whitespace
> + * @return Zero on success, one on error and write the label
> + * in param label if the given address exists in the system.
> + * Label will be null terminated for sure, iff param label
NULL-terminated
> + * is chosen big enough(IF_NAMESIZE == 16).
The reference to IF_NAMESIZE does not really enlighten me..
sizeoflabel reads weird to me, like it was sizeof(label), but you forgot
the (), label_size looks more natural to me.
> @@ -1211,6 +1257,17 @@
>
> + /* find interface label for address and check if it is whitelisted or not */
> + if (is_add) {
> + char label[IF_NAMESIZE];
> + if (!hip_find_label_for_address(addr, label, sizeof(label)) &&
review needs-fixing
On Tue, Sep 13, 2011 at 12:20:34PM +0000, Christian Röller wrote: modules_ midauth modules_ midauth \ modules_ midauth modules_ midauth \
>
> === modified file 'Makefile.am'
> --- Makefile.am 2011-08-10 15:03:07 +0000
> +++ Makefile.am 2011-09-13 12:20:25 +0000
> @@ -71,11 +71,15 @@
> TESTS = test/check_firewall \
> test/check_lib_core \
> test/check_lib_tool \
> - test/check_
> + test/check_
> + test/check_lib_tool \
> + test/check_hipd
> check_PROGRAMS = test/check_firewall \
> test/check_lib_core \
> test/check_lib_tool \
> - test/check_
> + test/check_
> + test/check_lib_tool \
> + test/check_hipd
duplicate entries
alphabetical order
> @@ -207,6 +211,10 @@ hipd_SOURCES = test/check_hipd.c \ midauth/ hipd/midauth. c \ hipd_sources)
>
> +test_check_
> + test/hipd/netdev.c \
> + modules/
> + $(hipd_
Please align the '\' vertically, same as in the rest of the file.
> test_check_ firewall_ SOURCES = test/check_ firewall. c \
> test/mocks.c \
Like here for example :)
> --- hipd/netdev.c 2011-08-15 14:11:56 +0000 white_list[ HIP_NETDEV_ MAX_WHITE_ LIST]; white_list_ count = 0; whitelist_ entry { IF_NAMESIZE] ; whitelist_ entry hip_netdev_ white_list[ HIP_NETDEV_ MAX_WHITE_ LIST]; white_list_ count = 0; white_list_ add_index( int if_index) white_list_ add_index_ and_name( const unsigned int if_index,
> +++ hipd/netdev.c 2011-09-13 12:20:25 +0000
> @@ -90,54 +90,68 @@
>
> -static int hip_netdev_
> -static int hip_netdev_
> +struct hip_netdev_
> + unsigned int if_index;
> + char if_label[
> +};
> +static struct hip_netdev_
> +static unsigned int hip_netdev_
>
> -static void hip_netdev_
> +static void hip_netdev_
> + const char *const device_name)
These unnecessary double prefixes (hip_ and netdev_) for symbols not
visible outside of this file are annoying.
In a perfect world, you would do a quick search and replace on trunk and
merge that back into your branch, but I don't want to pile too much
extra work on you. However, if you have a minute and the motivation..
Maybe you could drop them for the new code, but feel free to ignore me.
> -static int hip_netdev_ is_in_white_ list(int if_index) is_in_white_ list(const unsigned int if_index,
> +static int hip_netdev_
> + const char *const device_name)
Oh look, this file only had a hip_ prefix - yay for consistency in HIPL,
even in the same file :)
> @@ -1120,6 +1133,44 @@
>
> /**
> + * 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.
> + * @param sizeoflabel Size of the passed label parameter, should be chosen big enough
> + * to be able to store every possible interface name plus null-termination.
extra whitespace
> + * @return Zero on success, one on error and write the label
> + * in param label if the given address exists in the system.
> + * Label will be null terminated for sure, iff param label
NULL-terminated
> + * is chosen big enough(IF_NAMESIZE == 16).
The reference to IF_NAMESIZE does not really enlighten me..
> + */ label_for_ address( const struct sockaddr *const addr,
> +int hip_find_
> + char *const label, unsigned int const sizeoflabel)
const unsigned int
sizeoflabel reads weird to me, like it was sizeof(label), but you forgot
the (), label_size looks more natural to me.
> @@ -1211,6 +1257,17 @@ label_for_ address( addr, label, sizeof(label)) &&
>
> + /* find interface label for address and check if it is whitelisted or not */
> + if (is_add) {
> + char label[IF_NAMESIZE];
> + if (!hip_find_
See, there we have 'sizeof(label)' :)
> --- hipd/netdev.h 2011-05-18 15:12:07 +0000 id_to_addr( const hip_hit_t *hit, const hip_lsi_t *lsi, label_for_ address( const struct sockaddr *const addr,
> +++ hipd/netdev.h 2011-09-13 12:20:25 +0000
> @@ -56,4 +56,7 @@
> int hip_map_
> struct in6_addr *addr);
>
> +int hip_find_
> + char *const label, unsigned int const sizeoflabel);
see above
> --- test/check_hipd.c 1970-01-01 00:00:00 +0000
> +++ test/check_hipd.c 2011-09-13 12:20:25 +0000
> @@ -0,0 +1,41 @@
> +/*
> + * Copyright (c) 2010 Aalto University and RWTH Aachen University.
Happy new year! Oh wait, it's almost autumn ;)
> --- test/hipd/netdev.c 1970-01-01 00:00:00 +0000
> +++ test/hipd/netdev.c 2011-09-13 12:20:25 +0000
> @@ -0,0 +1,89 @@
> +
> +#define _BSD_SOURCE
Is that required?
> +#include <check.h>
> +#include <stdlib.h>
> +
> +#include "hipd/netdev.h"
> +#include <ifaddrs.h>
> +#include <net/if.h>
> +#include "lib/core/debug.h"
> +#include "lib/core/prefix.h"
> +#include "test_suites.h"
Put system headers first, separate local headers with an empty line.
> --- test/hipd/ test_suites. h 1970-01-01 00:00:00 +0000 test_suites. h 2011-09-13 12:20:25 +0000
> +++ test/hipd/
> @@ -0,0 +1,34 @@
> +/*
> + * Copyright (c) 2010 Aalto University and RWTH Aachen University.
see above
> +#ifndef HIP_TEST_ HIPD_TEST_ SUITES_ H HIPD_TEST_ SUITES_ H HIPD_TEST_ SUITES_ H */
> +#define HIP_TEST_
> +
> +#include <check.h>
> +
> +Suite *hipd_netdev(void);
> +
> +
> +#endif /* HIP_TEST_
nit: extra empty line
> --- test/lib/ core/hostid. c 2011-09-05 08:46:53 +0000 core/hostid. c 2011-09-13 12:20:25 +0000 test_serialize_ deserialize_ rsa_keys)
> +++ test/lib/
> @@ -65,7 +65,7 @@
> START_TEST(
> {
> unsigned int i, keyrr_len = 0;
> - int bits[3] = {1024, 2048, 3072};
> + int bits[3] = { 1024, 2048, 3072 };
> RSA *key = NULL, *key_deserialized = NULL;
> EVP_PKEY *key_a = NULL, *key_b = NULL;
> unsigned char *keyrr;
unrelated
Feel free to commit such things to trunk right away, but please
leave them out of merge requests.
Diego