RE: DHCP lease renew

2018-12-24 Thread Usyskin, Alexander via networkmanager-list



> -Original Message-
> From: Thomas Haller [mailto:thal...@redhat.com]
> Sent: Monday, December 24, 2018 16:06
> To: Usyskin, Alexander ; networkmanager-
> l...@gnome.org
> Subject: Re: DHCP lease renew
> 
> On Mon, 2018-12-24 at 13:43 +, Usyskin, Alexander wrote:
> > > -Original Message-
> > > From: Thomas Haller [mailto:thal...@redhat.com]
> > > Sent: Monday, December 24, 2018 11:35
> > > To: Usyskin, Alexander ;
> > > networkmanager-
> > > l...@gnome.org
> > > Subject: Re: DHCP lease renew
> > >
> > > On Mon, 2018-12-24 at 08:03 +, Usyskin, Alexander via
> > > networkmanager-
> > > list wrote:
> > > > Hi
> > > >
> > > > I'm trying to force DHCP lease renew for specific interface.
> > > > Basically replicate in Linux IpRenewAddress function from Win32
> > > > API.
> > > > Without NetworkManager it's fairly simple, like "dhclient -r eth4
> > > > && dhclient -1 eth4".
> > > > But NetworkManager manages dhclient in different way, so that lead
> > > > to an unexpected consequences.
> > > >
> > > > I can't find a way to ask NetworkManager to forcefully renew the
> > > > lease. Neither through DBus API, nor from command line.
> > > > Is there any way to do such thing?
> > > > If not, how can I file an enhancement request?
> > > >
> > > > Please CC me on reply, I'm not subscribed to this list.
> > > >
> > > Hi,
> > >
> > >
> > > $ nmcli device reapply $IFNAME
> > >
> > > (or, on D-Bus, via Device's Reapply() method).
> > >
> > >
> > > (or, fully reactivate the profile, like)
> > >
> > >   nmcli connection up "$PROFILE"
> > >
> > >
> > > best,
> > > Thomas
> >
> > Tried to run reapply (via DBus call, but also tried nmcli), have
> > "NetworkManager[916]:   [1545650569.2423] audit: op="device-
> > reapply" interface="eth4" ifindex=2 pid=28554 uid=0 result="success"
> > "
> > in syslog, but no DHCP activity observed on the link.
> >
> > What I'm doing wrong here?
> >
> > For the record it's Ubuntu 16.04 LTS with nm version 1.2.6
> >
> > Thanks
> 
> 
> Hi,
> 
> 
> ah right. Reapply() doesn't restart DHCP. Sorry.
> 
> I guess, that leaves you with:
> 
> - a full reactivation, like
>   nmcli connection up "$PROFILE"
> 
> - disable and re-enable DHCP:
> 
>   nmlic device modifiy "$IFACE" ipv4.method disabled
>   nmlic device modifiy "$IFACE" ipv4.method auto
> 
>   This also uses Reapply() D-Bus method under the hood.
>   However, I don't know whether that works with 1.2.6, which is
>   2 years old.
> 
I can also toggle network card down/up using kernel netlink with same result, I 
assume.
> 
> Maybe you could explain, why you want to request a new lease?
> 
We have HW that tries to maintain network card up if OS is down. It need 
information from DHCP reply to do it.
Sometimes HW misses DHCP exchange and ask SW to retry. I can't change the HW...

> 
> best,
> Thomas


Thanks
--
Sasha



___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: DHCP lease renew

2018-12-24 Thread Thomas Haller via networkmanager-list
On Mon, 2018-12-24 at 13:43 +, Usyskin, Alexander wrote:
> > -Original Message-
> > From: Thomas Haller [mailto:thal...@redhat.com]
> > Sent: Monday, December 24, 2018 11:35
> > To: Usyskin, Alexander ;
> > networkmanager-
> > l...@gnome.org
> > Subject: Re: DHCP lease renew
> > 
> > On Mon, 2018-12-24 at 08:03 +, Usyskin, Alexander via
> > networkmanager-
> > list wrote:
> > > Hi
> > > 
> > > I'm trying to force DHCP lease renew for specific interface.
> > > Basically replicate in Linux IpRenewAddress function from Win32
> > > API.
> > > Without NetworkManager it's fairly simple, like "dhclient -r eth4
> > > &&
> > > dhclient -1 eth4".
> > > But NetworkManager manages dhclient in different way, so that
> > > lead to
> > > an unexpected consequences.
> > > 
> > > I can't find a way to ask NetworkManager to forcefully renew the
> > > lease. Neither through DBus API, nor from command line.
> > > Is there any way to do such thing?
> > > If not, how can I file an enhancement request?
> > > 
> > > Please CC me on reply, I'm not subscribed to this list.
> > > 
> > Hi,
> > 
> > 
> > $ nmcli device reapply $IFNAME
> > 
> > (or, on D-Bus, via Device's Reapply() method).
> > 
> > 
> > (or, fully reactivate the profile, like)
> > 
> >   nmcli connection up "$PROFILE"
> > 
> > 
> > best,
> > Thomas
> 
> Tried to run reapply (via DBus call, but also tried nmcli), have 
> "NetworkManager[916]:   [1545650569.2423] audit: op="device-
> reapply" interface="eth4" ifindex=2 pid=28554 uid=0 result="success"
> "
> in syslog, but no DHCP activity observed on the link.
> 
> What I'm doing wrong here?
> 
> For the record it's Ubuntu 16.04 LTS with nm version 1.2.6
> 
> Thanks


Hi,


ah right. Reapply() doesn't restart DHCP. Sorry.

I guess, that leaves you with:

- a full reactivation, like
  nmcli connection up "$PROFILE"

- disable and re-enable DHCP:

  nmlic device modifiy "$IFACE" ipv4.method disabled
  nmlic device modifiy "$IFACE" ipv4.method auto

  This also uses Reapply() D-Bus method under the hood.
  However, I don't know whether that works with 1.2.6, which is
  2 years old.


Maybe you could explain, why you want to request a new lease?


best,
Thomas


signature.asc
Description: This is a digitally signed message part
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


RE: DHCP lease renew

2018-12-24 Thread Usyskin, Alexander via networkmanager-list
> -Original Message-
> From: Thomas Haller [mailto:thal...@redhat.com]
> Sent: Monday, December 24, 2018 11:35
> To: Usyskin, Alexander ; networkmanager-
> l...@gnome.org
> Subject: Re: DHCP lease renew
> 
> On Mon, 2018-12-24 at 08:03 +, Usyskin, Alexander via networkmanager-
> list wrote:
> > Hi
> >
> > I'm trying to force DHCP lease renew for specific interface.
> > Basically replicate in Linux IpRenewAddress function from Win32 API.
> > Without NetworkManager it's fairly simple, like "dhclient -r eth4 &&
> > dhclient -1 eth4".
> > But NetworkManager manages dhclient in different way, so that lead to
> > an unexpected consequences.
> >
> > I can't find a way to ask NetworkManager to forcefully renew the
> > lease. Neither through DBus API, nor from command line.
> > Is there any way to do such thing?
> > If not, how can I file an enhancement request?
> >
> > Please CC me on reply, I'm not subscribed to this list.
> >
> Hi,
> 
> 
> $ nmcli device reapply $IFNAME
> 
> (or, on D-Bus, via Device's Reapply() method).
> 
> 
> (or, fully reactivate the profile, like)
> 
>   nmcli connection up "$PROFILE"
> 
> 
> best,
> Thomas

Tried to run reapply (via DBus call, but also tried nmcli), have 
"NetworkManager[916]:   [1545650569.2423] audit: op="device-reapply" 
interface="eth4" ifindex=2 pid=28554 uid=0 result="success" "
in syslog, but no DHCP activity observed on the link.

What I'm doing wrong here?

For the record it's Ubuntu 16.04 LTS with nm version 1.2.6

Thanks
--
Sasha





___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: signal for (De)ActivateConnection?

2018-12-24 Thread Thomas Haller via networkmanager-list
On Sun, 2018-12-23 at 23:41 +0100, Michael Hirmke wrote:
> Hi,
> 
> after a long time I found some time to start the rewrite of my
> script.
> There are a few questions remaining, though.
> 
> If I understood correctly, for a generic script I have to iterate
> over
> all existing connections (ListConnections).
> What I don't understand actually is how to get a relation between the
> connection settings object and an existing active connection object.
> Do I have to iterate over all active connections and find a matching
> uuid? Or do we have a simpler way to get to this
> relation/information?

Yes, that's one way.

Of, if you know already which Device you are interested in, you can get
from the device to the active connection to the (settings) connection.


best,
Thomas

> 
> Thx.
> 
> Bye.
> Michael.
> 
> [...]
> > Hi,
> > sounds a bit like you want to perform some action when a particular
> > connection profile activates/deactivates.
> > First, you need to know which a connection profile you care about,
> > that
> > is, you need its /org/freedesktop/NetworkManager/Settings/* path.
> > You need to call GetSettings() on each of the profiles, to match
> > what
> > you are looking for (for example, matching the connection.id).
> > When a connection is activated, it has an active-connection that
> > references it. Usually there is at most one such active-connection,
> > but while re-activating a connection there can be multiple once
> > (one
> > that is about to deactivate, and once that is about to activate).
> > Anyway, you need to monitor these active connections for whether
> > they
> > reference the profile you care about. The Manager's PropertyChanged
> > event for ActiveConnections notifies you when active-connection
> > come to
> > be and cease to exist.
> > The ActiveConnection basically ties the profile to the networking
> > device.
> > and as said, an active VPN connection is a bit odd, they are
> > active-
> > connections too (with an additional
> > org.freedesktop.NetworkManager.VPN.Connection interface).
> > I would inspect the state with the "d-feet" GUI.
> > You could also use libnm via GObject introspection (e.g. from Perl
> > or
> > Python). That might be more convenient to use, then a plain D-Bus
> > library (the latter works of course too). We don't have any perl
> > examples, only Python:
> > https://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/pyth
> > on
> > best,
> > Thomas


signature.asc
Description: This is a digitally signed message part
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: DHCP lease renew

2018-12-24 Thread Thomas Haller via networkmanager-list
On Mon, 2018-12-24 at 08:03 +, Usyskin, Alexander via
networkmanager-list wrote:
> Hi
> 
> I'm trying to force DHCP lease renew for specific interface.
> Basically replicate in Linux IpRenewAddress function from Win32 API.
> Without NetworkManager it's fairly simple, like "dhclient -r eth4 &&
> dhclient -1 eth4".
> But NetworkManager manages dhclient in different way, so that lead to
> an unexpected consequences.
> 
> I can't find a way to ask NetworkManager to forcefully renew the
> lease. Neither through DBus API, nor from command line.
> Is there any way to do such thing?
> If not, how can I file an enhancement request?
> 
> Please CC me on reply, I'm not subscribed to this list.
> 
Hi,


$ nmcli device reapply $IFNAME

(or, on D-Bus, via Device's Reapply() method).


(or, fully reactivate the profile, like)

  nmcli connection up "$PROFILE"


best,
Thomas


signature.asc
Description: This is a digitally signed message part
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


DHCP lease renew

2018-12-24 Thread Usyskin, Alexander via networkmanager-list
Hi

I'm trying to force DHCP lease renew for specific interface. Basically 
replicate in Linux IpRenewAddress function from Win32 API.
Without NetworkManager it's fairly simple, like "dhclient -r eth4 && dhclient 
-1 eth4".
But NetworkManager manages dhclient in different way, so that lead to an 
unexpected consequences.

I can't find a way to ask NetworkManager to forcefully renew the lease. Neither 
through DBus API, nor from command line.
Is there any way to do such thing?
If not, how can I file an enhancement request?

Please CC me on reply, I'm not subscribed to this list.

Thanks
--
Alexander (Sasha) Usyskin

CSE FW Dev - Host SW
Intel Israel (74) Limited


___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list