diff mbox series

[ovs-dev,v1,6/6] route-table: Store ifindex for received routes.

Message ID 70e6a78ce7bd152ccac6db99d49a532ed342f69f.1729784574.git.felix.huettner@stackit.cloud
State Superseded
Delegated to: Eelco Chaudron
Headers show
Series OVS Patches for OVN Fabric Integration | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed

Commit Message

Felix Huettner Oct. 24, 2024, 3:46 p.m. UTC
Sometimes it is not easily possible to convert the interface index to a
name. Especially if we run in network namespaces.
To still be able to act on existing information we also return the
ifindex now.

Signed-off-by: Felix Huettner <felix.huettner@stackit.cloud>
---
 lib/route-table.c | 1 +
 lib/route-table.h | 1 +
 2 files changed, 2 insertions(+)

Comments

Eelco Chaudron Nov. 14, 2024, 12:32 p.m. UTC | #1
On 24 Oct 2024, at 17:46, Felix Huettner via dev wrote:

> Sometimes it is not easily possible to convert the interface index to a
> name. Especially if we run in network namespaces.
> To still be able to act on existing information we also return the
> ifindex now.

Why are we not changing the namespace and getting the interface name? Is this too much of an overhead?

In addition, if the interface is not found, we set change->relevant = false, how does this affect the overall implementation?

//Eelco

>
> Signed-off-by: Felix Huettner <felix.huettner@stackit.cloud>
> ---
>  lib/route-table.c | 1 +
>  lib/route-table.h | 1 +
>  2 files changed, 2 insertions(+)
>
> diff --git a/lib/route-table.c b/lib/route-table.c
> index 80325f6f9..ce70382a4 100644
> --- a/lib/route-table.c
> +++ b/lib/route-table.c
> @@ -228,6 +228,7 @@ route_table_add_nexthop(struct route_table_msg *change,
>          }
>      }
>
> +    nh->ifindex = ifindex;
>      if (ifindex && !if_indextoname(ifindex, nh->ifname)) {
>          int error = errno;
>
> diff --git a/lib/route-table.h b/lib/route-table.h
> index f96dbebb3..bcc3205e8 100644
> --- a/lib/route-table.h
> +++ b/lib/route-table.h
> @@ -30,6 +30,7 @@
>
>  struct route_data_nexthop {
>      struct in6_addr rta_gw;
> +    uint32_t ifindex;
>      char ifname[IFNAMSIZ]; /* Interface name. */
>  };
>
> --
Felix Huettner Nov. 25, 2024, 10:38 a.m. UTC | #2
On Thu, Nov 14, 2024 at 01:32:38PM +0100, Eelco Chaudron wrote:
> On 24 Oct 2024, at 17:46, Felix Huettner via dev wrote:
> 
> > Sometimes it is not easily possible to convert the interface index to a
> > name. Especially if we run in network namespaces.
> > To still be able to act on existing information we also return the
> > ifindex now.

Hi Eelco,

> 
> Why are we not changing the namespace and getting the interface name? Is this too much of an overhead?

thanks for the feedback.
I changed the implementation in the next version.
That also makes the OVN side significantly more useable.

> 
> In addition, if the interface is not found, we set change->relevant = false, how does this affect the overall implementation?

I would assume this is addressed with the change above.

Thanks a lot
Felix

> 
> //Eelco
> 
> >
> > Signed-off-by: Felix Huettner <felix.huettner@stackit.cloud>
> > ---
> >  lib/route-table.c | 1 +
> >  lib/route-table.h | 1 +
> >  2 files changed, 2 insertions(+)
> >
> > diff --git a/lib/route-table.c b/lib/route-table.c
> > index 80325f6f9..ce70382a4 100644
> > --- a/lib/route-table.c
> > +++ b/lib/route-table.c
> > @@ -228,6 +228,7 @@ route_table_add_nexthop(struct route_table_msg *change,
> >          }
> >      }
> >
> > +    nh->ifindex = ifindex;
> >      if (ifindex && !if_indextoname(ifindex, nh->ifname)) {
> >          int error = errno;
> >
> > diff --git a/lib/route-table.h b/lib/route-table.h
> > index f96dbebb3..bcc3205e8 100644
> > --- a/lib/route-table.h
> > +++ b/lib/route-table.h
> > @@ -30,6 +30,7 @@
> >
> >  struct route_data_nexthop {
> >      struct in6_addr rta_gw;
> > +    uint32_t ifindex;
> >      char ifname[IFNAMSIZ]; /* Interface name. */
> >  };
> >
> > --
>
diff mbox series

Patch

diff --git a/lib/route-table.c b/lib/route-table.c
index 80325f6f9..ce70382a4 100644
--- a/lib/route-table.c
+++ b/lib/route-table.c
@@ -228,6 +228,7 @@  route_table_add_nexthop(struct route_table_msg *change,
         }
     }
 
+    nh->ifindex = ifindex;
     if (ifindex && !if_indextoname(ifindex, nh->ifname)) {
         int error = errno;
 
diff --git a/lib/route-table.h b/lib/route-table.h
index f96dbebb3..bcc3205e8 100644
--- a/lib/route-table.h
+++ b/lib/route-table.h
@@ -30,6 +30,7 @@ 
 
 struct route_data_nexthop {
     struct in6_addr rta_gw;
+    uint32_t ifindex;
     char ifname[IFNAMSIZ]; /* Interface name. */
 };