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

Question about default route setup #240

Open
freak82 opened this issue Jan 31, 2020 · 1 comment
Open

Question about default route setup #240

freak82 opened this issue Jan 31, 2020 · 1 comment

Comments

@freak82
Copy link

freak82 commented Jan 31, 2020

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.

@MatiasElo
Copy link
Contributor

You may get some useful info if you configure OFP with --enable-debug flag.

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

No branches or pull requests

2 participants