e = msg + bytes;
for (p = msg; p < e; p += rtm->rtm_msglen) {
rtm = (void *)p;
- if (rtm->rtm_type == RTM_MISS)
- continue;
- /* Ignore messages generated by us */
- if (rtm->rtm_pid == getpid()) {
- ctx->options &= ~DHCPCD_RTM_PPID;
- continue;
- }
- /* Ignore messages sent by the parent process after forking */
- if ((ctx->options & (DHCPCD_RTM_PPID | DHCPCD_DAEMONISED)) ==
- (DHCPCD_RTM_PPID | DHCPCD_DAEMONISED) &&
- rtm->rtm_pid == ctx->ppid)
- {
- /* If this is the last successful message sent clear
- * the check flag as it's possible another process could
- * re-use the same pid and also manipulate the kernel
- * routing table. */
- if (rtm->rtm_seq == ctx->pseq)
- ctx->options &= ~DHCPCD_RTM_PPID;
- continue;
- }
switch(rtm->rtm_type) {
#ifdef RTM_IFANNOUNCE
case RTM_IFANNOUNCE:
case RTM_ADD:
case RTM_CHANGE:
case RTM_DELETE:
+ /* Ignore messages generated by us */
+ if (rtm->rtm_pid == getpid()) {
+ ctx->options &= ~DHCPCD_RTM_PPID;
+ continue;
+ }
+ /* Ignore messages sent by the parent after forking */
+ if ((ctx->options &
+ (DHCPCD_RTM_PPID | DHCPCD_DAEMONISED)) ==
+ (DHCPCD_RTM_PPID | DHCPCD_DAEMONISED) &&
+ rtm->rtm_pid == ctx->ppid)
+ {
+ /* If this is the last successful message sent,
+ * clear the check flag as it's possible another
+ * process could re-use the same pid and also
+ * manipulate therouting table. */
+ if (rtm->rtm_seq == ctx->pseq)
+ ctx->options &= ~DHCPCD_RTM_PPID;
+ continue;
+ }
cp = (void *)(rtm + 1);
sa = (void *)cp;
switch (sa->sa_family) {
#endif
case RTM_DELADDR: /* FALLTHROUGH */
case RTM_NEWADDR:
+ /* XXX We have no way of knowing who generated these
+ * messages wich truely sucks because we want to
+ * avoid listening to our own delete messages. */
ifam = (void *)p;
ifp = if_findindex(ctx->ifaces, ifam->ifam_index);
if (ifp == NULL)