shithub: front

Download patch

ref: 75ac2674deab8ca70924b84462c62fa1a24b3518
parent: 520d698c3e9ec8f76923965481aa15862f9f3c81
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat Jul 27 20:32:14 EDT 2024

devip: do not raise error from ipoput*()

It seems some protocols are unprepared to
deal with ipoput*() raising an error
(thrown from ifc->m->bwrite()).

so catch it and return -1 (no route) instead.

--- a/sys/src/9/ip/ip.c
+++ b/sys/src/9/ip/ip.c
@@ -129,10 +129,13 @@
 	}
 	if(waserror()){
 		runlock(ifc);
-		nexterror();
+		/* bp is freed by m->bwrite() called from ipifcoput() */
+		return -1;
 	}
-	if(ifc->m == nil || ifc->ifcid != r->ifcid)
+	if(ifc->m == nil || ifc->ifcid != r->ifcid){
+		rv = -1;
 		goto raise;
+	}
 
 	medialen = ifc->maxtu - ifc->m->hsize;
 	if(gating != nil) {
--- a/sys/src/9/ip/ipv6.c
+++ b/sys/src/9/ip/ipv6.c
@@ -82,11 +82,14 @@
 	}
 	if(waserror()){
 		runlock(ifc);
-		nexterror();
+		/* bp is freed by m->bwrite() called from ipifcoput() */
+		return -1;
 	}
 
-	if(ifc->m == nil || r->ifcid != ifc->ifcid)
+	if(ifc->m == nil || r->ifcid != ifc->ifcid){
+		rv = -1;
 		goto raise;
+	}
 
 	medialen = ifc->maxtu - ifc->m->hsize;
 	if(gating != nil){
--