bsdpot/pot

Accommodate IPv4 netmask or IPv6 prefix length for pots that use alias networking and explicit addresses

tnalpgge opened this issue · 0 comments

Is your feature request related to a problem? Please describe.
I am trying to use jails to make a few services appear on the local house network without any more middleboxes or layers of NAT or routing or any of that other stuff. Essentially, assigning IP addresses to services that happen to all be running on the same physical hardware.

Describe the feature you'd like to have
According to the jail(8) manual page, one may provide a netmask as part of the ip4.addr parameter, or a prefix length as part of the ip6.addr parameter. When I try to use the alias network type, I get netmask of 32 bits (IPv4) or prefix length of 128 bits (IPv6) if I only specify the addresses without netmask/prefix length. The pot scripts do not seem to anticipate this and reject attempts to add the netmask or prefix length in the accepted notation, claiming that the supplied address is invalid.

Or in code, I want to do this...assuming that my house network is IPv4-wise 192.0.2.0/24 (TEST-NET-1 from RFC5737) and IPv6-wise 2001:db8:c000:200::/64 (from RFC3849).

pot create -p zark -t single -b 13.2 -N alias \
    -i 2001:db8:c000:200:6c61:6169:3673:a/64 \
    -i 2001:db8:c000:200:6c61:6169:3673:b \
    -i 192.0.2.195/24 \
    -i 192.0.2.196
pot start -p zark

And have it all work out so that all four specified addresses are added as alias to my primary ethernet interface em0, but the two without explicit netmask/prefix work exactly as they do now: the implied netmask/prefix is the entire length of the address.

$ ifconfig em0
em0: flags=8863<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=481249b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,LRO,WOL_MAGIC,VLAN_HWFILTER,NOMAP>
        ether e0:4f:43:24:15:fd
        inet 192.0.2.252 netmask 0xffffff00 broadcast 192.0.2.255
        inet 192.0.2.195 netmask 0xffffff00 broadcast 192.0.2.255
        inet 192.0.2.196 netmask 0xffffffff broadcast 192.0.2.196
        inet6 fe80::e24f:43ff:fe24:15fd%em0 prefixlen 64 scopeid 0x1
        inet6 2001:db8:c000:200:e24f:43ff:fe24:15fd prefixlen 64 autoconf
        inet6 2001:db8:c000:200:6c61:6169:3673:a prefixlen 64
        inet6 2001:db8:c000:200:6c61:6169:3673:b prefixlen 128
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
        nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>

Describe potential alternatives or workaround you've considered (if any)
I believe I can implement the feature entirely in shell script, and a pull request may be forthcoming.

I've been looking at several jail management frameworks recently to see which one suits me best, and pot seems to be the front runner, again! 😄