arp-v2 (void *)-1 "hack"

Bjoern A. Zeeb bzeeb-lists at lists.zabbadoz.net
Sun Dec 28 23:25:08 UTC 2008


Hi,

Cc:ing freebsd-net as I came across the (void *)-1 "hack" 1.5 weeks
ago while debugging some problems with others and they might be
interested as well.

I was sure I hadn't seen that hack in patches posted before.

I spent some time today and looked a bit more into it (also comitted
the LLE_IS_VALID() check).

In short: I don't like it and I don't understand why a new API needs a
hack already that is passed down through two functions into the code.
It was introduced the last days before the commit. I found r186010 and
r186027 in SVN but that's just two of the 4 places.

I think the proper behavior would be to either return an "errno" or
the lle via an additional argument and the other as return value. As
the lle is the return value already I would say adding an extra
argument 'int *error' will be easier.

For now this seems to only affect LLE_DELETE cases but I am not sure
all (especially wrt to the future of v6) has been shaken out yet and
returning a proper error code (possibly along with the NULL lle) would
make this more flexible.
I am also not sure if all the "void" callers on delete are right but
I got distracted by a "dead" function in one of the callpaths while
investigating.

What do you think wrt to adding the (possibly optional) int *error and 
returning the errno rather than a (void *)-1?  If you'd be ok, I'd can
prepare the patch. I'd rather break the API now than in a few months.

/bz

-- 
Bjoern A. Zeeb                      The greatest risk is not taking one.


More information about the freebsd-net mailing list