Skip to content

Commit eeff4bb

Browse files
committed
network matching grep fix, don't let 1.2.3.4/32 match 11.2.3.4/32
1 parent 4b27656 commit eeff4bb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

systemvm/debian/opt/cloud/bin/cs/CsStaticRoutes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def __update(self, route):
5353
logging.info("Deleted static route %s via %s from PBR table %s" % (network, gateway, table_name))
5454
else:
5555
# Add to main table (existing logic)
56-
command = "ip route show | grep %s | awk '{print $1, $3}'" % network
56+
command = "ip route show | grep '^%s' | awk '{print $1, $3}'" % network
5757
result = CsHelper.execute(command)
5858
if not result:
5959
route_command = "ip route add %s via %s" % (network, gateway)
@@ -66,7 +66,7 @@ def __update(self, route):
6666
cs_route = CsRoute()
6767
table_name = cs_route.get_tablename(device)
6868
# Check if route already exists in the PBR table
69-
check_command = "ip route show table %s | grep %s | awk '{print $1, $3}'" % (table_name, network)
69+
check_command = "ip route show table %s | grep '^%s' | awk '{print $1, $3}'" % (table_name, network)
7070
result = CsHelper.execute(check_command)
7171
if not result:
7272
# Add route to the interface-specific table

0 commit comments

Comments
 (0)