Commit 315973de authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Send updates from check_xroutes.

This ensures that retractions are sent too.
parent 5f256663
...@@ -503,7 +503,7 @@ main(int argc, char **argv) ...@@ -503,7 +503,7 @@ main(int argc, char **argv)
if(receive_buffer == NULL) if(receive_buffer == NULL)
goto fail; goto fail;
} }
check_xroutes(); check_xroutes(0);
kernel_routes_changed = 0; kernel_routes_changed = 0;
kernel_link_changed = 0; kernel_link_changed = 0;
kernel_addr_changed = 0; kernel_addr_changed = 0;
...@@ -617,10 +617,8 @@ main(int argc, char **argv) ...@@ -617,10 +617,8 @@ main(int argc, char **argv)
if(kernel_routes_changed || kernel_addr_changed || if(kernel_routes_changed || kernel_addr_changed ||
now.tv_sec >= kernel_dump_time) { now.tv_sec >= kernel_dump_time) {
rc = check_xroutes(); rc = check_xroutes(1);
if(rc > 0) if(rc < 0)
send_self_update(NULL, 1);
else if(rc < 0)
fprintf(stderr, "Warning: couldn't check exported routes.\n"); fprintf(stderr, "Warning: couldn't check exported routes.\n");
kernel_routes_changed = kernel_addr_changed = 0; kernel_routes_changed = kernel_addr_changed = 0;
if(kernel_socket >= 0) if(kernel_socket >= 0)
......
...@@ -99,7 +99,7 @@ add_xroute(int kind, unsigned char prefix[16], unsigned char plen, ...@@ -99,7 +99,7 @@ add_xroute(int kind, unsigned char prefix[16], unsigned char plen,
} }
int int
check_xroutes() check_xroutes(int send_updates)
{ {
int i, j, metric, export, change = 0, rc; int i, j, metric, export, change = 0, rc;
struct kernel_route routes[240]; struct kernel_route routes[240];
...@@ -159,6 +159,8 @@ check_xroutes() ...@@ -159,6 +159,8 @@ check_xroutes()
if(!export) { if(!export) {
flush_xroute(&xroutes[i]); flush_xroute(&xroutes[i]);
if(send_updates)
send_update(NULL, 1, xroutes[i].prefix, xroutes[i].plen);
change = 1; change = 1;
} else { } else {
i++; i++;
...@@ -180,6 +182,8 @@ check_xroutes() ...@@ -180,6 +182,8 @@ check_xroutes()
metric, routes[i].ifindex, routes[i].proto); metric, routes[i].ifindex, routes[i].proto);
if(rc) if(rc)
change = 1; change = 1;
if(send_updates)
send_update(NULL, 1, xroutes[i].prefix, xroutes[i].plen);
} }
} }
return change; return change;
......
...@@ -20,8 +20,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN ...@@ -20,8 +20,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */
int check_xroutes(void);
/* These should come in decreasing order of priority. */ /* These should come in decreasing order of priority. */
#define XROUTE_FORCED 1 #define XROUTE_FORCED 1
...@@ -42,4 +40,4 @@ extern int numxroutes; ...@@ -42,4 +40,4 @@ extern int numxroutes;
struct xroute *find_xroute(const unsigned char *prefix, unsigned char plen); struct xroute *find_xroute(const unsigned char *prefix, unsigned char plen);
int add_xroute(int kind, unsigned char prefix[16], unsigned char plen, int add_xroute(int kind, unsigned char prefix[16], unsigned char plen,
unsigned short metric, unsigned int ifindex, int proto); unsigned short metric, unsigned int ifindex, int proto);
int check_xroutes(void); int check_xroutes(int send_updates);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment