ipflow suffers same problem as described in FreeBSD-PR: kern/10778
Though the time of mis-routing will not be "arbitrarily long time"
for intermittent packet flow (thanks to the ipflow timeout), it
still could be quite long for a constant packet flow.
#include <netinet/in.h>
#include <netinet/in_var.h>
#include <netinet/ip_var.h>
+#include <netinet/ip_flow.h>
#define RTPRF_EXPIRING RTF_PROTO3 /* set on routes we manage */
}
}
}
+
+ /*
+ * If the new route has been created successfully, and it is
+ * not a multicast/broadcast or cloned route, then we will
+ * have to flush the ipflow. Otherwise, we may end up using
+ * the wrong route.
+ */
+ if (ret != NULL &&
+ (rt->rt_flags &
+ (RTF_MULTICAST | RTF_BROADCAST | RTF_WASCLONED)) == 0)
+ ipflow_flush_oncpu();
return ret;
}
IPFLOW_INSERT(&ipflowtable[hash], ipf);
}
+void
+ipflow_flush_oncpu(void)
+{
+ struct ipflow *ipf;
+
+ while ((ipf = LIST_FIRST(&ipflowlist)) != NULL) {
+ IPFLOW_REMOVE(ipf);
+ IPFLOW_FREE(ipf);
+ }
+}
+
static void
ipflow_init(void)
{
int ipflow_fastforward(struct mbuf *);
void ipflow_create(const struct route *, struct mbuf *);
void ipflow_slowtimo(void);
+void ipflow_flush_oncpu(void);
#endif /* _KERNEL */