Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dhcp6_relay] [counters] Counters show statistics for deleted vlans during config reload #15047

Open
vivekrnv opened this issue May 12, 2023 · 23 comments

Comments

@vivekrnv
Copy link
Contributor

Description

dhcpv6 show statistics for even deleted vlans

Steps to reproduce the issue:

  1. Add 2 Vlans with IP addresses
  2. Configure IPv6 address on port to dhcpv6 server (it can be configured without dhcp server itself)
  3. Configre IPv6 on Client vlans
  4. enable dhcp_relay feature (config feature state dhcp_relay enabled)
  5. configre dhcp_relay ipv6 destination for client vlans (config dhcp_relay ipv6 destination add 10 2000:100::2)
  6. Check dhcp_relay ipv6 counters (show dhcp_relay ipv6 counters)
  7. Remove one of client vlans
  8. Check dhcp_relay ipv6 counters

Describe the results you received:

root@qa-eth-vt04-1-3700v:/home/admin# show vlan brief
+-----------+--------------+-----------+----------------+-------------+-----------------------+
|   VLAN ID | IP Address   | Ports     | Port Tagging   | Proxy ARP   | DHCP Helper Address   |
+===========+==============+===========+================+=============+=======================+
|      3207 | 2000::1:1/64 | Ethernet4 | tagged         | disabled    |                       |
+-----------+--------------+-----------+----------------+-------------+-----------------------+

root@qa-eth-vt04-1-3700v:/home/admin# show dhcp_relay ipv6  counters
       Message Type    Vlan1570
-------------------  ----------
            Unknown           0
            Solicit           2
          Advertise           2
            Request           1
            Confirm           0
              Renew           1
             Rebind           1
              Reply           3
            Release           0
            Decline           0
        Reconfigure           8
Information-Request           0
      Relay-Forward           5
        Relay-Reply          13
          Malformed           0

 

       Message Type    Vlan3207
-------------------  ----------
            Unknown           0
            Solicit           1
          Advertise           1
            Request           1
            Confirm           0
              Renew           0
             Rebind           0
              Reply           1
            Release           0
            Decline           0
        Reconfigure           0
Information-Request           0
      Relay-Forward           2
        Relay-Reply           2
          Malformed           0

root@qa-eth-vt04-1-3700v:/home/admin#

Describe the results you expected:

Output of show techsupport:

sonic_dump_qa-eth-vt04-1-3700v_20230511_123606.tar.gz

@vivekrnv
Copy link
Contributor Author

@yxieca @jcaiMR FYI

@jcaiMR
Copy link
Contributor

jcaiMR commented May 13, 2023

@yaqiangz Add yaqiang as well.

@yaqiangz
Copy link
Contributor

@yaqiangz Add yaqiang as well.

Will check.

@arlakshm arlakshm added the MSFT label May 24, 2023
@jcaiMR jcaiMR self-assigned this May 25, 2023
@jcaiMR
Copy link
Contributor

jcaiMR commented May 25, 2023

We are working on this, ETA 6.9

yaqiangz added a commit to sonic-net/sonic-utilities that referenced this issue May 29, 2023
)

What I did
Fix this issue: sonic-net/sonic-buildimage#15047
Show dhcp_relay ipv6 counter will display vlan which has been deleted.

How I did it
Remove related info in state_db while deleting a vlan

How to verify it
Add unit test
Build utilities and run cmd to verify

Signed-off-by: Yaqiang Zhu <yaqiangzhu@microsoft.com>
qiluo-msft pushed a commit to sonic-net/sonic-utilities that referenced this issue Jun 2, 2023
)

What I did
Fix this issue: sonic-net/sonic-buildimage#15047
Show dhcp_relay ipv6 counter will display vlan which has been deleted.

How I did it
Remove related info in state_db while deleting a vlan

How to verify it
Add unit test
Build utilities and run cmd to verify

Signed-off-by: Yaqiang Zhu <yaqiangzhu@microsoft.com>
yxieca pushed a commit to sonic-net/sonic-utilities that referenced this issue Jun 2, 2023
)

What I did
Fix this issue: sonic-net/sonic-buildimage#15047
Show dhcp_relay ipv6 counter will display vlan which has been deleted.

