On Thu, Aug 10 2017, Florian Obser <flor...@openbsd.org> wrote:
> On Tue, Aug 08, 2017 at 11:08:14AM +0200, Jeremie Courreges-Anglas wrote:
>> 
>> So rtadvd has this complex code that tries to parse multiple routing
>> messages, when it actually reads only one message at a time from the
>> routing socket.  The diff below attempts to acknowledge this and tries
>> to be as mechanical as possible, variable renaming/gc'ing can happen
>> later.  Better use cvs diff -b to review this diff.
>> 
>> Thoughts?  ok?
>
> I like the get_next_msg -> validate_msg part.
>
> I'm not sure about rtsock_cb, I think we have to deal with getting
> multiple messages. slaacd has idiomatic code for that, forgot where
> I stole that from. (route_receive in frontend.c).

When I first asked why rtadvd contained that code, (iirc) Claudio
pointed out that route(4) sockets use PR_ATOMIC, thus you can only get
a single message per read(2) call.  Handling multiple messages makes
sense when you're parsing a dump you got from the kernel (ioctl,
sysctl...).

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply via email to