openvswitch / ovs-issues

Issue tracker repo for Open vSwitch
10 stars 3 forks source link

ovs unable to set options:pcap on a real interface #296

Closed bettswang closed 11 months ago

bettswang commented 11 months ago

Hi, everyone

I set up ovs on ubuntu22.04. And I want to set options:pcap on a port to capture data into a file. When I do this , there is a error on ovs log. So it doesn't generate any pcap file.

ovs version: git clone form master system: ubuntu22.04 command: ovs-vsctl set Interface ens37 options:pcap=ens37.pcap

root@ubuntu2204:~# ovs-vsctl show
839a3e7f-b874-438f-91f5-a64087064608
    Bridge br0
        Controller "tcp:127.0.0.1:6653"
            is_connected: true
        Port ens38
            Interface ens38
        Port br0
            Interface br0
                type: internal
        Port ens36
            Interface ens36
        Port ens37
            Interface ens37
                options: {pcap=ens37.pcap}
    ovs_version: "3.2.90"

root@ubuntu2204:~# cat /usr/local/var/log/openvswitch/ovs-vswitchd.log  | egrep  "WARN|ERR"
2023-08-22T10:09:12.449Z|00084|jsonrpc|WARN|unix:/usr/local/var/run/openvswitch/db.sock: send error: Broken pipe
2023-08-22T10:09:12.449Z|00085|reconnect|WARN|unix:/usr/local/var/run/openvswitch/db.sock: connection dropped (Broken pipe)
2023-08-22T10:09:12.720Z|00030|netdev|WARN|ens37: arguments provided to device that is not configurable
2023-08-22T10:09:12.721Z|00034|bridge|ERR|bridge br0: mirror m_ens37 does not specify output; ignoring
2023-08-22T10:09:12.782Z|00040|netdev|WARN|ens37: arguments provided to device that is not configurable
2023-08-22T10:09:12.782Z|00041|bridge|ERR|bridge br0: mirror m_ens37 does not specify output; ignoring
bettswang commented 11 months ago

I change to the logical port, it also report error. I see that it's ok on the sandbox. Why?

root@ubuntu2204:/usr/local/etc/openvswitch# ovs-vsctl show
839a3e7f-b874-438f-91f5-a64087064608
    Bridge br0
        Controller "tcp:127.0.0.1:6653"
            is_connected: true
        Port p1
            Interface p1
                type: internal
        Port p3
            Interface p3
                type: internal
        Port br0
            Interface br0
                type: internal
        Port p2
            Interface p2
                type: internal
                options: {pcap=p1.pcap}
    ovs_version: "3.2.90"

root@ubuntu2204:/usr/local/etc/openvswitch# cat /usr/local/var/log/openvswitch/ovs-vswitchd.log  | grep WARN
2023-08-23T06:53:56.235Z|00009|jsonrpc|WARN|unix:/usr/local/var/run/openvswitch/db.sock: send error: Broken pipe
2023-08-23T06:53:56.235Z|00010|reconnect|WARN|unix:/usr/local/var/run/openvswitch/db.sock: connection dropped (Broken pipe)
2023-08-23T07:03:34.802Z|00059|netdev|WARN|p2: arguments provided to device that is not configurable
2023-08-23T07:06:05.858Z|00061|netdev|WARN|p2: arguments provided to device that is not configurable
2023-08-23T07:06:16.419Z|00062|netdev|WARN|p2: arguments provided to device that is not configurable
2023-08-23T07:06:20.927Z|00063|netdev|WARN|p2: arguments provided to device that is not configurable
2023-08-23T07:06:47.814Z|00064|netdev|WARN|p2: arguments provided to device that is not configurable
2023-08-23T07:07:04.580Z|00065|netdev|WARN|p2: arguments provided to device that is not configurable
igsilya commented 11 months ago

pcap is an option for dummy ports that you have in a sandbox. No real ports support it. If you want to capture pcap, just use ovs-tcpdump or a normal tcpdump if you're using linux kernel interfaces.

bettswang commented 11 months ago

All right, got it. I also wonder that ovs-appctl ofproto/trace -generate really generate a packet into the network? When I tcpdump , couldn't capture any packet. Or it just send packet to userspace, not to linux kernel.

igsilya commented 11 months ago

If you have an output action in the trace, then the packet should be sent out. However, it might not be the best way of generating packets, because they may have some information missing and end up looking not fully correct and being dropped by the kernel. You may try specifying exact content of the packet via packet option.