How I did it
Remove related info in state_db while deleting a vlan

How to verify it
Add unit test
Build utilities and run cmd to verify

Signed-off-by: Yaqiang Zhu <yaqiangzhu@microsoft.com>
StormLiangMS pushed a commit to sonic-net/sonic-utilities that referenced this issue Jun 10, 2023
)

What I did
Fix this issue: sonic-net/sonic-buildimage#15047
Show dhcp_relay ipv6 counter will display vlan which has been deleted.

How I did it
Remove related info in state_db while deleting a vlan

How to verify it
Add unit test
Build utilities and run cmd to verify

Signed-off-by: Yaqiang Zhu <yaqiangzhu@microsoft.com>
@vivekrnv
Copy link
Contributor Author

Fixed by sonic-net/sonic-utilities#2852

pdhruv-marvell pushed a commit to pdhruv-marvell/sonic-utilities that referenced this issue Aug 23, 2023
…nic-net#2852)

What I did
Fix this issue: sonic-net/sonic-buildimage#15047
Show dhcp_relay ipv6 counter will display vlan which has been deleted.

How I did it
Remove related info in state_db while deleting a vlan

How to verify it
Add unit test
Build utilities and run cmd to verify

Signed-off-by: Yaqiang Zhu <yaqiangzhu@microsoft.com>
@vivekrnv vivekrnv reopened this Nov 27, 2023
@vivekrnv
Copy link
Contributor Author

Seen again on latest labels,. This time, the counters for member interfaces of downstream Vlan's are still seen.

config vlan member del 10 Ethernet0
config vlan member del 10 Ethernet252
config vlan del 10
Restarting dhcp_relay service..........
root@r-tigon-15:/home/admin# show dhcp_relay ipv6 counters -i Ethernet0
       Message Type    Ethernet0(RX)
-------------------  ---------------
            Unknown                0
            Solicit                0
          Advertise                0
            Request                0
            Confirm                0
              Renew                0
             Rebind                0
              Reply                0
            Release                0
            Decline                0
        Reconfigure                0
Information-Request                0
      Relay-Forward                0
        Relay-Reply                0
          Malformed                0

       Message Type    Ethernet0(TX)
-------------------  ---------------
          Advertise                0
            Confirm                0
            Decline                0
Information-Request                0
          Malformed                0
             Rebind                0
        Reconfigure                0
      Relay-Forward                0
        Relay-Reply                0
            Release                0
              Renew                0
              Reply                0
            Request                0
            Solicit                1
            Unknown                0

root@r-tigon-15:/home/admin# show dhcp_relay ipv6 counters -i Ethernet252
       Message Type    Ethernet252(RX)
-------------------  -----------------
            Unknown                  0
            Solicit                  0
          Advertise                  0
            Request                  0
            Confirm                  0
              Renew                  0
             Rebind                  0
              Reply                  0
            Release                  0
            Decline                  0
        Reconfigure                  0
Information-Request                  0
      Relay-Forward                  0
        Relay-Reply                  0
          Malformed                  0

       Message Type    Ethernet252(TX)
-------------------  -----------------
          Advertise                  0
            Confirm                  0
            Decline                  0
Information-Request                  0
          Malformed                  0
             Rebind                  0
        Reconfigure                  0
      Relay-Forward                  0
        Relay-Reply                  0
            Release                  0
              Renew                  0
              Reply                  0
            Request                  0
            Solicit                  1
            Unknown                  0

root@r-tigon-15:/home/admin# show dhcp_relay ipv6 counters -i Vlan10
  Message Type    Vlan10(RX)
--------------  ------------

  Message Type    Vlan10(TX)
--------------  ------------

Related to the new interface counters feature added in dhcp6relay. Vlan counters are cleared but member interfaces are not

@vivekrnv
Copy link
Contributor Author

@yxieca @yaqiangz @kellyyeh Please Check

@yaqiangz
Copy link
Contributor

@yxieca @yaqiangz @kellyyeh Please Check

Acked

