diff options
Diffstat (limited to 'sys/netinet/in_rmx.c')
-rw-r--r-- | sys/netinet/in_rmx.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sys/netinet/in_rmx.c b/sys/netinet/in_rmx.c index 51a5846..16ea5be 100644 --- a/sys/netinet/in_rmx.c +++ b/sys/netinet/in_rmx.c @@ -54,6 +54,7 @@ #include <net/route.h> #include <netinet/in.h> #include <netinet/in_var.h> +#include <netinet/ip_var.h> extern int in_inithead __P((void **head, int off)); @@ -137,6 +138,17 @@ in_addroute(void *v_arg, void *n_arg, struct radix_node_head *head, RTFREE(rt2); } } + + /* + * If the new route created successfully, and we are forwarding, + * and there is a cached route, free it. Otherwise, we may end + * up using the wrong route. + */ + if (ret != NULL && ipforwarding && ipforward_rt.ro_rt) { + RTFREE(ipforward_rt.ro_rt); + ipforward_rt.ro_rt = 0; + } + return ret; } |