about summary refs log tree commit diff
path: root/debian/patches/06-dispatch_more_events.patch
blob: e8b30810027172331197a9aa61b526d06165bacf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
diff -ruNp network-manager-0.6.2~/dispatcher-daemon/NetworkManagerDispatcher.c network-manager-0.6.2/dispatcher-daemon/NetworkManagerDispatcher.c
--- network-manager-0.6.2~/dispatcher-daemon/NetworkManagerDispatcher.c	2006-03-13 16:51:57.000000000 +0000
+++ network-manager-0.6.2/dispatcher-daemon/NetworkManagerDispatcher.c	2006-04-03 18:14:06.000000000 +0100
@@ -44,6 +44,8 @@ enum NMDAction
 	NMD_DEVICE_DONT_KNOW,
 	NMD_DEVICE_NOW_INACTIVE,
 	NMD_DEVICE_NOW_ACTIVE,
+	NMD_DEVICE_GOING_INACTIVE,
+	NMD_DEVICE_GOING_ACTIVE,
 };
 typedef enum NMDAction	NMDAction;
 
@@ -95,6 +97,10 @@ static void nmd_execute_scripts (NMDActi
 	if (action == NMD_DEVICE_NOW_ACTIVE)
 		char_act = "up";
 	else if (action == NMD_DEVICE_NOW_INACTIVE)
+		char_act = "post-down";
+	else if (action == NMD_DEVICE_GOING_ACTIVE)
+		char_act = "pre-up";
+	else if (action == NMD_DEVICE_GOING_INACTIVE)
 		char_act = "down";
 	else
 		return;
@@ -217,9 +223,13 @@ static DBusHandlerResult nmd_dbus_filter
 	}
 
 	if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceNoLongerActive"))
-		action = NMD_DEVICE_NOW_INACTIVE;
+		action = NMD_DEVICE_GOING_INACTIVE;
 	else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceNowActive"))
 		action = NMD_DEVICE_NOW_ACTIVE;
+	else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceActivating"))
+		action = NMD_DEVICE_GOING_ACTIVE;
+	else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceDeactivated"))
+		action = NMD_DEVICE_NOW_INACTIVE;
 
 	if (action != NMD_DEVICE_DONT_KNOW)
 	{
@@ -234,8 +244,10 @@ static DBusHandlerResult nmd_dbus_filter
 			if (dev_object_path && dev_iface_name)
 			{
 				nm_info ("Device %s (%s) is now %s.", dev_object_path, dev_iface_name,
-						(action == NMD_DEVICE_NOW_INACTIVE ? "down" :
-						(action == NMD_DEVICE_NOW_ACTIVE ? "up" : "error")));
+						(action == NMD_DEVICE_NOW_INACTIVE ? "going down" :
+						(action == NMD_DEVICE_NOW_ACTIVE ? "up" :
+						(action == NMD_DEVICE_GOING_INACTIVE ? "going down" :
+						(action == NMD_DEVICE_GOING_ACTIVE ? "going up" : "error")))));
 
 				nmd_execute_scripts (action, dev_iface_name);
 			}
diff -ruNp network-manager-0.6.2~/man/NetworkManagerDispatcher.1.in network-manager-0.6.2/man/NetworkManagerDispatcher.1.in
--- network-manager-0.6.2~/man/NetworkManagerDispatcher.1.in	2006-04-03 18:10:32.000000000 +0100
+++ network-manager-0.6.2/man/NetworkManagerDispatcher.1.in	2006-04-03 18:14:06.000000000 +0100
@@ -13,10 +13,14 @@ The \fINetworkManagerDispatcher\fP daemo
 directory in response to interfaces coming up and down.  The scripts are run
 alphabetically.  The first parameter is the network interface name.  The second
 parameter is
+.I pre\-up
+before bringing the interface up,
 .I up
-if the interface is now up and
+after bringing the interface up,
 .I down
-if the interface is now down.
+before taking the interface down and
+.I post\-down
+after taking the interface down.
 .SH OPTIONS
 The following options are supported:
 .TP
diff -ruNp network-manager-0.6.2~/src/NetworkManagerDbus.c network-manager-0.6.2/src/NetworkManagerDbus.c
--- network-manager-0.6.2~/src/NetworkManagerDbus.c	2006-02-24 18:59:03.000000000 +0000
+++ network-manager-0.6.2/src/NetworkManagerDbus.c	2006-04-03 18:14:06.000000000 +0100
@@ -193,6 +193,7 @@ static DeviceStatusSignals dev_status_si
 	{ DEVICE_NOW_ACTIVE,		"DeviceNowActive"		},
 	{ DEVICE_ACTIVATING,		"DeviceActivating"		},
 	{ DEVICE_ACTIVATION_FAILED,	"DeviceActivationFailed"	},
+	{ DEVICE_DEACTIVATED,		"DeviceDeactivated"		},
 	{ DEVICE_ADDED,			"DeviceAdded"			},
 	{ DEVICE_REMOVED,			"DeviceRemoved"		},
 	{ DEVICE_CARRIER_ON,		"DeviceCarrierOn"		},
diff -ruNp network-manager-0.6.2~/src/NetworkManagerDbus.h network-manager-0.6.2/src/NetworkManagerDbus.h
--- network-manager-0.6.2~/src/NetworkManagerDbus.h	2005-12-31 08:21:22.000000000 +0000
+++ network-manager-0.6.2/src/NetworkManagerDbus.h	2006-04-03 18:14:06.000000000 +0100
@@ -40,6 +40,7 @@ typedef enum
 	DEVICE_ACTIVATING,
 	DEVICE_ACTIVATION_FAILED,
 	DEVICE_ACTIVATION_CANCELED,
+	DEVICE_DEACTIVATED,
 	DEVICE_ADDED,
 	DEVICE_REMOVED,
 	DEVICE_CARRIER_ON,
diff -ruNp network-manager-0.6.2~/src/nm-device.c network-manager-0.6.2/src/nm-device.c
--- network-manager-0.6.2~/src/nm-device.c	2006-03-21 17:56:34.000000000 +0000
+++ network-manager-0.6.2/src/nm-device.c	2006-04-03 18:14:06.000000000 +0100
@@ -1445,6 +1445,7 @@ nm_device_deactivate (NMDevice *self)
 		NM_DEVICE_GET_CLASS (self)->deactivate (self);
 
 	nm_schedule_state_change_signal_broadcast (self->priv->app_data);
+	nm_dbus_schedule_device_status_change_signal (self->priv->app_data, self, NULL, DEVICE_DEACTIVATED);
 }