[ovs-dev] [PATCH ovn v2 1/2] controller: add ipv6_pd debug messages

Lorenzo Bianconi lorenzo.bianconi at redhat.com
Fri Aug 6 09:01:01 UTC 2021


Introduce some log messages in IPv6 Prefix delegation processing useful
for debugging

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi at redhat.com>
---
 controller/pinctrl.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/controller/pinctrl.c b/controller/pinctrl.c
index 52c68b9e9..503d5686c 100644
--- a/controller/pinctrl.c
+++ b/controller/pinctrl.c
@@ -771,6 +771,13 @@ pinctrl_parse_dhcpv6_advt(struct rconn *swconn, const struct flow *ip_flow,
 
     pfd->state = PREFIX_REQUEST;
 
+    static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(20, 40);
+    char ip6_s[INET6_ADDRSTRLEN + 1];
+    if (ipv6_string_mapped(ip6_s, &ip_flow->ipv6_src)) {
+        VLOG_DBG_RL(&rl, "Received DHCPv6 advt from %s with aid %d"
+                    " sending DHCPv6 request", ip6_s, aid);
+    }
+
     uint64_t packet_stub[256 / 8];
     struct dp_packet packet;
 
@@ -939,6 +946,14 @@ pinctrl_parse_dhcpv6_reply(struct dp_packet *pkt_in,
         in_dhcpv6_data += opt_len;
     }
     if (status) {
+        static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(20, 40);
+        char prefix[INET6_ADDRSTRLEN + 1];
+        char ip6_s[INET6_ADDRSTRLEN + 1];
+        if (ipv6_string_mapped(ip6_s, &ip_flow->ipv6_src) &&
+            ipv6_string_mapped(prefix, &ipv6)) {
+            VLOG_DBG_RL(&rl, "Received DHCPv6 reply from %s with prefix %s/%d"
+                        " aid %d", ip6_s, prefix, prefix_len, aid);
+        }
         pinctrl_prefixd_state_handler(ip_flow, ipv6, aid, eth->eth_src,
                                       in_ip->ip6_src, prefix_len, t1, t2,
                                       plife_time, vlife_time, uuid, uuid_len);
@@ -1228,19 +1243,27 @@ fill_ipv6_prefix_state(struct ovsdb_idl_txn *ovnsb_idl_txn,
                 pfd->prefix = in6addr_any;
             }
         } else if (pfd->state == PREFIX_PENDING && ovnsb_idl_txn) {
+            static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(20, 40);
             char prefix_str[INET6_ADDRSTRLEN + 1] = {};
             struct smap options;
 
+            if (!ipv6_string_mapped(prefix_str, &pfd->prefix)) {
+                goto out;
+            }
+            VLOG_DBG_RL(&rl, "updating port_binding for %s with prefix %s/%d"
+                        " aid %d", pb->logical_port, prefix_str, pfd->plen,
+                        pfd->aid);
+
             pfd->state = PREFIX_DONE;
             pfd->last_complete = time_msec();
             pfd->next_announce = pfd->last_complete + pfd->t1;
-            ipv6_string_mapped(prefix_str, &pfd->prefix);
             smap_clone(&options, &pb->options);
             smap_add_format(&options, "ipv6_ra_pd_list", "%d:%s/%d",
                             pfd->aid, prefix_str, pfd->plen);
             sbrec_port_binding_set_options(pb, &options);
             smap_destroy(&options);
         }
+out:
         pfd->last_used = time_msec();
         destroy_lport_addresses(&c_addrs);
     }
-- 
2.31.1



More information about the dev mailing list