sonic-net / sonic-buildimage

Scripts which perform an installable binary image build for SONiC
Other
705 stars 1.35k forks source link

Config interface ip command allows ip address configuration on a Vlan member #19505

Open dgsudharsan opened 1 week ago

dgsudharsan commented 1 week ago

Description

This check was present previously but got removed in https://github.com/sonic-net/sonic-utilities/pull/3247

Without this the ip address configuration command goes through

root@r-lionfish-16:~# config vlan add 40
root@r-lionfish-16:~# config vlan member add 40 Ethernet0
root@r-lionfish-16:~#
root@r-lionfish-16:~#
root@r-lionfish-16:~# config interface ip add Ethernet0 1.1.1.1/24
root@r-lionfish-16:~#

Later when Vlan member is removed, vlanmgrd crashes

2024 Jul  8 10:44:01.327950 r-lionfish-16 INFO swss#supervisord: vlanmgrd RTNETLINK answers: Operation not supported
2024 Jul  8 10:44:01.328761 r-lionfish-16 ERR swss#vlanmgrd: :- main: Runtime error: /bin/bash -c "/sbin/bridge vlan del vid 40 dev \"Ethernet0\" && ( vlanShow=\$(/sbin/bridge vlan show dev \"Ethernet0\"); ret=\$?; if [ \$ret -eq 0 ]; then if (! echo \"\$vlanShow\" | /bin/grep -q \"Ethernet0\")  || (echo \"\$vlanShow\" | /bin/grep -q None\$)  || (echo \"\$vlanShow\" | /bin/grep -q \"Ethernet0\"\$); then /sbin/ip link set \"Ethernet0\" nomaster; fi; else exit \$ret; fi )" :
2024 Jul  8 10:44:01.330422 r-lionfish-16 INFO swss#supervisord 2024-07-08 07:44:01,329 WARN exited: vlanmgrd (exit status 255; not expected)

Steps to reproduce the issue:

  1. config vlan add 40
  2. config vlan member add 40 Ethernet0
  3. config interface ip add Ethernet0 1.1.1.1/24

Describe the results you received:

Ip address configuration is allowed in Vlan member

Describe the results you expected:

ip address configuration should not be allowed if port is member of vlan

Output of show version:

(paste your output here)

Output of show techsupport:

(paste your output here or download and attach the file here )

Additional information you deem important (e.g. issue happens only occasionally):

dgsudharsan commented 1 week ago

@ sabakram @ridahanif96 Can you please help to fix this issue?

ridahanif96 commented 1 week ago

@dgsudharsan ok, will resolve this issue