Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet It's possible we could not have any ready addres...



details:   https://anonhg.NetBSD.org/src/rev/db344d27f61a
branches:  trunk
changeset: 808925:db344d27f61a
user:      roy <roy%NetBSD.org@localhost>
date:      Mon Jun 08 08:02:43 2015 +0000

description:
It's possible we could not have any ready addresses.

diffstat:

 sys/netinet/ip_output.c |  15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diffs (44 lines):

diff -r 97b24f4fa326 -r db344d27f61a sys/netinet/ip_output.c
--- a/sys/netinet/ip_output.c   Mon Jun 08 07:59:54 2015 +0000
+++ b/sys/netinet/ip_output.c   Mon Jun 08 08:02:43 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_output.c,v 1.239 2015/06/04 09:20:00 ozaki-r Exp $  */
+/*     $NetBSD: ip_output.c,v 1.240 2015/06/08 08:02:43 roy Exp $      */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.239 2015/06/04 09:20:00 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.240 2015/06/08 08:02:43 roy Exp $");
 
 #include "opt_inet.h"
 #include "opt_ipsec.h"
@@ -503,6 +503,10 @@
                        xifa = &xia->ia_ifa;
                        if (xifa->ifa_getifa != NULL) {
                                xia = ifatoia((*xifa->ifa_getifa)(xifa, rdst));
+                               if (xia == NULL) {
+                                       errno = EADDRNOTAVAIL;
+                                       goto bad;
+                               }
                        }
                        ip->ip_src = xia->ia_addr.sin_addr;
                }
@@ -563,8 +567,13 @@
                struct ifaddr *xifa;
 
                xifa = &ia->ia_ifa;
-               if (xifa->ifa_getifa != NULL)
+               if (xifa->ifa_getifa != NULL) {
                        ia = ifatoia((*xifa->ifa_getifa)(xifa, rdst));
+                       if (ia == NULL) {
+                               error = EADDRNOTAVAIL;
+                               goto bad;
+                       }
+               }
                ip->ip_src = ia->ia_addr.sin_addr;
        }
 



Home | Main Index | Thread Index | Old Index