I tried the following.

 

In my test_plugin.py file, I added this line which has is_add =1, and flags
= IP_NEIGHBOR_FLAG_STATIC

 

self.vapi.ip_neighbor_add_del(self.pg1.sw_if_index,

                              '00:25:90:eb:e8:ed',

                              '2002::2',

                              1, 1)

 

In the plugin .c code, I try to find the entry but the find fails.
ip_neighbor_get_mac() returns a zero mac-addr.

 

           ip_address_t ip;

    ip.version = AF_IP6;

    clib_memcpy_fast(&(ip.ip.ip6), &hdr->ipv6.dst_address[0], 16);

    ip_neighbor_key_t key;

    key.ipnk_ip = ip;

    key.ipnk_sw_if_index = ump->eg_int_sw_index;

    ip_neighbor_t ipn;

    ipn.ipn_key = &key;

    const mac_address_t *dmac = ip_neighbor_get_mac(&ipn);

    u8 *s2 = NULL;

    u8 *s1 = NULL;

    s1 = format(0, "%U", format_ip6_address, &(ip.ip.ip6));

    if (dmac) {

      s2 = format(0, "%U", format_mac_address, dmac);

      fprintf(stderr, "UPF6 dst mac = %s, ip6 = %s, if_index = %d\n", s2,
s1, key.ipnk_sw_if_index);

               

The fprintf from C code shows: UPF6 dst mac = 00:00:00:00:00:00, ip6 =
2002::2 , if_index = 2

 

What am I doing wrong?

 

Thanks,

 

Hemant

 

From: vpp-dev@lists.fd.io <vpp-dev@lists.fd.io> On Behalf Of hemant via
lists.fd.io
Sent: Thursday, April 15, 2021 4:33 PM
To: vpp-dev@lists.fd.io
Subject: [vpp-dev] dst mac-address look up?

 

I read this link:
https://fdio-vpp.readthedocs.io/en/latest/gettingstarted/developers/fib20/ar
pentries.html

 

At the end of the page, I see text that says "key for which is {interface,
next-hop, link-type}."

 

I have the data for the above key, but what API do I use to find destination
mac-address?

 

Hemant

Attachment: smime.p7s
Description: S/MIME cryptographic signature

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#19220): https://lists.fd.io/g/vpp-dev/message/19220
Mute This Topic: https://lists.fd.io/mt/82127329/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to