Skip to content

Commit bf25fc4

Browse files
yue-fred-gaojasonbridges
authored andcommitted
fix show dhcp_server ipv4 info when gateway is optional (sonic-net#24801)
gateway is optional field. In smartswitch use case, dhcp server runs in the switch and is used to offer addresses to DPU midplane. But we don't want to install default route over the midplane interface so gateway option is removed from DHCP server config. See sonic-net#24495 (comment). Signed-off-by: Yue Gao <[email protected]>
1 parent e3e962b commit bf25fc4

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

dockers/docker-dhcp-server/cli/show/plugins/show_dhcp_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def info(db, dhcp_interface, with_customized_options):
110110
for key in dbconn.keys("CONFIG_DB", "DHCP_SERVER_IPV4|" + dhcp_interface):
111111
entry = dbconn.get_all("CONFIG_DB", key)
112112
interface = key.split("|")[1]
113-
table.append([interface, entry["mode"], entry["gateway"], entry["netmask"], entry["lease_time"], entry["state"]])
113+
table.append([interface, entry["mode"], entry.get("gateway", ""), entry["netmask"], entry["lease_time"], entry["state"]])
114114
if with_customized_options:
115115
table[-1].append(entry["customized_options@"] if "customized_options@" in entry else "")
116116
click.echo(tabulate(table, headers=headers, tablefmt="grid"))

0 commit comments

Comments
 (0)