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

2017-10-13 Thread 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 ;-)

Lennart


Submitted PR for this:
https://github.com/systemd/systemd/pull/7091

Please check

Thank you,

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


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] Persistent address on "Lost carrier"

2017-06-16 Thread 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] Persistent address on "Lost carrier"

2017-06-16 Thread Lennart Poettering
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 ;-)

> Yes thats what I am looking for.

Well, you'd still use the tool outside of its intended usecase, so
ymmv...

Lennart

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


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

2017-06-15 Thread Amish



On Thursday 15 June 2017 03:07 PM, Mantas Mikulėnas wrote:
On Thu, Jun 15, 2017 at 11:21 AM, Lennart Poettering 
> wrote:


On Tue, 13.06.17 21:44, Amish (anon.am...@gmail.com
) wrote:

> Hello,
>
> I have the following in /etc/systemd/network/25-eth0.network
>
> [Match]
> MACAddress=00:11:22:33:44:55
>
> [Network]
> Address=192.168.1.32/24 
> Gateway=192.168.1.1
>
> Now I have few "dynamic" routes where destination IP keeps changing.
>
> Example:
> /usr/bin/ip route add to 1.2.3.4 via 192.168.1.2 (Different gateway)
>
> Many more routes are added by one script which keeps adding /
deleting
> routes based on certain algorithms.
>
> Since destination IP keeps changing, I can not put it in [Route]
section.
>
> Now my problem is, if for any reason the interface loses carrier
(cable
> fault / switch / router reboot), the IP associated with it is
removed and
> hence all the routes added by script gets lost.
>
> My question is how to stop this?
>
> How do I tell systemd to not to delete IP address on "Lost carrier"?
>
> I tried with:
>
> BindCarrier=lo
> OR
> BindCarrier=eth0
> OR
> BindCarrier=lo eth0
>
> But none worked.
>
> Any idea / suggestions? Something similar to -
CriticalConnection for DHCP?
>
> Or may be we can have Persistent=true in "[Network]" OR
"[Address]" section?

This is really not how networkd is supposed to be used. Either it
manages an interface in its entirety or not at all. It's not designed
to manage an interface only "half-way", i.e. manage addresses but not
the routes.


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.




Yes thats what I am looking for.

I wonder, if IP is "static IP" why should it remove it from interface? 
or atleast let administrator have an option to specify if IP should be 
deleted or not on "Lost carrier"


Also on a side note:

Even if I use [Route] section in .network file. There is still an issue.

Say I have two WAN connections. WAN1 and WAN2.

All traffic goes through WAN1. (default route)

But say I add [Route] section, telling that traffic to some networks is 
supposed to go via WAN2.


But no sooner the "Carrier" gets lost on WAN2, the routes added by 
[Route] section also gets deleted.


And traffic that was supposed to go via WAN2, start going through WAN1.

Ofcourse routes get readded when WAN2 "Gains carrier" but by that time 
some connection get dropped / interrupted / rejected by RST as packets 
went through WAN1 (which was not allowed).


Please consider of adding an option to Ignore "Lost carrier" atleast for 
static IPs.


Thanks and regards,

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


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

2017-06-15 Thread Mantas Mikulėnas
On Thu, Jun 15, 2017 at 11:21 AM, Lennart Poettering  wrote:

> On Tue, 13.06.17 21:44, Amish (anon.am...@gmail.com) wrote:
>
> > Hello,
> >
> > I have the following in /etc/systemd/network/25-eth0.network
> >
> > [Match]
> > MACAddress=00:11:22:33:44:55
> >
> > [Network]
> > Address=192.168.1.32/24
> > Gateway=192.168.1.1
> >
> > Now I have few "dynamic" routes where destination IP keeps changing.
> >
> > Example:
> > /usr/bin/ip route add to 1.2.3.4 via 192.168.1.2 (Different gateway)
> >
> > Many more routes are added by one script which keeps adding / deleting
> > routes based on certain algorithms.
> >
> > Since destination IP keeps changing, I can not put it in [Route] section.
> >
> > Now my problem is, if for any reason the interface loses carrier (cable
> > fault / switch / router reboot), the IP associated with it is removed and
> > hence all the routes added by script gets lost.
> >
> > My question is how to stop this?
> >
> > How do I tell systemd to not to delete IP address on "Lost carrier"?
> >
> > I tried with:
> >
> > BindCarrier=lo
> > OR
> > BindCarrier=eth0
> > OR
> > BindCarrier=lo eth0
> >
> > But none worked.
> >
> > Any idea / suggestions? Something similar to - CriticalConnection for
> DHCP?
> >
> > Or may be we can have Persistent=true in "[Network]" OR "[Address]"
> section?
>
> This is really not how networkd is supposed to be used. Either it
> manages an interface in its entirety or not at all. It's not designed
> to manage an interface only "half-way", i.e. manage addresses but not
> the routes.
>

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.

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


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

2017-06-15 Thread Lennart Poettering
On Tue, 13.06.17 21:44, Amish (anon.am...@gmail.com) wrote:

> Hello,
> 
> I have the following in /etc/systemd/network/25-eth0.network
> 
> [Match]
> MACAddress=00:11:22:33:44:55
> 
> [Network]
> Address=192.168.1.32/24
> Gateway=192.168.1.1
> 
> Now I have few "dynamic" routes where destination IP keeps changing.
> 
> Example:
> /usr/bin/ip route add to 1.2.3.4 via 192.168.1.2 (Different gateway)
> 
> Many more routes are added by one script which keeps adding / deleting
> routes based on certain algorithms.
> 
> Since destination IP keeps changing, I can not put it in [Route] section.
> 
> Now my problem is, if for any reason the interface loses carrier (cable
> fault / switch / router reboot), the IP associated with it is removed and
> hence all the routes added by script gets lost.
> 
> My question is how to stop this?
> 
> How do I tell systemd to not to delete IP address on "Lost carrier"?
> 
> I tried with:
> 
> BindCarrier=lo
> OR
> BindCarrier=eth0
> OR
> BindCarrier=lo eth0
> 
> But none worked.
> 
> Any idea / suggestions? Something similar to - CriticalConnection for DHCP?
> 
> Or may be we can have Persistent=true in "[Network]" OR "[Address]" section?

This is really not how networkd is supposed to be used. Either it
manages an interface in its entirety or not at all. It's not designed
to manage an interface only "half-way", i.e. manage addresses but not
the routes.

I am sorry, but networkd really isn't the right tool for what you are
trying to do.

Sorry,

Lennart

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