Bug 230794

Summary: No vlan tagged output after upgrade to ALPHA2
Product: Base System Reporter: Alexander Mishin <mishin>
Component: kernAssignee: Navdeep Parhar <np>
Status: Closed FIXED    
Severity: Affects Many People CC: np
Priority: --- Keywords: regression
Version: CURRENT   
Hardware: amd64   
OS: Any   
Attachments:
Description Flags
patch which reverts a change in r337932 none

Description Alexander Mishin 2018-08-21 06:31:46 UTC
After upgrading from "FreeBSD 12.0-CURRENT #20 r336766" to ALPHA2 and by now vlan interface has been broken.

# cat /etc/rc.conf.d/network
[code]
vlans_re0="11"

ifconfig_re0="inet 192.168.x.x netmask 255.255.255.0 vlanhwfilter rxcsum6 txcsum6 descr LAN"
ifconfig_re0_11="inet 88.x.x.x netmask 255.255.255.252 descr WAN"
[/code]

# ifconfig
[code]
re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	description: LAN
	options=8209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC,LINKSTATE>
	ether d0:50:99:1d:7b:88
	inet 192.168.x.x netmask 0xffffff00 broadcast 192.168.x.255 
	media: Ethernet autoselect (1000baseT <full-duplex>)
	status: active
	nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
re0.11: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	description: WAN
	options=80003<RXCSUM,TXCSUM,LINKSTATE>
	ether d0:50:99:1d:7b:88
	inet 88.x.x.x netmask 0xfffffffc broadcast 88.x.x.x 
	groups: vlan 
	vlan: 11 vlanpcp: 0 parent interface: re0
	media: Ethernet autoselect (1000baseT <full-duplex>)
	status: active
	nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
[/code]

# netstat -rn
[code]
Routing tables

Internet:
Destination        Gateway            Flags     Netif Expire
default            88.x.x.y      UGS      re0.11
.....
[/code]

I have two uplinks from my home server: main one - direct from white ip address 88.x.x.x/30 via 88.x.x.y on re0.11 and possible one (not used normally) - by the router from 192.168.x.x via 192.168.x.y on re0 (private ip, pppoe, double nat).

All worked (and working) ok on '12.0-CURRENT #20 r336766' kernel.

After upgrade to '12.0-ALPHA2 #2 r338054' kernel I can't ping from LAN 88.x.x.x to GW 88.x.x.y (via re0.11) neither from Internet to 88.x.x.x (88.x.x.y is ok).
All is ok with any packets exchange on re0

After I changed the default route to 192.168.x.y (to router via re0) I can ping Internet ip addresses, can ping from Internet to 88.x.x.y (on the provider side) and can ping, surprisingly, 88.x.x.x at home.

I tried "ifconfig em0 -vlanhwtag" with the same result

(ifconfig_re0="inet 192.168.x.x netmask 255.255.255.0 -vlanhwtag -vlanhwfilter -rxcsum6 -txcsum6 descr LAN")
Comment 1 Alexander Mishin 2018-08-21 06:47:03 UTC
"ifconfig re0 -vlanhwtag" of course. Can't find how to 'quick edit' it
Comment 2 gitdev 2018-08-24 14:42:56 UTC
Created attachment 196500 [details]
patch which reverts a change in r337932

This patch to ALPHA3 reverts a change to sys/net/if_vlan.c in r337932.  It was tested on an amd64 system with a realtek NIC using the re driver.
Comment 3 Navdeep Parhar freebsd_committer freebsd_triage 2018-08-24 16:47:42 UTC
(In reply to gitdev from comment #2)
The patch reverts r337943 and doesn't seem to have anything to do with r337932.
Comment 4 Navdeep Parhar freebsd_committer freebsd_triage 2018-08-24 18:53:28 UTC
r337943 is confusing ether_output_frame.  I will either revert said revision
or adjust ether_output_frame.
Comment 5 Navdeep Parhar freebsd_committer freebsd_triage 2018-08-24 19:52:40 UTC
This should fix it.  I'll commit as soon as I have reviewer's and re@'s approval.

https://reviews.freebsd.org/D16887
Comment 6 commit-hook freebsd_committer freebsd_triage 2018-08-24 21:48:23 UTC
A commit references this bug:

Author: np
Date: Fri Aug 24 21:48:13 UTC 2018
New revision: 338305
URL: https://svnweb.freebsd.org/changeset/base/338305

Log:
  Unbreak VLANs after r337943.

  ether_set_pcp should not be called from ether_output_frame for VLAN
  interfaces -- the vid + pcp will be inserted during vlan_transmit in
  that case. r337943 sets the VLAN's ifnet's if_pcp to a proper PCP value
  and this led to double encapsulation (once with vid 0 and second time
  with vid+pcp).

  PR: 230794
  Reviewed by:	kib@
  Approved by:	re@ (gjb@)
  Sponsored by:	Chelsio Communications
  Differential Revision:	https://reviews.freebsd.org/D16887

Changes:
  head/sys/net/if_ethersubr.c
Comment 7 gitdev 2018-08-24 22:43:51 UTC
Patched r338303 with np's r338305. amd64 with RealTek nic and vlan works.
Comment 8 Alexander Mishin 2018-08-25 11:19:13 UTC
Fixed with 12.0-ALPHA3 #6 r338309.
Thanks.