[Babel-users] OpenBSD porting efforts

Juliusz Chroboczek Juliusz.Chroboczek at pps.jussieu.fr
Mon May 17 20:43:06 UTC 2010


> here is the result of my efforts to port babel on OpenBSD.

Excellent!

Grégoire, opinions?

Could you please reindent all of your code?  4 spaces per indentation,
no hard tabs.

Please add yourself to the copyright header at the beginning of
kernel_socket.c.

> I still have a problem with the linux node that does not seem to
> receive the hello

There's a bug in your fourth patch (see below), which should break
redistribution of local addresses; however, it shouldn't have this
effect.

Why don't you drop at my office at some point, either tomorrow or
on thursday, and we'll try to debug this.

> -    rfd = open("/dev/urandom", O_RDONLY);
> +    rfd = open(RND_DEV, O_RDONLY);

I suggest encapsulating this within a function

    int read_random_bytes(void *buf, size_t len)

> +#error "don't know which random device to use"

Em, no.  Just return -1 with errno = ENOSYS in this case, and the code
in babeld.c will do The Right Thing (print a warning and go on without
reseeding the RNG).

> -#ifndef __APPLE__
> +#ifdef __linux
>      } else if(proto == RTPROT_BOOT) {
>          return 0;
>  #endif

#ifdef RTPROT_BOOT ?

> +            kernel_socket = socket(PF_ROUTE, SOCK_RAW, AF_UNSPEC);

Eh?  Never heard of such a beast.

>      struct sockaddr_in6 *sin6;

> +    struct sockaddr_in *sin4;

My usual convention is to use sin for sockaddr_in, and sin6 for
sockaddr_in6.

> -        if(ifap->ifa_name == NULL || strcmp(ifap->ifa_name, ifname) != 0)
> +        if(ifap->ifa_name == NULL || ifname == NULL || strcmp(ifap->ifa_name, ifname) != 0)

Er, no.  This should be

  if(ap->ifa_name == NULL || (ifname != NULL && strcmp(...) != 0))

By the way, what does it mean for ap->ifa_name to be NULL?

> +    else if (0 <= old_forwarding)

old_forwarding >= 0 ?

> +	if(errno == ENOMEM)
...
> +	if(errno == ENOMEM)

Why is ENOMEM special?

--jch



More information about the Babel-users mailing list