Skip to content

[windows] Port config/state is kept in on PORT_DOWN/LINK_DOWN state for internal type #351

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
twofish197 opened this issue Dec 30, 2024 · 0 comments

Comments

@twofish197
Copy link

twofish197 commented Dec 30, 2024

On the simple testing for internal type port with CMD below,

Reproducing steps(start-service ovsdb-server/ovs-vswitchd on Windows VM)
New-VMSwitch -Name vsset -AllowManagementOS $False -NetAdapterName "Ethernet1 3"
Get-VMSwitch -Name vsset | Enable-VMSwitchExtension "Open vSwitch Extension"
ovs-vsctl.exe add-br br-int

ovs-vsctl --no-wait add-port br-int podvif38 -- set interface podvif38 type=internal
ovs-vsctl --no-wait add-port br-int podvif39 -- set interface podvif39 type=internal

From the CMD blow, it would show the port portvif38 and portvif39 are kept on PORT_DOWN/LINK_DOWN
PS C:\openvswitch> ovs-ofctl show br-int

OFPT_FEATURES_REPLY (xid=0x2): dpid:00003e3ad1550745
n_tables:254, n_buffers:0
capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
actions: output enqueue set_vlan_vid set_vlan_pcp strip_vlan mod_dl_src mod_dl_dst mod_nw_src mod_nw_dst mod_nw_tos mod_tp_src mod_tp_dst
1(podvif38): addr:00:00:00:00:00:00
config: PORT_DOWN
state: LINK_DOWN
speed: 0 Mbps now, 0 Mbps max
2(podvif39): addr:00:00:00:00:00:00
config: PORT_DOWN
state: LINK_DOWN
speed: 0 Mbps now, 0 Mbps max
LOCAL(br-int): addr:00:00:00:00:00:00
config: PORT_DOWN
state: LINK_DOWN
speed: 0 Mbps now, 0 Mbps max

From the CMD "get-netdapter" the related ports are already UP and got mac address.
PS C:\openvswitch> get-netadapter

Name InterfaceDescription ifIndex Status MacAddress LinkSpeed


podvif38 Hyper-V Virtual Ethernet Adapter #4 52 Up 00-15-5D-04-A0-88 1 Gbps
podvif39 Hyper-V Virtual Ethernet Adapter #5 53 Up 00-15-5D-04-A0-89 1 Gbps

If restart ovs-vswitchd, the port config/state would become 0/0.

From the code through, it is found that it is just implement netdev_windows_update_flags function
with a minumum support. In some cases, it needs update the flags to make it consistent with the interface
flags on kernel datapath.

/* This functionality is not really required by the datapath.

  • But vswitchd bringup expects this to be implemented. */
    static int
    netdev_windows_update_flags(struct netdev *netdev_,
    enum netdev_flags off,
    enum netdev_flags on,

When ovs port is allocated, it will do updating flag of netdev and call the netdev_class member function .update_flags to get the flags of netdev. But this function is not well implemented on ovs-windows side.
error = netdev->netdev_class->update_flags(netdev, off & ~on, on,
&old_flags);

This will cause OVS send an OpenFlow PortStatus message with invalid port state “OFPUTIL_PS_LINK_DOWN” .

The bad OpenFlow PortStatus message is like this,

I1227 02:23:23.072626    4144 pod_configuration_windows.go:179] "Received PortStatus message" message={"Version":6,"Type":12,"Length":88,"Xid":0,"Reason":0,"Desc":{"PortNo":5,"Length":72,"Pad":null,"HWAddr":"AAAAAAAA","Name":"dnNwaGVyZS0tZWFiMmUzAA==","Config":1,"State":1,"Properties":[{"Header":{"Type":0,"Length":32},"Pad":null,"Curr":0,"Advertised":0,"Supported":0,"Peer":0,"CurrSpeed":0,"MaxSpeed":0}]}}
ovsrobot pushed a commit to ovsrobot/ovs that referenced this issue Mar 28, 2025
…tworkAdapter.

This fix could solve the issue for not updated ifi_flags and mac
 of internal type port which may could not get the correct ifi_flags and
 mac info when the internal type port is created on Windows platform.

 With the patch, if user is removing some network adapter via CMD below,
 OVS on Windows could also update the value of fields admin_state and
 link_state as "down". Related MAC is also set zero.

 Remove-VMNetworkAdapter -ManagementOS -SwitchName br-int
 -VMNetworkAdapterName xxx

 As in ovs-windows it is not set ifindex on ovs interface, it may need
 another patch to address the not-implemented ifIndex which could be
 got via CMD ovs-vsctl list interface.

 Reported-at:openvswitch/ovs-issues#351
 Reported-at:openvswitch/ovs-issues#353

Signed-off-by: Wilson Peng <[email protected]>
Signed-off-by: 0-day Robot <[email protected]>
ovsrobot pushed a commit to ovsrobot/ovs that referenced this issue Mar 28, 2025
This fix could solve the issue for not updated ifi_flags and mac
 of internal type port which may could not get the correct ifi_flags and
 mac info when the internal type port is created on Windows platform.

 With the patch, if user is removing some network adapter via CMD below,
 OVS on Windows could also update the value of fields admin_state and
 link_state as "down". Related MAC is also set zero.

 Remove-VMNetworkAdapter -ManagementOS -SwitchName br-int
 -VMNetworkAdapterName xxx

 As in ovs-windows it is not set ifindex on ovs interface, it may need
 another patch to address the not-implemented ifIndex which could be
 got via CMD ovs-vsctl list interface.

 Reported-at:openvswitch/ovs-issues#351
 Reported-at:openvswitch/ovs-issues#353

Signed-off-by: Wilson Peng <[email protected]>
Signed-off-by: 0-day Robot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant