[Babel-users] fun with babeld for a change

Dave Taht dave.taht at gmail.com
Thu Oct 4 05:59:11 BST 2018


I made a bit of progress towards atomic updates (odhcpd has a really nice
netlink library worth looking at, and they seem to be doing it), and got my xnor
branch (replacing most calls to memcmp with xor and or working pretty
well. For giggles, I added inline qsort to that just now, and it
worked on the second try, which never happens for me. I see *really
good * en-registerization now on the x86_64 in flushupdates()

(it is outputting the right number of packets, in order, with
typically 7 byte compression
 on the rtod -r 4096 test)

https://github.com/dtaht/babeld/commits/babeld-xnor

I haven't tried it on arm64, arm or mips, yet. Gonna let it run overnight.

next up is to see what can be done for a xroute_stream.
...

of interest in the odhcpd code is the scope link and scope nowhere and
rtn_unspec
code which all looks different from how babeld does things currently.

int netlink_setup_route(const struct in6_addr *addr, const int prefixlen,
                const int ifindex, const struct in6_addr *gw,
                const uint32_t metric, const bool add)

{
        struct nl_msg *msg;
        struct rtmsg rtm = {
                .rtm_family = AF_INET6,
                .rtm_dst_len = prefixlen,
                .rtm_src_len = 0,
                .rtm_table = RT_TABLE_MAIN,
                .rtm_protocol = (add ? RTPROT_STATIC : RTPROT_UNSPEC),
                .rtm_scope = (add ? (gw ? RT_SCOPE_UNIVERSE :
RT_SCOPE_LINK) : RT_SCOPE_NOWHERE),
                .rtm_type = (add ? RTN_UNICAST : RTN_UNSPEC),
        };
        int ret = 0;

        msg = nlmsg_alloc_simple(add ? RTM_NEWROUTE : RTM_DELROUTE,
                                        add ? NLM_F_CREATE | NLM_F_REPLACE : 0);
        if (!msg)
                return -1;

        nlmsg_append(msg, &rtm, sizeof(rtm), 0);

        nla_put(msg, RTA_DST, sizeof(*addr), addr);
        nla_put_u32(msg, RTA_OIF, ifindex);
        nla_put_u32(msg, RTA_PRIORITY, metric);

        if (gw)
                nla_put(msg, RTA_GATEWAY, sizeof(*gw), gw);

        ret = nl_send_auto_complete(rtnl_socket, msg);
        nlmsg_free(msg);

        if (ret < 0)
                return ret;

        return nl_wait_for_ack(rtnl_socket);
}

-- 

Dave Täht
CEO, TekLibre, LLC
http://www.teklibre.com
Tel: 1-669-226-2619



More information about the Babel-users mailing list