shithub: front

Download patch

ref: 69115adfe4050c7e0e88b26aea77d6dc829296d3
parent: 0c7888c9bad7cdb738e9377476ea5f0df58ce2e8
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Jun 1 09:24:32 EDT 2025

devip: make dial(2) work for /net/ipifc

Dial(2) was not working as just cloning /net/ipifc/clone
gets you an unbound interface, and adding an address
requires the ipifc to be bound.

To fix: just bind a pkt interface if not already bound.

--- a/sys/src/9/ip/ipifc.c
+++ b/sys/src/9/ip/ipifc.c
@@ -790,6 +790,12 @@
 		ipifcdellifc(ifc, &ifc->lifc);
 	wunlock(ifc);
 
+	/* when using dial(1), need to bind first */
+	if(ifc->m == nil){
+		char *a[2] = { "bind", "pkt" };
+		ipifcbind(c, a, 2);
+	}
+
 	err = ipifcadd(ifc, argv, argc, 0, nil);
 	if(err != nil)
 		return err;
--