RUNNING flag remains unset upon reinserting a gre into VNET jail

John W. O'Brien john at saltant.com
Sat May 9 15:31:23 UTC 2020


On 2020/05/07 03:27, Andrey V. Elsukov wrote:
> On 06.05.2020 10:00, Andrey V. Elsukov wrote:
>>> # create a gre outside the jail, configure its tunnel endpoints
>>>
>>> ifconfig gre0 create tunnel 10.1.1.1 10.2.2.2
>>> ifconfig gre0  # not RUNNING (OK)
>>>
>>> # place the gre into the jail, it should be running now
>>>
>>> ifconfig gre0 vnet demo
>>> jexec demo ifconfig gre0  # not RUNNING (not OK)
>>
>> Hi,
>>
>> I'm not an advanced jail user, so this is my conclusion from a quick
>> code look. It looks to me that all IPv4/IPv6 addresses should be purged
>> from the interface that was moved from one vnet to another. The fact
>> that tunnel's config still here is due to it is stored in the private
>> interface's softc. Thus when you move ifnet from one vnet to another,
>> ifaddr_event_ext is not handled properly and interface doesn't change
>> its state.
>>
>> If my conclusion is correct, I see two ways to fix this:
>>   1. Add if_reassign() method to all tunneling interfaces and clear
>> tunnel config when ifnet is moved to new jail. This will force you
>> reconfigure interface after moving. Probably this is POLA violation.
> 
> Hi,
> 
> I think this patch should help:
> 	https://people.freebsd.org/~ae/gre.diff
> 
> It is untested, if you have time please, test and report back.
> The patch will clear tunnel config after moving from one vnet to
> another. Thus you need to reconfigure all addresses.

Looks good.

root at freebsd:~ # uname -a
FreeBSD freebsd 13.0-CURRENT FreeBSD 13.0-CURRENT #1 r360848M: Sat May
9 15:23:00 UTC 2020
root at freebsd:/usr/obj/usr/src/amd64.amd64/sys/GENERIC  amd64
root at freebsd:~ # jail -c name=demo vnet persist
root at freebsd:~ # ifconfig ena1 vnet demo
root at freebsd:~ # ifconfig gre0 create tunnel 10.1.1.1 10.2.2.2
root at freebsd:~ # ifconfig gre0 vnet demo
root at freebsd:~ # jexec demo ifconfig gre0
gre0: flags=8010<POINTOPOINT,MULTICAST> metric 0 mtu 1476
	options=80000<LINKSTATE>
	groups: gre
	nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
root at freebsd:~ # jexec demo ifconfig gre0 tunnel 10.1.1.1 10.2.2.2
root at freebsd:~ # jexec demo ifconfig ena1 inet 10.1.1.1
root at freebsd:~ # jexec demo ifconfig gre0
gre0: flags=8050<POINTOPOINT,RUNNING,MULTICAST> metric 0 mtu 1476
	options=80000<LINKSTATE>
	tunnel inet 10.1.1.1 --> 10.2.2.2
	groups: gre
	nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
root at freebsd:~ # ifconfig gre0 -vnet demo
root at freebsd:~ # ifconfig gre0
gre0: flags=8011<UP,POINTOPOINT,MULTICAST> metric 0 mtu 1476
	options=80000<LINKSTATE>
	inet6 fe80::1427:e888:767c:dce1%gre0 prefixlen 64 tentative scopeid 0x2
	nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>

-- 
John W. O'Brien
OpenPGP keys:
    0x33C4D64B895DBF3B

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-net/attachments/20200509/4f731616/attachment.sig>


More information about the freebsd-net mailing list