diff options
author | Sander Vrijders <sander.vrijders@ugent.be> | 2017-09-18 19:06:15 +0200 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@ugent.be> | 2017-09-19 16:52:54 +0200 |
commit | 541b1c5eeb5fe9f9aaa4aa6487852e5c59761139 (patch) | |
tree | a5817c5bd030b8a07713dcaa7dde95edbd0392d2 /src/ipcpd/normal/dt.c | |
parent | 669a8d4edfcc0fb2a7cd6f93e0ad2d0de820371a (diff) | |
download | ouroboros-541b1c5eeb5fe9f9aaa4aa6487852e5c59761139.tar.gz ouroboros-541b1c5eeb5fe9f9aaa4aa6487852e5c59761139.zip |
ipcpd, lib: Add flow down events
This adds the flow down event to Ouroboros. In the shim-eth-llc, a
netlink socket is opened which listens to device up/down events. For
each event the flow is then adjusted with fccntl to notify the user
the flow is down or back up again. In the normal IPCP an event is
thrown if a write reports that the flow is down.
Diffstat (limited to 'src/ipcpd/normal/dt.c')
-rw-r--r-- | src/ipcpd/normal/dt.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/ipcpd/normal/dt.c b/src/ipcpd/normal/dt.c index 2df17163..56cb5a61 100644 --- a/src/ipcpd/normal/dt.c +++ b/src/ipcpd/normal/dt.c @@ -93,6 +93,7 @@ static void sdu_handler(int fd, struct shm_du_buff * sdb) { struct dt_pci dt_pci; + int ret; memset(&dt_pci, 0, sizeof(dt_pci)); @@ -112,8 +113,11 @@ static void sdu_handler(int fd, return; } - if (ipcp_flow_write(fd, sdb)) { + ret = ipcp_flow_write(fd, sdb); + if (ret < 0) { log_err("Failed to write SDU to fd %d.", fd); + if (ret == -EFLOWDOWN) + notifier_event(NOTIFY_DT_CONN_DOWN, &fd); ipcp_sdb_release(sdb); return; } @@ -323,6 +327,7 @@ int dt_write_sdu(uint64_t dst_addr, { int fd; struct dt_pci dt_pci; + int ret; assert(sdb); assert(dst_addr != ipcpi.dt_addr); @@ -342,8 +347,11 @@ int dt_write_sdu(uint64_t dst_addr, return -1; } - if (ipcp_flow_write(fd, sdb)) { + ret = ipcp_flow_write(fd, sdb); + if (ret < 0) { log_err("Failed to write SDU to fd %d.", fd); + if (ret == -EFLOWDOWN) + notifier_event(NOTIFY_DT_CONN_DOWN, &fd); return -1; } |