From owner-freebsd-net@FreeBSD.ORG  Mon May  9 15:18:13 2011
Return-Path: <owner-freebsd-net@FreeBSD.ORG>
Delivered-To: freebsd-net@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8DCD61065670
	for <freebsd-net@freebsd.org>; Mon,  9 May 2011 15:18:13 +0000 (UTC)
	(envelope-from kickbsd@yandex.ru)
Received: from forward1.mail.yandex.net (forward1.mail.yandex.net [77.88.46.6])
	by mx1.freebsd.org (Postfix) with ESMTP id 41EDA8FC08
	for <freebsd-net@freebsd.org>; Mon,  9 May 2011 15:18:13 +0000 (UTC)
Received: from web63.yandex.ru (web63.yandex.ru [77.88.46.54])
	by forward1.mail.yandex.net (Yandex) with ESMTP id A35851240C4E
	for <freebsd-net@freebsd.org>; Mon,  9 May 2011 19:02:24 +0400 (MSD)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail;
	t=1304953344; bh=Du6IBGS+Mt9BW7Fa3kckE6aTKQRKXfptn5IZWa+dCUw=;
	h=From:To:Subject:MIME-Version:Message-Id:Date:
	Content-Transfer-Encoding:Content-Type;
	b=TCui6o5ZipeWmkxZNZVOzEKmU9ad6kbUm4d/8cg1kQ35+TEHzg3EXabRkKFZB6GW3
	8d1BiSqzigtM9BlSYDUiTs7yso6ja+1WwLtYAB2OVsEhBUUG22+kxGaR6Jrqerj/dU
	tTI7m+oPosYtXyNBzRxNVVz9QDPp8fYFyWb6aR8I=
Received: from localhost (localhost.localdomain [127.0.0.1])
	by web63.yandex.ru (Yandex) with ESMTP id 9374CB18040
	for <freebsd-net@freebsd.org>; Mon,  9 May 2011 19:02:24 +0400 (MSD)
X-Yandex-Spam: 1
Received: from leo.de.teleglobe.net (leo.de.teleglobe.net [64.86.53.146]) by
	mail.yandex.ru with HTTP; Mon, 09 May 2011 19:02:23 +0400
From: Darren Baginski <kickbsd@yandex.ru>
To: freebsd-net@freebsd.org
MIME-Version: 1.0
Message-Id: <686421304953344@web63.yandex.ru>
Date: Mon, 09 May 2011 19:02:23 +0400
X-Mailer: Yamail [ http://yandex.ru ] 5.0
Content-Transfer-Encoding: 7bit
Content-Type: text/plain
Subject: PF and ipv6 strange behavior on FreeBSD
X-BeenThere: freebsd-net@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Networking and TCP/IP with FreeBSD <freebsd-net.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-net>,
	<mailto:freebsd-net-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-net>
List-Post: <mailto:freebsd-net@freebsd.org>
List-Help: <mailto:freebsd-net-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-net>,
	<mailto:freebsd-net-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 09 May 2011 15:18:13 -0000

Hi!

I've noticed rather strange pf behavior on FreeBSD box (8.2 and 7.4 in particular)

Consider this rule
pass out proto tcp from self to any flags S/SA keep state
despite the fact pf starts after netif
if doesn't not create rule
pass out inet6 proto tcp from 2001:xxx:xxx:xxx:ffff:ffff:ffff:ff26 to any flags S/SA keep state
where 2001:xxx:xxx:xxx:ffff:ffff:ffff:ff26 my ipv6 addres,
but it creates
pass out inet proto tcp from 116.x.x.26 to any flags S/SA keep state
where 116.x.x.26  my ipv4 address on the same interface.

All above happens *only* after reboot.
BUT if I log in on already working machine and issue pfctl -f /etc/pf.conf , pf creates rule in question.
Perhaps that happens because of pf starts to 'earlier' , and ipv6  has no time to check IP duplicates on link and pf start before ipv6 address is up on interface?
Any Ideas and suggestion are very welcome, since I reproduced the same problem on 7.4 and that issue is rather annoying. 

Thank you!