On 2/4/25 10:00 AM, Felix Huettner wrote:
>>> +static int
>>> +modify_route(uint32_t type, uint32_t flags_arg, uint32_t table_id,
>>> +             const struct in6_addr *dst, unsigned int plen)
>>> +{
>>> +    uint32_t flags = NLM_F_REQUEST | NLM_F_ACK;
>>> +    bool is_ipv4 = IN6_IS_ADDR_V4MAPPED(dst);
>>> +    struct ofpbuf request;
>>> +    struct rtmsg *rt;
>>> +    int err;
>>> +
>>> +    flags |= flags_arg;
>>> +
>>> +    ofpbuf_init(&request, 0);
>>> +    nl_msg_put_nlmsghdr(&request, 0, type, flags);
>>> +    rt = ofpbuf_put_zeros(&request, sizeof *rt);
>>> +    rt->rtm_family = is_ipv4 ? AF_INET : AF_INET6;
>>> +    rt->rtm_table = RT_TABLE_UNSPEC; /* RTA_TABLE attribute allows id > 
>>> 256 */
>>> +    /* Manage only OVN routes */
>>> +    rt->rtm_protocol = RTPROT_OVN;
>>> +    rt->rtm_type = RTN_BLACKHOLE;
>>> +    if (type == RTM_DELROUTE) {
>>> +        rt->rtm_scope = RT_SCOPE_NOWHERE;
>>> +    } else {
>>> +        rt->rtm_scope = RT_SCOPE_UNIVERSE;
>>> +    }
>> I'm not sure I understand why on delete we need to set the scope to
>> RT_SCOPE_NOWHERE..  I didn't try passing RT_SCOPE_UNIVERSE for both
>> cases but would that cause issues?
> Not sure, but using RT_SCOPE_UNIVERSE generally just works.

In that case I think I'd prefer we use the same values when
adding/deleting the route - in this case RT_SCOPE_UNIVERSE.

Thanks,
Dumitru

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to