- path path_v4(address, *itf, p.weight, p.preference);
- ip_r.add(path_v4);
+ std::shared_ptr<interface> itf = interface::find(p.sw_if_index);
+ if (itf) {
+ if (p.is_dvr) {
+ path path_v4(*itf, nh_proto_t::IPV4, route::path::flags_t::DVR,
+ p.weight, p.preference);
+ ip_r.add(path_v4);
+ } else {
+ path path_v4(address, *itf, p.weight, p.preference);
+ ip_r.add(path_v4);
+ }
+ } else {
+ path path_v4(rd_temp, address, p.weight, p.preference);
+ ip_r.add(path_v4);
+ }