On 2009/09/29 22:38, Laurent CARON wrote: > On 29/09/2009 00:33, Stuart Henderson wrote: > >The only change to ifstated between 4.4 and 4.5 was a minor change > >to the config parser. (there was another change after 4.5, so if 4.5 > >works for someone but -current doesn't, they can try reverting it). > > > > Hi, > > Here is what i temporarily did in the config file to circumvent the "bug" > > carp_up = '( "ifconfig carp0 | grep -q MASTER" every 10)' > carp_down = '( "ifconfig carp0 | grep -q BACKUP" every 10)' > > > It is not really state of the art, nor clean...but works.
yep, using ifconfig like that isn't really very clean - does this help at all? Index: ifstated.c =================================================================== RCS file: /cvs/src/usr.sbin/ifstated/ifstated.c,v retrieving revision 1.35 diff -u -p -r1.35 ifstated.c --- ifstated.c 25 Jun 2009 17:14:57 -0000 1.35 +++ ifstated.c 29 Sep 2009 20:53:37 -0000 @@ -219,6 +219,7 @@ void rt_msg_handler(int fd, short event, void *arg) { char msg[2048]; + char *next, *lim; struct rt_msghdr *rtm = (struct rt_msghdr *)&msg; struct if_msghdr ifm; int len; @@ -229,14 +230,18 @@ rt_msg_handler(int fd, short event, void if (len < sizeof(struct rt_msghdr)) return; - if (rtm->rtm_version != RTM_VERSION) - return; + lim = (char *)&msg + len; + for (next = (char *)&msg; next < lim; next += rtm->rtm_msglen) { + rtm = (struct rt_msghdr *)next; + if (rtm->rtm_version != RTM_VERSION) + continue; - if (rtm->rtm_type != RTM_IFINFO) - return; + if (rtm->rtm_type != RTM_IFINFO) + continue; - memcpy(&ifm, rtm, sizeof(ifm)); - scan_ifstate(ifm.ifm_index, ifm.ifm_data.ifi_link_state, 1); + memcpy(&ifm, rtm, sizeof(ifm)); + scan_ifstate(ifm.ifm_index, ifm.ifm_data.ifi_link_state, 1); + } } void