diff options
| author | itojun <itojun@NetBSD.org> | 2003-12-10 11:46:33 +0000 |
|---|---|---|
| committer | itojun <itojun@NetBSD.org> | 2003-12-10 11:46:33 +0000 |
| commit | aa8a6718f04420c2621ccb75de2e2ffa08869d43 (patch) | |
| tree | ab7859a1335713e7d3ccdae75ffd898626724a57 /sys/netinet | |
| parent | fbae381aaa42360e3c45875f461e67347695bf0c (diff) | |
use if_indexlim (instead of if_index) and ifindex2ifnet[x] != NULL
to check if interface exists, as (1) if_index has different meaning
(2) ifindex2ifnet could become NULL when interface gets destroyed,
since when we have introduced dynamically-created interfaces. from kame
Diffstat (limited to 'sys/netinet')
| -rw-r--r-- | sys/netinet/ip_output.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 4a0921fac4e..c76cdfd89ff 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -1,4 +1,4 @@ -/* $NetBSD: ip_output.c,v 1.128 2003/11/19 18:39:34 jonathan Exp $ */ +/* $NetBSD: ip_output.c,v 1.129 2003/12/10 11:46:33 itojun Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -98,7 +98,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.128 2003/11/19 18:39:34 jonathan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.129 2003/12/10 11:46:33 itojun Exp $"); #include "opt_pfil_hooks.h" #include "opt_inet.h" @@ -1492,9 +1492,11 @@ ip_multicast_if(a, ifindexp) *ifindexp = 0; if (ntohl(a->s_addr) >> 24 == 0) { ifindex = ntohl(a->s_addr) & 0xffffff; - if (ifindex < 0 || if_index < ifindex) + if (ifindex < 0 || if_indexlim <= ifindex) return NULL; ifp = ifindex2ifnet[ifindex]; + if (!ifp) + return NULL; if (ifindexp) *ifindexp = ifindex; } else { |