@yaqiangz yaqiangz self-assigned this Nov 28, 2023
yaqiangz added a commit to sonic-net/sonic-utilities that referenced this issue Nov 29, 2023
Why I did it
Fix issue: sonic-net/sonic-buildimage#15047 of after deleting vlan member and vlan, the counters for for vlan / vlan member are still seen.

How I did it
Delete related counter entry in state_db when deleting vlan and vlan members.

How to verify it
All UTs passed
Manually test

Signed-off-by: Yaqiang Zhu <yaqiangzhu@microsoft.com>
StormLiangMS pushed a commit to sonic-net/sonic-utilities that referenced this issue Nov 30, 2023
Why I did it
Fix issue: sonic-net/sonic-buildimage#15047 of after deleting vlan member and vlan, the counters for for vlan / vlan member are still seen.

How I did it
Delete related counter entry in state_db when deleting vlan and vlan members.

How to verify it
All UTs passed
Manually test

Signed-off-by: Yaqiang Zhu <yaqiangzhu@microsoft.com>
@yaqiangz
Copy link
Contributor

yaqiangz commented Dec 1, 2023

sonic-net/sonic-utilities#3054
Fixed

@yaqiangz yaqiangz closed this as completed Dec 1, 2023
@vivekrnv vivekrnv reopened this Dec 4, 2023
@vivekrnv vivekrnv changed the title [dhcp6_relay] [counters] Counters show statistics for deleted vlans [dhcp6_relay] [counters] Counters show statistics for deleted vlans during config reload Dec 4, 2023
@vivekrnv vivekrnv closed this as completed Dec 4, 2023
@vivekrnv vivekrnv reopened this Dec 4, 2023
@vivekrnv
Copy link
Contributor Author

vivekrnv commented Dec 4, 2023

CLI issue is fixed. Thanks for the quick response. One problem is remaining.

If the config_db is updated (vlan is removed) and config reload is done, the stale entries in state_db are not deleted. Fix has to be in dhcp6relay (or container start script) to delete all the entries of the counter table during the process/container start

@dgsudharsan
Copy link
Collaborator

@yxieca @yaqiangz @kellyyeh We have reopened this since we are seeing the issue with config reload scenario as stated above. Can you please raise a fix for this?

@yaqiangz
Copy link
Contributor

yaqiangz commented Dec 5, 2023

@yxieca @yaqiangz @kellyyeh We have reopened this since we are seeing the issue with config reload scenario as stated above. Can you please raise a fix for this?

Will check

@jcaiMR
Copy link
Contributor

jcaiMR commented Dec 5, 2023

@yaqiangz
In dhcp6_relay, we do counter initialize job in following functions.

update_vlan_mapping
update_portchannel_mapping
update_loopback_mapping

So if some interfaces are not in current Vlan/Port-channel member group or not Loopback0, we will skip counter initialize job for them. It won't impact service and once the interfaces added back to Vlan/portchannel groups their counter will be right initialized.

But for this cosmetic issue fix, you can add a function to go through all Ethernet interfaces, and delete "DHCPv6_COUNTER_TABLE|Ethernet*" in state_db. If want fix the issue in dhcp6_relay repo the diff may something like following

void delete_counter(std::shared_ptrswss::DBConnector state_db, std::string &ifname) {
std::string table_name = counter_table + ifname;
state_db->del(table_name);
}

relay.cpp
1514 sockets.push_back(out_filter);
1515 +
+ // walk through all Ethernet interface and call delete_counter()
+
1516 int lo_sock = -1;

@yaqiangz
Copy link
Contributor

yaqiangz commented Dec 6, 2023

@yaqiangz In dhcp6_relay, we do counter initialize job in following functions.

update_vlan_mapping update_portchannel_mapping update_loopback_mapping

So if some interfaces are not in current Vlan/Port-channel member group or not Loopback0, we will skip counter initialize job for them. It won't impact service and once the interfaces added back to Vlan/portchannel groups their counter will be right initialized.

But for this cosmetic issue fix, you can add a function to go through all Ethernet interfaces, and delete "DHCPv6_COUNTER_TABLE|Ethernet*" in state_db. If want fix the issue in dhcp6_relay repo the diff may something like following

void delete_counter(std::shared_ptrswss::DBConnector state_db, std::string &ifname) { std::string table_name = counter_table + ifname; state_db->del(table_name); }

