Skip to content

Commit ba2da08

Browse files
committed
path: fix logic for check of ipaddr is an interface ipaddr
Signed-off-by: Dinesh Dutt <[email protected]>
1 parent f53e1db commit ba2da08

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

suzieq/engines/pandas/path.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,10 @@ def _init_dfs(self, ns, source, dest):
119119

120120
if ':' in source:
121121
self._src_df = self._if_df[self._if_df.ip6AddressList.astype(str)
122-
.str.contains(source + "/")]
122+
.str.startswith(source + "/")]
123123
else:
124124
self._src_df = self._if_df[self._if_df.ipAddressList.astype(str)
125-
.str.contains(source + "/")]
125+
.str.startswith(source + "/")]
126126

127127
if self._src_df.empty:
128128
# TODO: No host with this src addr. Is addr a local ARP entry?
@@ -147,10 +147,10 @@ def _init_dfs(self, ns, source, dest):
147147

148148
if ':' in dest:
149149
self._dest_df = self._if_df[self._if_df.ip6AddressList.astype(str)
150-
.str.contains(dest + "/")]
150+
.str.startswith(dest + "/")]
151151
else:
152152
self._dest_df = self._if_df[self._if_df.ipAddressList.astype(str)
153-
.str.contains(dest + "/")]
153+
.str.startswith(dest + "/")]
154154

155155
if self._dest_df.empty:
156156
# Check if addr is in any switch's local ARP
@@ -929,10 +929,10 @@ def get(self, **kwargs) -> pd.DataFrame:
929929
if not nhdf.empty:
930930
if srcvers == 4:
931931
nhdf = nhdf.query(
932-
f'ipAddressList.str.contains("{ndst}")')
932+
f'ipAddressList.str.startswith("{ndst}/")')
933933
else:
934934
nhdf = nhdf.query(
935-
f'ip6AddressList.str.contains("{ndst}")')
935+
f'ip6AddressList.str.startswith("{ndst}/")')
936936
if not nhdf.empty:
937937
ifmac = nhdf.macaddr.unique().tolist()
938938
if (not macaddr) or (macaddr in ifmac):

0 commit comments

Comments
 (0)