Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame^] | 1 | ripd: Fix two bugs after received SIGHUP signal |
| 2 | |
| 3 | There are two problems for ripd implementation after received |
| 4 | SIGHUP signal: |
| 5 | 1). ripd didn't clean up ifp->connected list before reload |
| 6 | configuration file. |
| 7 | 2). ripd reset ri->split_horizon flag to RIP_NO_SPLIT_HORIZON |
| 8 | which lead to the unnecessary route to be advertised. |
| 9 | |
| 10 | Upstream-Status: Submitted [http://patchwork.diac24.net/patch/604/] |
| 11 | |
| 12 | Signed-off-by: Xufeng Zhang <xufeng.zhang@windriver.com> |
| 13 | Signed-off-by: Joe MacDonald <joe@deserted.net> |
| 14 | --- |
| 15 | --- a/ripd/rip_interface.c |
| 16 | +++ b/ripd/rip_interface.c |
| 17 | @@ -500,6 +500,8 @@ |
| 18 | struct listnode *node; |
| 19 | struct interface *ifp; |
| 20 | struct rip_interface *ri; |
| 21 | + struct connected *ifc; |
| 22 | + struct listnode *conn_node, *next; |
| 23 | |
| 24 | for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp)) |
| 25 | { |
| 26 | @@ -514,6 +516,13 @@ |
| 27 | thread_cancel (ri->t_wakeup); |
| 28 | ri->t_wakeup = NULL; |
| 29 | } |
| 30 | + |
| 31 | + for (conn_node = listhead (ifp->connected); conn_node; conn_node = next) |
| 32 | + { |
| 33 | + ifc = listgetdata (conn_node); |
| 34 | + next = conn_node->next; |
| 35 | + listnode_delete (ifp->connected, ifc); |
| 36 | + } |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | @@ -548,8 +557,8 @@ |
| 41 | ri->key_chain = NULL; |
| 42 | } |
| 43 | |
| 44 | - ri->split_horizon = RIP_NO_SPLIT_HORIZON; |
| 45 | - ri->split_horizon_default = RIP_NO_SPLIT_HORIZON; |
| 46 | + ri->split_horizon = RIP_SPLIT_HORIZON; |
| 47 | + ri->split_horizon_default = RIP_SPLIT_HORIZON; |
| 48 | |
| 49 | ri->list[RIP_FILTER_IN] = NULL; |
| 50 | ri->list[RIP_FILTER_OUT] = NULL; |