From 1cc58965b647e38c931e196a712f0719af3888fb Mon Sep 17 00:00:00 2001 From: itojun Date: Tue, 8 Jan 2002 10:05:13 +0000 Subject: [PATCH] don't panic when there's no interface address exist for the specified multicast outgoing interface (ia == NULL after IFP_TO_IA). historic behavior (up to revision 1.43) was to use 0.0.0.0 as source address, but it seems like a mistake according to RFC1112/1122. --- sys/netinet/ip_output.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index ba0a2e4a5788..274cb8f984b0 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -1,4 +1,4 @@ -/* $NetBSD: ip_output.c,v 1.90 2001/11/21 06:28:08 itojun Exp $ */ +/* $NetBSD: ip_output.c,v 1.91 2002/01/08 10:05:13 itojun Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -102,7 +102,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.90 2001/11/21 06:28:08 itojun Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.91 2002/01/08 10:05:13 itojun Exp $"); #include "opt_pfil_hooks.h" #include "opt_ipsec.h" @@ -317,6 +317,10 @@ ip_output(m0, va_alist) struct in_ifaddr *ia; IFP_TO_IA(ifp, ia); + if (!ia) { + error = EADDRNOTAVAIL; + goto bad; + } ip->ip_src = ia->ia_addr.sin_addr; }