Xilinx-CNS / solarcapture

SolarCapture network packet capture suite
Other
13 stars 8 forks source link

error in a python script using vlan tag in RHEL9 #15

Open pageschrist opened 1 month ago

pageschrist commented 1 month ago

Hello We noticed an issue as described below using the vlan tag: /bin/solar_capture format=pcap-ns capture_cores=4,5,6 writeout_core=7 ens1f0=/capture/20240717/chix-20240717.pcap join_streams="udp:224.0.82.18:.194:31205;udp:224.0.82.196:31206;udp:224.0.82.198:31207;udp:224.0.82.198:31208;udp:224.0.82.200:31209;udp:224.0.82.200:31210;udp:224.0.82.20:31211;udp:224.0.82.202:3121231206;udp:vid=45,224.0.82.82:31201;udp:vid=45,224.0.82.82:31202;udp:vid=45,224.0.82.82:31203;udp:vid=45,224.0.82.230:31207;udp:vid=45,224.0.82.230:31208;udp:vid=45,224.0.4.0.82.234:31212" capture_buffer=49152000 ens1f0=/capture/20240717/bats-20240717.pcap join_streams="udp:224.0.83.18:31201;udp:224.0.83.18:31202;udp:224.0.83.18:31203;udp:07;udp:224.0.83.134:31208;udp:224.0.83.136:31209;udp:224.0.83.136:31210;udp:224.0.83.20:31211;udp:224.0.83.138:31212;udp:vid=45,224.0.83.82:31201;udp:vid=45,224.0.83.82:362:31205;udp:vid=45,224.0.83.164:31206;udp:vid=45,224.0.83.166:31207;udp:vid=45,224.0.83.166:31208;udp:vid=45,224.0.83.168:31209;udp:vid=45,224.0.83.168:31210;udp:vid=45,ure/20240717/dxe-20240717.pcap join_streams="udp:224.0.180.2:31201;udp:224.0.180.2:31202;udp:224.0.180.2:31203;udp:224.0.180.4:31204;udp:224.0.180.4:31205;udp:224.0.180.680.10:31210;udp:224.0.180.12:31211;udp:224.0.180.14:31212;udp:vid=45,224.0.180.34:31201;udp:vid=45,224.0.180.34:31202;udp:vid=45,224.0.180.34:31203;udp:vid=45,224.0.180.3180.40:31207;udp:vid=45,224.0.180.40:31208;udp:vid=45,224.0.180.42:31209;udp:vid=45,224.0.180.42:31210;udp:vid=45,224.0.180.44:31211;udp:vid=45,224.0.180.46:31212" captur SolarCapture 1.7.0.unknown. Copyright (c) 2012-2019 Xilinx, Inc. SolarCapture session=341967/0 log=/var/tmp/solar_capture_svceqdfhqs_341967/0 Traceback (most recent call last): File "/bin/solar_capture", line 1254, in main(sys.argv[1:]) File "/bin/solar_capture", line 1217, in main pipe_fd, postrotate_cmds = process(sc_tg, captures) File "/bin/solar_capture", line 1154, in process sc_tg.join_multicast_groups(capture['interface'], File "/usr/lib/python3.9/site-packages/solar_capture/init.py", line 212, in join_multicast_groups for vlan_intf, vlan_id, base_intf in get_vlan_list(): File "/usr/lib/python3.9/site-packages/solar_capture/init.py", line 78, in get_vlan_list for line in file(VLAN_PROCFILE):

We corrected the code as follow: List has been added in/usr/lib/python3.9/site-packages/solar_capture/init.py as below

def get_vlan_list(): if os.path.isfile(VLAN_PROCFILE): for line in file(VLAN_PROCFILE): spl = list(map(str.strip, line.split('|'))) if len(spl) == 3 and spl[1].isdigit(): yield spl

do you agree with this correction, is it possible to integrate it in the new version? Thanks for your help. Christophe.

abrunnin-xilinx commented 1 month ago

So the change is to go from "spl = map" to "spl = list(map" ?

It certainly looks plausible. Can you make it a PR so I can merge it giving you credit?