Re: ng_socket refcount bug?

Kristof Provost <[email protected]> Fri, 19 Jun 2026 16:32:55 -0400
Newsgroups gmane.os.freebsd.devel.net
Message-ID <[email protected]>
On 19 Jun 2026, at 16:15, Kristof Provost wrote:
> Hi,
>
> I pretty consistently see a panic running if_pppoe tests.
> These tests use `/usr/libexec/pppoed -l pppoe-pap epair0b` (or 
> similar) to be a PPPoE server in one vnet (so that I can test if_pppoe 
> in another vnet).
>
> Unfortunately I can’t share the if_pppoe module required to run 
> them.
>
I did manage to build a test case that doesn’t need if_pppoe (but does 
need mpd5):

	atf_test_case "noifpppoe" "cleanup"
	noifpppoe_head()
	{
		atf_set descr 'Test netgraph'
		atf_set require.user root
	}

	noifpppoe_body()
	{
		if ! kldstat -q -m ng_tee -m ng_mppc -m ng_ppp -m ng_iface -m ng_pppoe 
-m ng_socket -m ng_ether; then
			atf_skip "This test requires ng_tee, ng_mppc, ng_ppp, ng_iface, 
ng_pppoe, ng_socket and ng_ether"
		fi

		epair=$(vnet_mkepair)

		export PPP_CONFDIR=$(atf_get_srcdir)

		vnet_mkjail srv ${epair}b
		jexec srv ifconfig ${epair}b up
		jexec srv ifconfig lo0 198.51.0.1/24 up
		jexec srv /usr/libexec/pppoed -l pppoe-pap ${epair}b

		vnet_mkjail alcatraz ${epair}a
		jexec alcatraz ifconfig ${epair}a up

		jexec alcatraz /usr/local/sbin/mpd5 -f /home/kp/mpd5.conf -s ppp 
pppoeclient &
		sleep 10

		atf_check -s exit:0 -o ignore -e ignore \
		    jexec alcatraz ping -c 3 172.16.3.1
	}

	noifpppoe_cleanup()
	{
		vnet_cleanup
	}

Pretty hacky, but hey, it does panic.
Ppp.conf:

	default:
	 allow mode direct                              # Only for use on 
server-side
	 set mru 1492
	 set mtu 1492
	 set timeout 0
	 enable lqr echo
	 #enable lqr echo proxy                          # Enable LQR and 
proxy-arp
	 set ifaddr 172.16.3.1 172.16.3.100-172.16.3.199 # Hand out up to 100 
IP numbers
	 accept dns                                     # Allow DNS negotiation
	 set dns 172.16.3.1
	 +ipv6
	 ipv6
	 defaultroute
	 debug

	pppoe-pap:
	 enable pap

mpd5.conf:

	startup:
	        # configure the console
	        set console close
	        # configure the web server
	        set web close

	default:
	pppoeclient:
	        create bundle static wan
	        set bundle period 6
	        set bundle lowat 0
	        set bundle hiwat 0
	        set bundle min-con 3
	        set bundle min-dis 6
	        set bundle enable bw-manage
	        set bundle enable ipv6cp
	        set iface name pppoe0
	        set iface description "WAN"
	        set iface disable on-demand
	        set iface idle 0
	        set iface enable tcpmssfix
	        #set iface up-script /usr/local/sbin/ppp-linkup
	        #set iface down-script /usr/local/sbin/ppp-linkdown
	        set ipcp ranges 0.0.0.0/0 0.0.0.0/0
	        set ipcp enable req-pri-dns
	        set ipcp enable req-sec-dns
	        #log -bund -ccp -chat -iface -ipcp -lcp -link

	        create link static wan_link0 pppoe
	        set link action bundle wan
	        set link disable multilink
	        set link keep-alive 10 60
	        set link max-redial 0
	        set link disable chap pap
	        set link accept chap pap eap
	        set link disable incoming
	        set link mtu 1492
	        set auth authname "pfsense"
	        set auth password admin
	        set pppoe service "codepro"
	        set pppoe iface epair0a
	        open

(I’ve not tried to minimise those config files. I expect there are a 
number of unneeded directives in them.)

Best regards,
Kristof