Skip to content

Commit

Permalink
Fix core while droplog pruning non-IP packets
Browse files Browse the repository at this point in the history
 Add some null checks for packet IP matching

Signed-off-by: Kiran Shastri <shastrinator@gmail.com>
(cherry picked from commit 308be09)
  • Loading branch information
shastrinator committed Nov 23, 2022
1 parent 207bb93 commit 8f74909
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions agent-ovs/ovs/include/PacketLogHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,18 @@ class PacketFilterSpec: public PacketTuple {
* */
static bool compareIps(const std::string &ip1, const std::string &ip2, const std::string &prefixLen) {
using boost::asio::ip::address;
address addr1 = address::from_string(ip1);
address addr2 = address::from_string(ip2);
if (ip1.empty() || ip2.empty()) {
return false;
}
boost::system::error_code ec;
address addr1 = address::from_string(ip1,ec);
if (ec){
return false;
}
address addr2 = address::from_string(ip2,ec);
if (ec){
return false;
}
if(addr1.is_v4() != addr2.is_v4()) {
return false;
}
Expand Down

0 comments on commit 8f74909

Please sign in to comment.