Skip to content

Question about default route setup #240

@freak82

Description

@freak82

Hi there,

I'm researching the capabilities of the OpenFastPath stack.
I hit a problem where my packets get dropped and found that my rule for default route doesn't work.
The packets get dropped because ofp_get_next_hop can't find next hop when processing output packets.
I'm able to reproduce and show my problem with the following simplified snippet:

        struct ofp_route_msg rtpars = {
                                       .type    = OFP_ROUTE_ADD,                
                                       .flags   = OFP_RTF_GATEWAY,
                                       .dst     = 0x00000000,        
                                       .masklen = 0,                            
                                       .gw      = 0x011E140A, // 10.20.30.1        
                                       .port    = 0,                            
                                       .vlan    = 0,                            
                                       .vrf     = 0,                            
                                       .dst6    = {},                          
                                       .gw6     = {}};                          
        ofp_set_route_msg(&rtpars);                                            
        usleep(1'000'000);                                                      
        ofp_show_routes(STDOUT_FILENO, OFP_SHOW_ROUTES);                                                                      
        uint32_t flags = 0;                                                    
        uint32_t addr  = 0x051E140A; // 10.20.30.5                              
        printf("Next hop %p for %s\n",                                          
               ofp_get_next_hop(rtpars.vrf, addr, &flags),                      
               ofp_print_ip_addr(addr));

This code prints:

Destination        Gateway         Iface  Flags
VRF: 0
0.0.0.0/0          10.20.30.1      fp0    net gateway
Next hop (nil) for 10.20.30.5   <----- Next hop is not found for this ip address

And just to make sure that the above snippet actually works. If I do this change in the above code

                                       .dst     = 0x001E140A, // 10.20.30.0    
                                       .masklen = 24,

then the code prints:

Destination        Gateway         Iface  Flags
VRF: 0
10.20.30.0/24      10.20.30.1      fp0    net gateway
Next hop 0x7f5e106e936c for 10.20.30.5    <----- Next hop is found

So, my question is: What I'm doing wrong and how can I setup default route for all packets?

Thanks,
Pavel.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions