###
### This file is part of Trivial IP Encryption (TrIPE).
###
-### TrIPE is free software; you can redistribute it and/or modify
-### it under the terms of the GNU General Public License as published by
-### the Free Software Foundation; either version 2 of the License, or
-### (at your option) any later version.
+### TrIPE is free software: you can redistribute it and/or modify it under
+### the terms of the GNU General Public License as published by the Free
+### Software Foundation; either version 3 of the License, or (at your
+### option) any later version.
###
-### TrIPE is distributed in the hope that it will be useful,
-### but WITHOUT ANY WARRANTY; without even the implied warranty of
-### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-### GNU General Public License for more details.
+### TrIPE is distributed in the hope that it will be useful, but WITHOUT
+### ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+### FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+### for more details.
###
### You should have received a copy of the GNU General Public License
-### along with TrIPE; if not, write to the Free Software Foundation,
-### Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+### along with TrIPE. If not, see <https://www.gnu.org/licenses/>.
VERSION = '@VERSION@'
pats = p
break
else:
- raise T.TripeJobError, 'unknown-group', g
+ raise T.TripeJobError('unknown-group', g)
for t, p, a, m in pats:
T.svcinfo('peer', t,
'target', p or '(default)',
if want is not None and not found:
def _(want = want):
try:
- SM.svcsubmit('connect', 'active', want)
+ list(SM.svcsubmit('connect', 'active', want))
except T.TripeError, exc:
SM.warn('conntrack', 'connect-failed', want, *exc.args)
if T._debug: print '# peer %s: bring up' % want
###--------------------------------------------------------------------------
### NetworkManager monitor.
+DBPROPS_IFACE = 'org.freedesktop.DBus.Properties'
+
NM_NAME = 'org.freedesktop.NetworkManager'
NM_PATH = '/org/freedesktop/NetworkManager'
NM_IFACE = NM_NAME
def attach(me, bus):
try:
nm = bus.get_object(NM_NAME, NM_PATH)
- state = nm.Get(NM_IFACE, 'State')
+ state = nm.Get(NM_IFACE, 'State', dbus_interface = DBPROPS_IFACE)
if state in NM_CONNSTATES:
netupdown(True, ['nm', 'initially-connected'])
else:
netupdown(False, ['nm', 'initially-disconnected'])
- except D.DBusException:
- pass
+ except D.DBusException, e:
+ if T._debug: print '# exception attaching to network-manager: %s' % e
bus.add_signal_receiver(me._nm_state, 'StateChanged',
NM_IFACE, NM_NAME, NM_PATH)
bus.add_signal_receiver(me._nm_connchange, 'PropertiesChanged',
props = cm.GetProperties(dbus_interface = CM_IFACE)
state = props['State']
netupdown(state == 'online', ['connman', 'initially-%s' % state])
- except D.DBusException:
- pass
+ except D.DBusException, e:
+ if T._debug: print '# exception attaching to connman: %s' % e
bus.add_signal_receiver(me._cm_state, 'PropertyChanged',
CM_IFACE, CM_NAME, CM_PATH)
except D.DBusException:
me._iap = None
netupdown(False, ['icd', 'initially-disconnected'])
- except D.DBusException:
+ except D.DBusException, e:
+ if T._debug: print '# exception attaching to icd: %s' % e
me._iap = None
bus.add_signal_receiver(me._icd_state, 'status_changed', ICD_IFACE,
ICD_NAME, ICD_PATH)