Add missing error checks on rtcache_setdst
It can fail with ENOMEM.
This commit is contained in:
parent
82e3865891
commit
5f21075b8f
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ip_output.c,v 1.237 2015/04/24 00:48:47 ozaki-r Exp $ */
|
||||
/* $NetBSD: ip_output.c,v 1.238 2015/04/27 10:14:44 ozaki-r 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.237 2015/04/24 00:48:47 ozaki-r Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.238 2015/04/27 10:14:44 ozaki-r Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "opt_ipsec.h"
|
||||
|
@ -246,7 +246,9 @@ ip_output(struct mbuf *m0, ...)
|
|||
if ((rt = rtcache_validate(ro)) == NULL &&
|
||||
(rt = rtcache_update(ro, 1)) == NULL) {
|
||||
dst = &u.dst4;
|
||||
rtcache_setdst(ro, &u.dst);
|
||||
error = rtcache_setdst(ro, &u.dst);
|
||||
if (error != 0)
|
||||
goto bad;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1416,7 +1418,9 @@ ip_get_membership(const struct sockopt *sopt, struct ifnet **ifp,
|
|||
memset(&ro, 0, sizeof(ro));
|
||||
|
||||
sockaddr_in_init(&u.dst4, ia, 0);
|
||||
rtcache_setdst(&ro, &u.dst);
|
||||
error = rtcache_setdst(&ro, &u.dst);
|
||||
if (error != 0)
|
||||
return error;
|
||||
*ifp = (rt = rtcache_init(&ro)) != NULL ? rt->rt_ifp : NULL;
|
||||
rtcache_free(&ro);
|
||||
} else {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: in6_pcb.c,v 1.138 2015/04/27 02:59:44 ozaki-r Exp $ */
|
||||
/* $NetBSD: in6_pcb.c,v 1.139 2015/04/27 10:14:44 ozaki-r Exp $ */
|
||||
/* $KAME: in6_pcb.c,v 1.84 2001/02/08 18:02:08 itojun Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -62,7 +62,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.138 2015/04/27 02:59:44 ozaki-r Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.139 2015/04/27 10:14:44 ozaki-r Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "opt_ipsec.h"
|
||||
|
@ -1100,7 +1100,8 @@ in6_pcbrtentry(struct in6pcb *in6p)
|
|||
addr.s_addr = in6p->in6p_faddr.s6_addr32[3];
|
||||
|
||||
sockaddr_in_init(&u.dst4, &addr, 0);
|
||||
rtcache_setdst(ro, &u.dst);
|
||||
if (rtcache_setdst(ro, &u.dst) != 0)
|
||||
return NULL;
|
||||
|
||||
rt = rtcache_init(ro);
|
||||
} else
|
||||
|
@ -1112,7 +1113,8 @@ in6_pcbrtentry(struct in6pcb *in6p)
|
|||
} u;
|
||||
|
||||
sockaddr_in6_init(&u.dst6, &in6p->in6p_faddr, 0, 0, 0);
|
||||
rtcache_setdst(ro, &u.dst);
|
||||
if (rtcache_setdst(ro, &u.dst) != 0)
|
||||
return NULL;
|
||||
|
||||
rt = rtcache_init(ro);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ip6_output.c,v 1.164 2015/04/24 08:53:06 ozaki-r Exp $ */
|
||||
/* $NetBSD: ip6_output.c,v 1.165 2015/04/27 10:14:44 ozaki-r Exp $ */
|
||||
/* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -62,7 +62,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.164 2015/04/24 08:53:06 ozaki-r Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.165 2015/04/27 10:14:44 ozaki-r Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "opt_inet6.h"
|
||||
|
@ -2333,7 +2333,9 @@ ip6_get_membership(const struct sockopt *sopt, struct ifnet **ifp, void *v,
|
|||
sockaddr_in_init(&u.dst4, ia4, 0);
|
||||
else
|
||||
sockaddr_in6_init(&u.dst6, ia, 0, 0, 0);
|
||||
rtcache_setdst(&ro, &u.dst);
|
||||
error = rtcache_setdst(&ro, &u.dst);
|
||||
if (error != 0)
|
||||
return error;
|
||||
*ifp = (rt = rtcache_init(&ro)) != NULL ? rt->rt_ifp : NULL;
|
||||
rtcache_free(&ro);
|
||||
} else {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: nd6_nbr.c,v 1.107 2015/03/30 04:25:26 ozaki-r Exp $ */
|
||||
/* $NetBSD: nd6_nbr.c,v 1.108 2015/04/27 10:14:44 ozaki-r Exp $ */
|
||||
/* $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.107 2015/03/30 04:25:26 ozaki-r Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.108 2015/04/27 10:14:44 ozaki-r Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
|
||||
|
@ -927,7 +927,8 @@ nd6_na_output(
|
|||
ip6->ip6_dst = daddr6;
|
||||
sockaddr_in6_init(&u.dst6, &daddr6, 0, 0, 0);
|
||||
dst = &u.dst;
|
||||
rtcache_setdst(&ro, dst);
|
||||
if (rtcache_setdst(&ro, dst) != 0)
|
||||
goto bad;
|
||||
|
||||
/*
|
||||
* Select a source whose scope is the same as that of the dest.
|
||||
|
|
Loading…
Reference in New Issue