churchers / vm-bhyve

Shell based, minimal dependency bhyve manager
BSD 2-Clause "Simplified" License
825 stars 174 forks source link

support ipv6 gateway on cloud init VMs #507

Open moracca opened 1 year ago

moracca commented 1 year ago

currently the network-config written for cloud init VMs is assuming that the gateway IP will be ipv4.

This commit simply checks if the IP contains a : and changes to using gateway6 key in the network-config in this case

I am not certain if there are other places that might break IPv6 usage, but this was one place that seemed like an easy fix.

ke5C2Fin commented 1 year ago

Does this work for you? lib/vm-core is #!/bin/sh and you can't use [[ ]] in /bin/sh, nor can use glob or regex * in [ ]. Maybe change your if line to if echo $_network_config_ipaddress | grep -sqF :; then?

moracca commented 1 year ago

Yes that should work fine. I've made that change. thanks!