On Wed, May 26, 2021 at 6:57 AM Daniel P. Berrangé wrote: > On Tue, May 25, 2021 at 12:37:21PM -0700, Doug Evans wrote: > > Hi. > > > > I want to confirm the command line syntax y'all want for ipv6 host > > forwarding. > > > > IIUC, the command line syntax is required to be consistent with the use > of > > "ipv6=on|off" elsewhere. > > Can you confirm that's correct? > > > > If so, how does one apply "ipv6=on" to the "::60022-:22" hostfwd spec in > > the following example: > > > > $ qemu-system-x86_64 [...] --nic > user,id=n1,model=e1000,hostfwd=::60022-:22 > > > > ? > > Probably easier if we start from the HMP hostfwd_add command which takes > > hostfwd_add ::60022-:22 > > With that, adding the flags is obvious > > hostfwd_add ::60022-:22,ipv6=on|off,ipv4=on|off > Data point: There's been discussion of supporting ipv6->ipv4 and ipv4->ipv6. If we want to provide for this then the ipv4/6 flags need to apply to the host/guess address. E.g., hostfwd_add ::60022,ipv6=on-:22,ipv4=on [for ipv6->ipv4] > IIUC, that can be handled in the slirp_hostfwd() method impl. > > The question is then how this works on the CLI. IIUC ,the "hostfwd=XXX" > ARG value is passed to slirp_hostfwd() eventually, so the change for > the HMP parsing will "just work". > > The complication is that the comma is ambiguous between the --net arg > parsing, and the hostfwd parsing. So you would end up having to escape > the commas (ie replace , with ,,): > > --nic user,id=n1,model=e1000,hostfwd=::60022-:22,,ipv6=on,,ipv4=on > > If you forget to escape the commas, then the flag ends up applying > to the --nic instead, where ipv4/ipv6 are indeed value for other > reasons. > > This kind of sucks, but that's where we are with the old fashioned > design of --nic parsing > > > Not sure if someone else has better ideas here ? > >