git: 9front

Download patch

ref: 17cb4e87991576b11c1a924bde3ec2a8314f8dc6
parent: e6f1e67cf3c09f19b622e7789dd2250092062bec
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){
--