1
- #include " intfsorch.h"
2
-
3
- #include " ipprefix.h"
4
- #include " logger.h"
5
-
6
- #include " assert.h"
1
+ #include < assert.h>
7
2
#include < fstream>
8
3
#include < sstream>
9
4
#include < map>
10
-
11
5
#include < net/if.h>
12
6
7
+ #include " intfsorch.h"
8
+ #include " ipprefix.h"
9
+ #include " logger.h"
10
+ #include " swssnet.h"
11
+
13
12
extern sai_object_id_t gVirtualRouterId ;
14
13
15
14
extern sai_router_interface_api_t * sai_router_intfs_api;
@@ -83,9 +82,8 @@ void IntfsOrch::doTask(Consumer &consumer)
83
82
84
83
sai_unicast_route_entry_t unicast_route_entry;
85
84
unicast_route_entry.vr_id = gVirtualRouterId ;
86
- unicast_route_entry.destination .addr_family = SAI_IP_ADDR_FAMILY_IPV4;
87
- unicast_route_entry.destination .addr .ip4 = ip_prefix.getIp ().getV4Addr () & ip_prefix.getMask ().getV4Addr ();
88
- unicast_route_entry.destination .mask .ip4 = ip_prefix.getMask ().getV4Addr ();
85
+ copy (unicast_route_entry.destination , ip_prefix);
86
+ subnet (unicast_route_entry.destination , unicast_route_entry.destination );
89
87
90
88
sai_attribute_t attr;
91
89
vector<sai_attribute_t > attrs;
@@ -121,9 +119,7 @@ void IntfsOrch::doTask(Consumer &consumer)
121
119
ip2me_attrs.push_back (ip2me_attr);
122
120
123
121
unicast_route_entry.vr_id = gVirtualRouterId ;
124
- unicast_route_entry.destination .addr_family = SAI_IP_ADDR_FAMILY_IPV4;
125
- unicast_route_entry.destination .addr .ip4 = ip_prefix.getIp ().getV4Addr ();
126
- unicast_route_entry.destination .mask .ip4 = 0xFFFFFFFF ;
122
+ copy (unicast_route_entry.destination , ip_prefix.getIp ());
127
123
128
124
status = sai_route_api->create_route (&unicast_route_entry, ip2me_attrs.size (), ip2me_attrs.data ());
129
125
if (status != SAI_STATUS_SUCCESS)
@@ -152,9 +148,8 @@ void IntfsOrch::doTask(Consumer &consumer)
152
148
153
149
sai_unicast_route_entry_t unicast_route_entry;
154
150
unicast_route_entry.vr_id = gVirtualRouterId ;
155
- unicast_route_entry.destination .addr_family = SAI_IP_ADDR_FAMILY_IPV4;
156
- unicast_route_entry.destination .addr .ip4 = ip_prefix.getIp ().getV4Addr () & ip_prefix.getMask ().getV4Addr ();
157
- unicast_route_entry.destination .mask .ip4 = ip_prefix.getMask ().getV4Addr ();
151
+ copy (unicast_route_entry.destination , ip_prefix);
152
+ subnet (unicast_route_entry.destination , unicast_route_entry.destination );
158
153
159
154
sai_status_t status = sai_route_api->remove_route (&unicast_route_entry);
160
155
if (status != SAI_STATUS_SUCCESS)
@@ -165,9 +160,7 @@ void IntfsOrch::doTask(Consumer &consumer)
165
160
}
166
161
167
162
unicast_route_entry.vr_id = gVirtualRouterId ;
168
- unicast_route_entry.destination .addr_family = SAI_IP_ADDR_FAMILY_IPV4;
169
- unicast_route_entry.destination .addr .ip4 = ip_prefix.getIp ().getV4Addr ();
170
- unicast_route_entry.destination .mask .ip4 = 0xFFFFFFFF ;
163
+ copy (unicast_route_entry.destination , ip_prefix);
171
164
172
165
status = sai_route_api->remove_route (&unicast_route_entry);
173
166
if (status != SAI_STATUS_SUCCESS)
0 commit comments