Improve packet filter validation: use tcpdump, handle multi-line BPF, safe project load

Changes:
- Replace tshark BPF validation with tcpdump -d (calls pcap_compile
  internally like ubridge, returns instantly without waiting for traffic)
- Support multi-line BPF expressions: split on newlines and validate
  each line individually
- Always validate, never save invalid filters on error
- Drop invalid filters during project load with warning (prevents
  old topologies with bad filters from failing to open)
- Simplify test cases (no longer depend on tshark availability)
This commit is contained in:
YueGuobin committed 2026-05-30 01:02:21 +08:00
1 parent 87f38b1507
commit 7bcb96a368
4 files changed
+58 -57

No files matched your search

+2 -1
View File
@@ -583,7 +583,7 @@ class Link:
"suspend": self._suspended,
"show_filters_icon": getattr(self, '_show_filters_icon', True),
}
return {
result = {
"nodes": res,
"link_id": self._id,
"project_id": self._project.id,
@@ -598,3 +598,4 @@ class Link:
"wireshark": self._wireshark,
"show_filters_icon": getattr(self, '_show_filters_icon', True),
}
return result