projects
/
project
/
netifd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
23bb091
)
add global interface event notifier
author
Felix Fietkau
<nbd@openwrt.org>
Fri, 4 May 2012 12:54:57 +0000
(14:54 +0200)
committer
Felix Fietkau
<nbd@openwrt.org>
Fri, 4 May 2012 12:54:57 +0000
(14:54 +0200)
interface.c
patch
|
blob
|
history
interface.h
patch
|
blob
|
history
diff --git
a/interface.c
b/interface.c
index
9301628
..
5614d39
100644
(file)
--- a/
interface.c
+++ b/
interface.c
@@
-12,6
+12,7
@@
#include "system.h"
struct vlist_tree interfaces;
#include "system.h"
struct vlist_tree interfaces;
+static LIST_HEAD(iface_all_users);
enum {
IFACE_ATTR_IFNAME,
enum {
IFACE_ATTR_IFNAME,
@@
-122,7
+123,10
@@
interface_event(struct interface *iface, enum interface_event ev)
struct interface_user *dep, *tmp;
list_for_each_entry_safe(dep, tmp, &iface->users, list)
struct interface_user *dep, *tmp;
list_for_each_entry_safe(dep, tmp, &iface->users, list)
- dep->cb(dep, IFEV_UP);
+ dep->cb(dep, iface, ev);
+
+ list_for_each_entry_safe(dep, tmp, &iface_all_users, list)
+ dep->cb(dep, iface, ev);
interface_queue_event(iface, ev);
}
interface_queue_event(iface, ev);
}
@@
-206,10
+210,15
@@
interface_set_available(struct interface *iface, bool new_state)
void
interface_add_user(struct interface_user *dep, struct interface *iface)
{
void
interface_add_user(struct interface_user *dep, struct interface *iface)
{
+ if (!iface) {
+ list_add(&dep->list, &iface_all_users);
+ return;
+ }
+
dep->iface = iface;
list_add(&dep->list, &iface->users);
if (iface->state == IFS_UP)
dep->iface = iface;
list_add(&dep->list, &iface->users);
if (iface->state == IFS_UP)
- dep->cb(dep, IFEV_UP);
+ dep->cb(dep,
iface,
IFEV_UP);
}
void
}
void
diff --git
a/interface.h
b/interface.h
index
c89411a
..
e89db70
100644
(file)
--- a/
interface.h
+++ b/
interface.h
@@
-36,7
+36,7
@@
struct interface_error {
struct interface_user {
struct list_head list;
struct interface *iface;
struct interface_user {
struct list_head list;
struct interface *iface;
- void (*cb)(struct interface_user *dep, enum interface_event ev);
+ void (*cb)(struct interface_user *dep,
struct interface *iface,
enum interface_event ev);
};
struct interface_ip_settings {
};
struct interface_ip_settings {