DPDK patches and discussions
 help / color / mirror / Atom feed
* [Bug 1160] IPv4 FIB 0.0.0.0/0 route doesn't work when first route added to FIB and using TBL24_8
@ 2023-02-12  9:30 bugzilla
  2023-07-31 13:02 ` bugzilla
  0 siblings, 1 reply; 2+ messages in thread
From: bugzilla @ 2023-02-12  9:30 UTC (permalink / raw)
  To: dev

[-- Attachment #1: Type: text/plain, Size: 2228 bytes --]

https://bugs.dpdk.org/show_bug.cgi?id=1160

            Bug ID: 1160
           Summary: IPv4 FIB 0.0.0.0/0 route doesn't work when first route
                    added to FIB and using TBL24_8
           Product: DPDK
           Version: 22.11
          Hardware: x86
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: Normal
         Component: other
          Assignee: dev@dpdk.org
          Reporter: gareth235711@googlemail.com
  Target Milestone: ---

I think there's an issue with rte_fib which occurs when both of the following
conditions are met:
  1. A route of 0.0.0.0/0 is the first route added to the FIB
  2. The FIB is configured with type RTE_FIB_DIR24_8

Under these conditions, rte_fib_add returns with no error but subsequent
lookups that should hit the 0.0.0.0/0 route (and miss all others) return the
default next hop from the FIB config, not the next hop specified when adding
the 0.0.0.0/0.

If another route with a longer prefix is added first, the 0.0.0.0/0 route works
as expected. 



void test0(void) {
    struct rte_fib_conf config = {
        .max_routes = 1024,
        .rib_ext_sz = 0,
        .default_nh = 0xDEFA,
        .type = RTE_FIB_DIR24_8, /* test passes for RTE_FIB_DUMMY */
        .dir24_8.num_tbl8 = 256,
        .dir24_8.nh_sz = RTE_FIB_DIR24_8_4B,
    };

    struct rte_fib* fib = rte_fib_create("test-fib0", rte_socket_id(),
&config);
    RTE_ASSERT(fib);

    int ret;

    /* works as expected if we add another route before the default route */
    //ret = rte_fib_add(fib, RTE_IPV4(192,168,0,0), 24, 0x1);
    //RTE_ASSERT(0 == ret);

    uint64_t next_hop;
    uint32_t ip = RTE_IPV4(10,0,0,1);
    ret = rte_fib_lookup_bulk(fib, &ip, &next_hop, 1);
    RTE_ASSERT(0 == ret);
    RTE_ASSERT(next_hop == 0xDEFA);

    ret = rte_fib_add(fib, RTE_IPV4(0,0,0,0), 0, 0x1);
    RTE_ASSERT(0 == ret);

    ret = rte_fib_lookup_bulk(fib, &ip, &next_hop, 1);
    RTE_ASSERT(0 == ret);
    printf("nh: 0x%"PRIx64"\n", next_hop);
    RTE_ASSERT(next_hop == 1); /* assertion fail */
}

-- 
You are receiving this mail because:
You are the assignee for the bug.

[-- Attachment #2: Type: text/html, Size: 4170 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-07-31 13:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-12  9:30 [Bug 1160] IPv4 FIB 0.0.0.0/0 route doesn't work when first route added to FIB and using TBL24_8 bugzilla
2023-07-31 13:02 ` bugzilla

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).