[systemd-devel] [PATCH v3] Added support for Uplink Failure Detection using BindCarrier

Lennart Poettering lennart at poettering.net
Wed Feb 11 10:03:17 PST 2015


On Wed, 11.02.15 17:44, Rauta, Alin (alin.rauta at intel.com) wrote:

> Hi Lennart,
> 
> > +_public_ int sd_network_link_get_carriers(int ifindex, char ***ret) {
> > +        return network_get_link_strv("CARRIERS", ifindex, ret); }
> > +
> 
> >  I think it would be better to have two calls here:
> >
> >   int sd_network_link_get_carrier_bound_to(int ifindex, int **others);
> >   int sd_network_link_get_carrier_bound_by(int ifindex, int **others);
> 
> In terms of functionality, " sd_network_link_get_carriers " is
> actually " sd_network_link_get_carrier_bound_to" and is applicable
> to "bound to" links just like "BindCarrier=" is available only for
> "bound to" links. I wanted to save to systemd "run" files just
> minimum info.
> 
> If I add "sd_network_link_get_carrier_bound_by", then each time
> "link_save" is called for a link I should query "BindCarrier="s for
> all interfaces to print each link that bounds the current interface.
> Then, if I rename a link I should call "link_save" for all available
> links because the "BindCarrier=" can be interpreted in another way
> due to wildcards.

Well, one option could be to keep a set of bound_by and bound_to links
around for each link, and then just update that each time an interface
comes, goes, or changes names. That way you always have direct access
to the bound links, and don't have to resolve the globs each time you
need them, but only when they actually change?

The reason why I figured having two calls for this would be useful is
simply to make it easy to write tools like networkctl, which wants to
show this information in both directions for each interface...

> > +/* get the links that are bound to this port. */ static int 
> > +get_downlinks(const char *name,
> > +                         sd_rtnl_message *m,
> > +                         LinkInfo **downlinks,
> > +                         int *down_count) {
> 
> Regarding "get_uplinks" and "get_downlinks" I can rename them to
> "get_links_bound_to" and "get_links_bound_by". Would this be fine ?

Sure!

But before you rework any of this, let's see what Tom has to say, he's
the networkd maintainer...

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list