Skip to content

Comments

Add --ip and --port flags for remote connections#480

Open
ballle98 wants to merge 1 commit intoDMTF:mainfrom
ballle98:feature/add-ip-port-flags
Open

Add --ip and --port flags for remote connections#480
ballle98 wants to merge 1 commit intoDMTF:mainfrom
ballle98:feature/add-ip-port-flags

Conversation

@ballle98
Copy link

Feature Request

Add command-line flags to enable spdm-emu to connect to SPDM bridges on remote machines.

Problem

Currently spdm-emu hardcodes connections to localhost:2323, making it impossible to test SPDM bridges running on remote hosts or different machines.

Proposed Solution

Add two new flags:

  • --ip <ip_address> - Specify remote bridge IP address
  • --port <port_number> - Specify custom port number

Use Case

  • port 2323 falls within the 2280-2379 Hyper-V/WSL2 reserves port range
  • Development workflows where SPDM responder runs on separate hardware

Backward Compatibility

Maintain current defaults (localhost:2323) when flags are not provided.

@steven-bellock
Copy link
Contributor

@ballle98 please squash the three commits into one.

@p-b-o it looks like this is implementing request 1 from #467.

- Add --ip flag to specify remote bridge IP address
- Add --port flag to specify custom port number
- Update init_client() to use configurable IP/port with inet_pton for Windows
- Add IP address validation and conversion
- Update usage documentation for both spdm_requester_emu and spdm_device_validator_sample
- Support both MCTP and TCP transports with custom ports
- Fix Windows MSVC build by replacing deprecated inet_addr with inet_pton
- Enable spdm_device_validator_sample to connect to remote bridges

This enables spdm-emu tools to connect to bridges running on remote machines,
useful for testing SPDM implementations across different hosts while maintaining
backward compatibility with default localhost:2323 connections.

Signed-off-by: Lee Ballard <lee.ballard@dell.com>
@ballle98 ballle98 force-pushed the feature/add-ip-port-flags branch from 5787482 to 51661a4 Compare February 20, 2026 22:48
@p-b-o
Copy link

p-b-o commented Feb 21, 2026

@steven-bellock Indeed, that's great!
@ballle98 Would that be possible for you to add support for spdm_responder_emu also?
And spdm_emu/spdm_device_attester_sample/spdm_device_attester_sample.c while at it.

--- a/spdm_emu/spdm_responder_emu/spdm_responder_emu.c
+++ b/spdm_emu/spdm_responder_emu/spdm_responder_emu.c
@@ -276,11 +276,14 @@ int main(int argc, char *argv[])
     }

     if (m_use_transport_layer == SOCKET_TRANSPORT_TYPE_TCP) {
-        /* The IANA has assigned port number 4194 for SPDM */
-        result = platform_server_routine(TCP_SPDM_PLATFORM_PORT);
+        /* Use custom port if specified, otherwise default to 4194 for TCP */
+        uint16_t port = (m_custom_port != 0) ? m_custom_port : TCP_SPDM_PLATFORM_PORT;
+        result = platform_server_routine(port);
     }
     else {
-        result = platform_server_routine(DEFAULT_SPDM_PLATFORM_PORT);
+        /* Use custom port if specified, otherwise default to 2323 for other transports */
+        uint16_t port = (m_custom_port != 0) ? m_custom_port : DEFAULT_SPDM_PLATFORM_PORT;
+        result = platform_server_routine(port);
     }

With this, I've been able to change port and it's working as expected.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants