summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorMichael Brown2023-07-04 17:50:03 +0200
committerMichael Brown2023-07-04 17:54:39 +0200
commitb5b60ea33dc48a297515f95ac19cca20bb39edd1 (patch)
treed8eef92727b7ec1af273ddcbe6cae2a462ea949a /src/core
parent[build] Inhibit more linker warnings about an implied executable stack (diff)
downloadipxe-b5b60ea33dc48a297515f95ac19cca20bb39edd1.tar.gz
ipxe-b5b60ea33dc48a297515f95ac19cca20bb39edd1.tar.xz
ipxe-b5b60ea33dc48a297515f95ac19cca20bb39edd1.zip
[interface] Fix debug message values for temporary interfaces
The interface debug message values constructed by INTF_DBG() et al rely on the interface being embedded within a containing object. This assumption is not valid for the temporary outbound-only interfaces constructed on the stack by intf_shutdown() and xfer_vredirect(). Formalise the notion of a temporary outbound-only interface as having a NULL interface descriptor, and overload the "original interface descriptor" field to contain a pointer to the original interface that the temporary interface is shadowing. Originally-fixed-by: Vincent Fazio <vfazio@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/interface.c1
-rw-r--r--src/core/xfer.c3
2 files changed, 3 insertions, 1 deletions
diff --git a/src/core/interface.c b/src/core/interface.c
index 34a4180a5..ea0606893 100644
--- a/src/core/interface.c
+++ b/src/core/interface.c
@@ -285,6 +285,7 @@ void intf_shutdown ( struct interface *intf, int rc ) {
intf_nullify ( intf );
/* Transfer destination to temporary interface */
+ intf_temp_init ( &tmp, intf );
tmp.dest = intf->dest;
intf->dest = &null_intf;
diff --git a/src/core/xfer.c b/src/core/xfer.c
index 0faf3292a..269359e15 100644
--- a/src/core/xfer.c
+++ b/src/core/xfer.c
@@ -60,7 +60,7 @@ static struct xfer_metadata dummy_metadata;
* @ret rc Return status code
*/
int xfer_vredirect ( struct interface *intf, int type, va_list args ) {
- struct interface tmp = INTF_INIT ( null_intf_desc );
+ struct interface tmp;
struct interface *dest;
xfer_vredirect_TYPE ( void * ) *op =
intf_get_dest_op_no_passthru ( intf, xfer_vredirect, &dest );
@@ -85,6 +85,7 @@ int xfer_vredirect ( struct interface *intf, int type, va_list args ) {
* If redirection fails, then send intf_close() to the
* parent interface.
*/
+ intf_temp_init ( &tmp, intf );
intf_plug ( &tmp, dest );
rc = xfer_vreopen ( dest, type, args );
if ( rc == 0 ) {