Here is a patch I wrote to the Microsoft/IBM TPM 2.0 Simulator on SourceForge:

https://gist.github.com/dantpm/a15fa70e94b28dee96a77c9d1bb70387

 

It makes the simulator “dual stack”—it listens to both IPv4 and IPv6 connection requests and tries to connect to a series of IP addresses (instead of the common method of only trying the first address returned in a hostname lookup).

 

I also submitted this patch as issue #6 to the TPM 2.0 Simulator SourceForge project:

https://sourceforge.net/p/ibmswtpm2/tickets/6/

 

The patch may look weird because the original source uses a mixture of spaces and 4-character tabs (which may expand to 8 characters, depending on how you view it). The source also has a mixture of coding styles.

 

Dan