summaryrefslogtreecommitdiffstats
path: root/src/core/interface.c
diff options
context:
space:
mode:
authorMichael Brown2020-12-07 14:49:47 +0100
committerMichael Brown2020-12-07 14:50:24 +0100
commit09fe2bbd343a46010e89d848e5887bfb5fc3f6f6 (patch)
tree7d34c1b508c2cf63a3cc298bb2a2a595134fb243 /src/core/interface.c
parent[interface] Ignore any attempts to plug in the null interface (diff)
downloadipxe-09fe2bbd343a46010e89d848e5887bfb5fc3f6f6.tar.gz
ipxe-09fe2bbd343a46010e89d848e5887bfb5fc3f6f6.tar.xz
ipxe-09fe2bbd343a46010e89d848e5887bfb5fc3f6f6.zip
[interface] Provide intf_insert() to insert a filter interface
Generalise the filter interface insertion logic from block_translate() and expose as intf_insert(), allowing a filter interface to be inserted on any existing interface. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/core/interface.c')
-rw-r--r--src/core/interface.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/core/interface.c b/src/core/interface.c
index 05e7e4777..34a4180a5 100644
--- a/src/core/interface.c
+++ b/src/core/interface.c
@@ -391,6 +391,23 @@ void intfs_restart ( int rc, ... ) {
}
/**
+ * Insert a filter interface
+ *
+ * @v intf Object interface
+ * @v upper Upper end of filter
+ * @v lower Lower end of filter
+ */
+void intf_insert ( struct interface *intf, struct interface *upper,
+ struct interface *lower ) {
+ struct interface *dest = intf->dest;
+
+ intf_get ( dest );
+ intf_plug_plug ( intf, upper );
+ intf_plug_plug ( lower, dest );
+ intf_put ( dest );
+}
+
+/**
* Poke an object interface
*
* @v intf Object interface