relay.cpp 1514 sockets.push_back(out_filter); 1515 + + // walk through all Ethernet interface and call delete_counter() + 1516 int lo_sock = -1;

Thanks @jcaiMR

@dgsudharsan
Copy link
Collaborator

Hi @yaqiangz Any ETA for fix?

@yaqiangz
Copy link
Contributor

Hi @yaqiangz Any ETA for fix?

ETA 12.29

yxieca pushed a commit to sonic-net/sonic-utilities that referenced this issue Dec 14, 2023
Why I did it
Fix issue: sonic-net/sonic-buildimage#15047 of after deleting vlan member and vlan, the counters for for vlan / vlan member are still seen.

How I did it
Delete related counter entry in state_db when deleting vlan and vlan members.

How to verify it
All UTs passed
Manually test

Signed-off-by: Yaqiang Zhu <yaqiangzhu@microsoft.com>
@yaqiangz
Copy link
Contributor

yaqiangz commented Dec 28, 2023

IPv6 fix PR (merged): sonic-net/sonic-dhcp-relay#45

IPv4 fix PR (waiting review): sonic-net/sonic-dhcpmon#14

yaqiangz added a commit to sonic-net/sonic-dhcpmon that referenced this issue Jan 10, 2024
[202311][counter] Clear counter table when dhcpmon init (#14)

Cherry-pick from #14

Why I did it
Fix issue sonic-net/sonic-buildimage#15047
dhcp counter didn't restore after config reload

Work item tracking
Microsoft ADO (number only): 26270786
How I did it
Clear all counters when dhcpmon start
Remove clear counter in initialize_counter since they are cleared in previous
How to verify it
Build debian packet and install in DUT do manually testing
Run dhcp_relay test, all passed

Signed-off-by: Yaqiang Zhu <yaqiangzhu@microsoft.com>
yaqiangz added a commit to sonic-net/sonic-dhcpmon that referenced this issue Jan 10, 2024
Cherry-pick from #14

Why I did it
Fix issue sonic-net/sonic-buildimage#15047
dhcp counter didn't restore after config reload

Work item tracking
Microsoft ADO (number only): 26270786
How I did it
Clear all counters when dhcpmon start
Remove clear counter in initialize_counter since they are cleared in previous
How to verify it
Build debian packet and install in DUT do manually testing
Run dhcp_relay test, all passed
@vivekrnv
Copy link
Contributor Author

Issue fixed in 202305 & 202311.

@yaqiangz Will this fix (sonic-net/sonic-dhcp-relay@5ae186f) be ported back to 202205?

@vivekrnv
Copy link
Contributor Author

Issue fixed in 202305 & 202311.

@yaqiangz Will this fix (sonic-net/sonic-dhcp-relay@5ae186f) be ported back to 202205?

++ @yxieca

@yaqiangz
Copy link
Contributor

yaqiangz commented Jan 26, 2024

Issue fixed in 202305 & 202311.

@yaqiangz Will this fix (sonic-net/sonic-dhcp-relay@5ae186f) be ported back to 202205?

@vivekrnv This PR is to fix counter issue in IPv6 per interface counter, but IPv6 per interface counter support haven't been backport to 202205

Hi @kellyyeh Seems this PR is to update to latest and backport #17841. May I know why we abandon it?

@vivekrnv
Copy link
Contributor Author

@yaqiangz, This is the problem i'm seeing. "If the config_db is updated (vlan is removed) and config reload is done, the stale entries in state_db are not deleted. Fix has to be in dhcp6relay (or container start script) to delete all the entries of the counter table during the process/container start"

I understand that the per-interface counter fix is not present in 202205. But the other problem exists. Will this be fixed

@vivekrnv
Copy link
Contributor Author

Hi @yaqiangz , @yxieca This issue in seen again. With this revert sonic-net/sonic-dhcp-relay@84e4419, we've also removed the changes to clear all the counters in state_db during dhcp init.

Please FYI

@yaqiangz
Copy link
Contributor

yaqiangz commented Nov 5, 2024

Confirmed that clear counters has been removed with reverting per-interface counter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants