Skip to content

Commit f46fd89

Browse files
committed
Add support for local routes
Signed-off-by: Fredi Raspall <[email protected]>
1 parent 39effba commit f46fd89

File tree

4 files changed

+24
-17
lines changed

4 files changed

+24
-17
lines changed

clib/src/display.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ const char *err2str(int e)
129129
const char *route_type_str(RouteType rt)
130130
{
131131
switch (rt) {
132+
case Local:
133+
return "Local";
132134
case Connected:
133135
return "connected";
134136
case Static:
@@ -150,9 +152,12 @@ const char *route_type_str(RouteType rt)
150152
const char *route_fwaction_str(ForwardAction a)
151153
{
152154
switch (a) {
153-
case Forward: return "forward";
154-
case Drop: return "drop";
155-
default: return "unknown";
155+
case Forward:
156+
return "forward";
157+
case Drop:
158+
return "drop";
159+
default:
160+
return "unknown";
156161
}
157162
}
158163

clib/src/dp_objects.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ struct ver_info {
2727
};
2828

2929
struct conn_info {
30-
char name [MAX_STRING_LEN + 1];
30+
char name[MAX_STRING_LEN + 1];
3131
uint32_t pid;
3232
struct ver_info verinfo;
3333
};
@@ -105,7 +105,7 @@ int ip_route_add_nhop(struct ip_route *route, struct next_hop *nhop);
105105
/* utils to wrap objects */
106106
int rmac_as_object(struct RpcObject *object, struct rmac *rmac);
107107
int ifaddress_as_object(struct RpcObject *object, struct ifaddress *ifaddr);
108-
int conninfo_as_object(struct RpcObject *object,struct conn_info *info);
108+
int conninfo_as_object(struct RpcObject *object, struct conn_info *info);
109109
int iproute_as_object(struct RpcObject *object, struct ip_route *route);
110110
int getfilter_as_object(struct RpcObject *object, struct get_filter *filter);
111111

clib/src/proto.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,13 @@ typedef uint8_t ObjType;
9090
*A type of route.
9191
*/
9292
enum RouteType {
93-
Connected = 1,
94-
Static = 2,
95-
Ospf = 3,
96-
Isis = 4,
97-
Bgp = 5,
98-
Other = 6,
93+
Local = 1,
94+
Connected = 2,
95+
Static = 3,
96+
Ospf = 4,
97+
Isis = 5,
98+
Bgp = 6,
99+
Other = 7,
99100
};
100101
typedef uint8_t RouteType;
101102

src/proto.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,14 @@ pub enum ObjType {
7777
#[repr(u8)]
7878
#[derive(Copy, Clone, Debug, Default, FromPrimitive, PartialEq)]
7979
pub enum RouteType {
80-
Connected = 1,
81-
Static = 2,
82-
Ospf = 3,
83-
Isis = 4,
84-
Bgp = 5,
80+
Local = 1,
81+
Connected = 2,
82+
Static = 3,
83+
Ospf = 4,
84+
Isis = 5,
85+
Bgp = 6,
8586
#[default]
86-
Other = 6,
87+
Other = 7,
8788
}
8889

8990
#[doc = "Action associated to a route"]

0 commit comments

Comments
 (0)