Re: [systemd-devel] Persistent address on "Lost carrier"

2017-06-24 Thread Amish

Resending my previous email as I would really want this feature.

I asked for help on IRC channel too but it hardly appears active.

Amish.

On Friday 16 June 2017 01:06 PM, Lennart Poettering wrote:

On Thu, 15.06.17 18:22, Amish (anon.am...@gmail.com) wrote:


Hmm, that wasn't the actual question though, was it? The point was just
to make networkd ignore carrier status (i.e. often there's no need to
remove addresses just because the interface is down for a moment), not
to stop managing halfway.

Adding an option "IgnoreCarrier=" or so would be OK I figure. Best way
to get it implemented is submitting a PR for it ;-)



Ok I am completely new to systemd.

So looking at the code and trying to figure out the flow.

I believe I have to add IgnoreCarrier option in link-config.[ch] file.

Function that handles "Lost/Gain Carrier" is in networkd-link.c

There are two struct here: one is "link_config" and other is "Link"

link-config is what will store boolean ignore_carrier. (or any
configuration value)

Link is what stores actual link data. (carrier status)

I am kind of stuck at one place. Searched a lot - but could not figure out.

I could not find anyway to find underlying "link_config" associated with
"Link".

For example:
Inside networkd-link.c how do I check this:

if (Link->link_config->ignore_carrier) {
// do nothing
}
else {
// continue existing code
}

Please also have a look at whatever I have done so far, here:
https://github.com/amishxda/systemd/commits/master

Thanks

Amish.

PS: Dont know if this list is right place to ask such questions.
But since its "-devel" mailing list I am posting here.

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Returning arrays from sd-bus methods

2017-06-24 Thread Lennart Poettering
On Fri, 23.06.17 20:45, guhan balasubramanian (guhan@gmail.com) wrote:

> Hi,
> 
> I'm currently trying out sd-bus methods for my application. I am in a
> situation where I must accept an input and return a byte array based on the
> input.
> 
> In the vtable. the following declaration is present:
> SD_BUS_METHOD("method_id", "x", "ay", method_1, 0)
> 
> And inside the definition for method_1, for returning:
> uint8_t b[2] = {0x01, 0x02};
> sd_bus_reply_method_return(m, "ay", b);

if you use sd_bus_reply_method_return() (or sd_bus_append()) the
arguments to pass for an array is the array's size followed by the
members. Hence, the following should do what you want:

sd_bus_reply_method_return(m, "ay", 2, 0x01, 0x02);

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel