lists.frrouting.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

dev

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2021 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2020 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2019 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2018 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2017 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2016 -----
  • December
  • November
  • October
dev@lists.frrouting.org

  • 1 participants
  • 1224 discussions
[cmaster-next] [PATCH 7/9] lib: Fix thread_execute_crash
by Donald Sharp 15 Dec '16

15 Dec '16
With the change to have thread_get fill inthe ->hist pointer, thread_execute was missed and it needs to fill in the .hist pointer for the dummy thread created. I'm not really sure why we need to call a thread_execute on a function. When we could, you know, just call the bloody thing. Signed-off-by: Donald Sharp <sharpd(a)cumulusnetworks.com> (cherry picked from commit 77089840504de55b6322005ad0a999b983a0e036) --- lib/thread.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/thread.c b/lib/thread.c index ba1386a..64eaae4 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -1490,18 +1490,22 @@ funcname_thread_execute (struct thread_master *m, int val, debugargdef) { - struct thread dummy; + struct cpu_thread_history tmp; + struct thread dummy; memset (&dummy, 0, sizeof (struct thread)); dummy.type = THREAD_EVENT; dummy.add_type = THREAD_EXECUTE; dummy.master = NULL; - dummy.func = func; dummy.arg = arg; dummy.u.val = val; - dummy.funcname = funcname; + tmp.func = dummy.func = func; + tmp.funcname = dummy.funcname = funcname; + dummy.hist = hash_get (cpu_record, &tmp, + (void * (*) (void *))cpu_record_hash_alloc); + dummy.schedfrom = schedfrom; dummy.schedfrom_line = fromln; -- 2.5.5
1 0
0 0
[cmaster-next] [PATCH 6/9] lib: Fix 'show thread cpu' to display active threads
by Donald Sharp 15 Dec '16

15 Dec '16
Fix the display of 'show thread cpu' to keep track of the number of active threads and to display that information. Signed-off-by: Donald Sharp <sharpd(a)cumulusnetworks.com> (cherry picked from commit db4300f0568d061889ab5ac4ad54c2a5bfa67445) --- lib/thread.c | 9 ++++++--- lib/thread.h | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/thread.c b/lib/thread.c index 59c0b77..ba1386a 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -221,8 +221,8 @@ static void vty_out_cpu_thread_history(struct vty* vty, struct cpu_thread_history *a) { - vty_out(vty, "%10ld.%03ld %9d %8ld %9ld %8ld %9ld", - a->cpu.total/1000, a->cpu.total%1000, a->total_calls, + vty_out(vty, "%5d %10ld.%03ld %9d %8ld %9ld %8ld %9ld", + a->total_active, a->cpu.total/1000, a->cpu.total%1000, a->total_calls, a->cpu.total/a->total_calls, a->cpu.max, a->real.total/a->total_calls, a->real.max); vty_out(vty, " %c%c%c%c%c%c %s%s", @@ -247,6 +247,7 @@ cpu_record_hash_print(struct hash_backet *bucket, if ( !(a->types & *filter) ) return; vty_out_cpu_thread_history(vty,a); + totals->total_active += a->total_active; totals->total_calls += a->total_calls; totals->real.total += a->real.total; if (totals->real.max < a->real.max) @@ -268,7 +269,7 @@ cpu_record_print(struct vty *vty, thread_type filter) vty_out(vty, "%21s %18s %18s%s", "", "CPU (user+system):", "Real (wall-clock):", VTY_NEWLINE); - vty_out(vty, " Runtime(ms) Invoked Avg uSec Max uSecs"); + vty_out(vty, "Active Runtime(ms) Invoked Avg uSec Max uSecs"); vty_out(vty, " Avg uSec Max uSecs"); vty_out(vty, " Type Thread%s", VTY_NEWLINE); hash_iterate(cpu_record, @@ -572,6 +573,7 @@ thread_add_unuse (struct thread_master *m, struct thread *thread) assert (thread->prev == NULL); thread->type = THREAD_UNUSED; + thread->hist->total_active--; thread_list_add (&m->unuse, thread); } @@ -726,6 +728,7 @@ thread_get (struct thread_master *m, u_char type, thread->hist = hash_get (cpu_record, &tmp, (void * (*) (void *))cpu_record_hash_alloc); } + thread->hist->total_active++; thread->func = func; thread->funcname = funcname; thread->schedfrom = schedfrom; diff --git a/lib/thread.h b/lib/thread.h index 5c6b96a..c22bb48 100644 --- a/lib/thread.h +++ b/lib/thread.h @@ -115,6 +115,7 @@ struct cpu_thread_history { int (*func)(struct thread *); unsigned int total_calls; + unsigned int total_active; struct time_stats { unsigned long total, max; -- 2.5.5
1 0
0 0
[cmaster-next] [PATCH 5/9] lib: Slight Optimization of thread handling.
by Donald Sharp 15 Dec '16

15 Dec '16
This commit does these things: 1) Make thread_add_unuse own the setting of THREAD_UNUSED. 2) Move thread->hist finding to to thread_get. We are storing the thread->hist even when the thread is on the unused. This means that we check to see if the funcname or func have changed and we get new history. Else we've probably just retrieved the last unused which has the same func/funcanme. This is a common practice to do THREAD_OFF/THREAD_ON in quick succession. Signed-off-by: Donald Sharp <sharpd(a)cumulusnetworks.com. (cherry picked from commit 59d9e706ece0c71f12cadbb97b52da61340df9ec) --- lib/thread.c | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/lib/thread.c b/lib/thread.c index eac7f32..59c0b77 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -570,7 +570,8 @@ thread_add_unuse (struct thread_master *m, struct thread *thread) assert (m != NULL && thread != NULL); assert (thread->next == NULL); assert (thread->prev == NULL); - assert (thread->type == THREAD_UNUSED); + + thread->type = THREAD_UNUSED; thread_list_add (&m->unuse, thread); } @@ -693,6 +694,7 @@ thread_get (struct thread_master *m, u_char type, int (*func) (struct thread *), void *arg, debugargdef) { struct thread *thread = thread_trim_head (&m->unuse); + struct cpu_thread_history tmp; if (! thread) { @@ -702,11 +704,29 @@ thread_get (struct thread_master *m, u_char type, thread->type = type; thread->add_type = type; thread->master = m; - thread->func = func; thread->arg = arg; thread->index = -1; thread->yield = THREAD_YIELD_TIME_SLOT; /* default */ + /* + * So if the passed in funcname is not what we have + * stored that means the thread->hist needs to be + * updated. We keep the last one around in unused + * under the assumption that we are probably + * going to immediately allocate the same + * type of thread. + * This hopefully saves us some serious + * hash_get lookups. + */ + if (thread->funcname != funcname || + thread->func != func) + { + tmp.func = func; + tmp.funcname = funcname; + thread->hist = hash_get (cpu_record, &tmp, + (void * (*) (void *))cpu_record_hash_alloc); + } + thread->func = func; thread->funcname = funcname; thread->schedfrom = schedfrom; thread->schedfrom_line = fromln; @@ -1063,7 +1083,6 @@ thread_cancel (struct thread *thread) assert(!"Thread should be either in queue or list or array!"); } - thread->type = THREAD_UNUSED; thread_add_unuse (thread->master, thread); } @@ -1086,7 +1105,6 @@ thread_cancel_event (struct thread_master *m, void *arg) { ret++; thread_list_delete (&m->event, t); - t->type = THREAD_UNUSED; thread_add_unuse (m, t); } } @@ -1104,7 +1122,6 @@ thread_cancel_event (struct thread_master *m, void *arg) { ret++; thread_list_delete (&m->ready, t); - t->type = THREAD_UNUSED; thread_add_unuse (m, t); } } @@ -1128,7 +1145,6 @@ thread_run (struct thread_master *m, struct thread *thread, struct thread *fetch) { *fetch = *thread; - thread->type = THREAD_UNUSED; thread_add_unuse (m, thread); return fetch; } @@ -1427,23 +1443,6 @@ thread_call (struct thread *thread) unsigned long realtime, cputime; RUSAGE_T before, after; - /* Cache a pointer to the relevant cpu history thread, if the thread - * does not have it yet. - * - * Callers submitting 'dummy threads' hence must take care that - * thread->cpu is NULL - */ - if (!thread->hist) - { - struct cpu_thread_history tmp; - - tmp.func = thread->func; - tmp.funcname = thread->funcname; - - thread->hist = hash_get (cpu_record, &tmp, - (void * (*) (void *))cpu_record_hash_alloc); - } - GETRUSAGE (&before); thread->real = before.real; -- 2.5.5
1 0
0 0
[cmaster-next] [PATCH 4/9] lib: Turn off automatic debugging of Wheel code.
by Donald Sharp 15 Dec '16

15 Dec '16
Turn off the automatic debugging of Timer wheel code. Signed-off-by: Donald Sharp <sharpd(a)cumulusnetworks.com> --- lib/wheel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/wheel.c b/lib/wheel.c index 3cfd925..fe53dea 100644 --- a/lib/wheel.c +++ b/lib/wheel.c @@ -28,7 +28,7 @@ DEFINE_MTYPE_STATIC(LIB, TIMER_WHEEL, "Timer Wheel") DEFINE_MTYPE_STATIC(LIB, TIMER_WHEEL_LIST, "Timer Wheel Slot List") -static int debug_timer_wheel = 1; +static int debug_timer_wheel = 0; static int wheel_timer_thread (struct thread *t) -- 2.5.5
1 0
0 0
[cmaster-next] [PATCH 3/9] lib: Add Timer Wheel functionality
by Donald Sharp 15 Dec '16

15 Dec '16
Signed-off-by: Donald Sharp <sharpd(a)cumulusnetworks.com> --- lib/Makefile.am | 4 +- lib/wheel.c | 164 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ lib/wheel.h | 70 ++++++++++++++++++++++++ 3 files changed, 236 insertions(+), 2 deletions(-) create mode 100644 lib/wheel.c create mode 100644 lib/wheel.h diff --git a/lib/Makefile.am b/lib/Makefile.am index ffbbacc..f657cb9 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -25,7 +25,7 @@ libzebra_la_SOURCES = \ sigevent.c pqueue.c jhash.c workqueue.c nexthop.c json.c \ ptm_lib.c csv.c bfd.c vrf.c systemd.c ns.c memory.c memory_vty.c \ imsg-buffer.c imsg.c skiplist.c \ - qobj.c \ + qobj.c wheel.c \ event_counter.c \ strlcpy.c \ strlcat.c @@ -46,7 +46,7 @@ pkginclude_HEADERS = \ workqueue.h route_types.h libospf.h nexthop.h json.h \ ptm_lib.h csv.h bfd.h vrf.h ns.h systemd.h bitfield.h \ fifo.h memory_vty.h mpls.h imsg.h openbsd-queue.h openbsd-tree.h \ - skiplist.h qobj.h \ + skiplist.h qobj.h wheel.h \ event_counter.h noinst_HEADERS = \ diff --git a/lib/wheel.c b/lib/wheel.c new file mode 100644 index 0000000..3cfd925 --- /dev/null +++ b/lib/wheel.c @@ -0,0 +1,164 @@ +/* + * Timer Wheel + * Copyright (C) 2016 Cumulus Networks, Inc. + * Donald Sharp + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + * MA 02110-1301 USA + */ +#include "zebra.h" +#include "linklist.h" +#include "thread.h" +#include "memory.h" +#include "wheel.h" +#include "log.h" + +DEFINE_MTYPE_STATIC(LIB, TIMER_WHEEL, "Timer Wheel") +DEFINE_MTYPE_STATIC(LIB, TIMER_WHEEL_LIST, "Timer Wheel Slot List") + +static int debug_timer_wheel = 1; + +static int +wheel_timer_thread (struct thread *t) +{ + struct listnode *node, *nextnode; + unsigned long long curr_slot; + unsigned int slots_to_skip = 1; + struct timer_wheel *wheel; + void *data; + + wheel = THREAD_ARG(t); + THREAD_OFF(wheel->timer); + + wheel->curr_slot += wheel->slots_to_skip; + + curr_slot = wheel->curr_slot % wheel->slots; + + if (debug_timer_wheel) + zlog_debug ("%s: Wheel Slot: %lld(%lld) count: %d", + __PRETTY_FUNCTION__, + wheel->curr_slot, + curr_slot, listcount(wheel->wheel_slot_lists[curr_slot])); + + for (ALL_LIST_ELEMENTS (wheel->wheel_slot_lists[curr_slot], node, nextnode, data)) + (*wheel->slot_run)(data); + + while (list_isempty(wheel->wheel_slot_lists[(curr_slot + slots_to_skip) % wheel->slots]) && + (curr_slot + slots_to_skip ) % wheel->slots != curr_slot) + slots_to_skip++; + + wheel->slots_to_skip = slots_to_skip; + THREAD_TIMER_MSEC_ON (wheel->master, wheel->timer, + wheel_timer_thread, wheel, + wheel->nexttime * slots_to_skip); + + return 0; +} + +struct timer_wheel * +wheel_init (struct thread_master *master, int period, size_t slots, + unsigned int (*slot_key) (void *), + void (*slot_run) (void *)) +{ + struct timer_wheel *wheel; + size_t i; + + wheel = XCALLOC(MTYPE_TIMER_WHEEL, sizeof (struct timer_wheel)); + + wheel->slot_key = slot_key; + wheel->slot_run = slot_run; + + wheel->period = period; + wheel->slots = slots; + wheel->curr_slot = 0; + wheel->master = master; + wheel->nexttime = period / slots; + + wheel->wheel_slot_lists = XCALLOC(MTYPE_TIMER_WHEEL_LIST, + slots * sizeof (struct listnode *)); + for (i = 0; i < slots; i++) + wheel->wheel_slot_lists[i] = list_new (); + + THREAD_TIMER_MSEC_ON (wheel->master, wheel->timer, + wheel_timer_thread, wheel, + wheel->nexttime); + + return wheel; +} + +void +wheel_delete (struct timer_wheel *wheel) +{ + int i; + + for (i = 0; i < wheel->slots; i++) + { + list_delete(wheel->wheel_slot_lists[i]); + } + + THREAD_OFF(wheel->timer); + XFREE(MTYPE_TIMER_WHEEL_LIST, wheel->wheel_slot_lists); + XFREE(MTYPE_TIMER_WHEEL, wheel); +} + +int +wheel_stop (struct timer_wheel *wheel) +{ + THREAD_OFF(wheel->timer); + return 0; +} + +int +wheel_start (struct timer_wheel *wheel) +{ + if (!wheel->timer) + THREAD_TIMER_MSEC_ON (wheel->master, wheel->timer, + wheel_timer_thread, wheel, + wheel->nexttime); + + return 0; +} + +int +wheel_add_item (struct timer_wheel *wheel, void *item) +{ + long long slot; + + slot = (*wheel->slot_key)(item); + + if (debug_timer_wheel) + zlog_debug ("%s: Inserting %p: %lld %lld", + __PRETTY_FUNCTION__, item, + slot, slot % wheel->slots); + listnode_add (wheel->wheel_slot_lists[slot % wheel->slots], item); + + return 0; +} + +int +wheel_remove_item (struct timer_wheel *wheel, void *item) +{ + long long slot; + + slot = (*wheel->slot_key)(item); + + if (debug_timer_wheel) + zlog_debug ("%s: Removing %p: %lld %lld", + __PRETTY_FUNCTION__, item, + slot, slot % wheel->slots); + listnode_delete (wheel->wheel_slot_lists[slot % wheel->slots], item); + + return 0; +} diff --git a/lib/wheel.h b/lib/wheel.h new file mode 100644 index 0000000..ddb7998 --- /dev/null +++ b/lib/wheel.h @@ -0,0 +1,70 @@ +/* + * Timer Wheel + * Copyright (C) 2016 Cumulus Networks, Inc. + * Donald Sharp + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + * MA 02110-1301 USA + */ +#ifndef __WHEEL_H__ +#define __WHEEL_H__ + +struct timer_wheel +{ + struct thread_master *master; + int slots; + long long curr_slot; + unsigned int period; + unsigned int nexttime; + unsigned int slots_to_skip; + + struct list **wheel_slot_lists; + struct thread *timer; + /* + * Key to determine what slot the item belongs in + */ + unsigned int (*slot_key) (void *); + + void (*slot_run) (void *); +}; + +struct timer_wheel *wheel_init (struct thread_master *master, int period, size_t slots, + unsigned int (*slot_key) (void *), + void (*slot_run) (void *)); +void wheel_delete (struct timer_wheel *); + +/* + * Pause the Wheel from running + */ +int wheel_stop (struct timer_wheel *wheel); + +/* + * Start the wheel from running again + */ +int wheel_start (struct timer_wheel *wheel); + +/* + * Add item to a slot setup by the slot_key, + * possibly change next time pop. + */ +int wheel_add_item (struct timer_wheel *wheel, void *item); + +/* + * Remove a item to a slot setup by the slot_key, + * possibly change next time pop. + */ +int wheel_remove_item (struct timer_wheel *wheel, void *item); + +#endif -- 2.5.5
1 0
0 0
[cmaster-next] [PATCH 2/9] lib: Remove deprecated interface
by Donald Sharp 15 Dec '16

15 Dec '16
Remove Deprecated interface that is not used. Signed-off-by: Donald Sharp <sharpd(a)cumulusnetworks.com> --- configure.ac | 8 -------- lib/linklist.h | 11 ----------- 2 files changed, 19 deletions(-) diff --git a/configure.ac b/configure.ac index 7e751cd..78cc975 100755 --- a/configure.ac +++ b/configure.ac @@ -1579,14 +1579,6 @@ for I in 1 2 3 4 5 6 7 8 9 10; do done AC_DEFINE_UNQUOTED(VTYSH_BIN_PATH, "$vtysh_bin",path to vtysh binary) -dnl ------------------------------- -dnl Quagga sources should always be -dnl current wrt interfaces. Dont -dnl allow deprecated interfaces to -dnl be exposed. -dnl ------------------------------- -AC_DEFINE(QUAGGA_NO_DEPRECATED_INTERFACES, 1, Hide deprecated interfaces) - dnl --------------------------- dnl Check htonl works correctly dnl --------------------------- diff --git a/lib/linklist.h b/lib/linklist.h index e99e50f..cd6e2f1 100644 --- a/lib/linklist.h +++ b/lib/linklist.h @@ -135,15 +135,4 @@ extern void list_add_list (struct list *, struct list *); (L)->count--; \ } while (0) -/* Deprecated: 20050406 */ -#if !defined(QUAGGA_NO_DEPRECATED_INTERFACES) -#warning "Using deprecated libzebra interfaces" -#define LISTNODE_ADD(L,N) LISTNODE_ATTACH(L,N) -#define LISTNODE_DELETE(L,N) LISTNODE_DETACH(L,N) -#define nextnode(X) ((X) = (X)->next) -#define getdata(X) listgetdata(X) -#define LIST_LOOP(L,V,N) \ - for (ALL_LIST_ELEMENTS_RO (L,N,V)) -#endif /* QUAGGA_NO_DEPRECATED_INTERFACES */ - #endif /* _ZEBRA_LINKLIST_H */ -- 2.5.5
1 0
0 0
[cmaster-next] [PATCH 1/9] lib: Setup prefix.h to allow it to store (s, g)
by Donald Sharp 15 Dec '16

15 Dec '16
We need the ability to store the (s,g) in a struct prefix. This will allow us to consolidate some duplicated code in pimd as well as set us up to switch from a link list to a table to store (s,g) state. Signed-off-by: Donald Sharp <sharpd(a)cumulusnetworks.com> (cherry picked from commit c8fad6b8d700353d1a6d6eb7f3807f1c00dda097) --- lib/prefix.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/prefix.h b/lib/prefix.h index 85488cc..4878fcf 100644 --- a/lib/prefix.h +++ b/lib/prefix.h @@ -83,6 +83,11 @@ struct prefix struct in_addr adv_router; } lp; struct ethaddr prefix_eth; /* AF_ETHERNET */ + struct + { + struct in_addr src; + struct in_addr grp; + } sg; u_char val[8]; uintptr_t ptr; } u __attribute__ ((aligned (8))); -- 2.5.5
1 0
0 0
[cmaster-next] [PATCH 0/9] master - Some lib changes in Prep for PIM-SM
by Donald Sharp 15 Dec '16

15 Dec '16
Just some basic lib code changes needed for changes in pimd. Donald Sharp (9): lib: Setup prefix.h to allow it to store (s,g) lib: Remove deprecated interface lib: Add Timer Wheel functionality lib: Turn off automatic debugging of Wheel code. lib: Slight Optimization of thread handling. lib: Fix 'show thread cpu' to display active threads lib: Fix thread_execute_crash lib: Fix clang SA warnings. lib: Allow json to work across different versions. configure.ac | 8 --- lib/Makefile.am | 4 +- lib/imsg.c | 3 +- lib/json.c | 15 ++++++ lib/json.h | 4 ++ lib/linklist.h | 11 ---- lib/prefix.h | 5 ++ lib/thread.c | 64 ++++++++++++---------- lib/thread.h | 1 + lib/wheel.c | 164 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ lib/wheel.h | 70 ++++++++++++++++++++++++ 11 files changed, 298 insertions(+), 51 deletions(-) create mode 100644 lib/wheel.c create mode 100644 lib/wheel.h -- 2.5.5
1 0
0 0
[cmaster-next] [PATCH] zebra: fix segfault on exit when RIB debugging is enabled
by Renato Westphal 15 Dec '16

15 Dec '16
Fixes the following crash on exit: (gdb) bt 0 _rnode_zlog (...) at zebra_rib.c:104 1 0x0000000000417726 in rib_unlink (...) at zebra_rib.c:2370 2 0x000000000042db80 in zebra_rtable_node_destroy (...) at zebra_vrf.c:336 3 0x00007ffff7b6ce2e in route_node_free (...) at table.c:81 4 0x00007ffff7b6ced7 in route_table_free (...) at table.c:118 5 0x00007ffff7b6cd88 in route_table_finish (...) at table.c:53 6 0x000000000042defa in zebra_vrf_delete (...) at zebra_vrf.c:278 7 0x00007ffff7b9e044 in vrf_delete (...) at vrf.c:162 8 0x00007ffff7b9e89f in vrf_terminate () at vrf.c:458 9 0x000000000041027c in sigint () at main.c:205 10 0x00007ffff7b953f2 in quagga_sigevent_process () at sigevent.c:111 11 0x00007ffff7b681dd in thread_fetch (...) at thread.c:1297 12 0x000000000040c7ed in main (...) at main.c:471 To fix the problem, free the table->info pointer only after route_table_finish() is called for the table. Signed-off-by: Renato Westphal <renato(a)opensourcerouting.org> --- zebra/zebra_vrf.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/zebra/zebra_vrf.c b/zebra/zebra_vrf.c index bf42792..9297438 100644 --- a/zebra/zebra_vrf.c +++ b/zebra/zebra_vrf.c @@ -271,11 +271,14 @@ zebra_vrf_delete (struct vrf *vrf) /* release allocated memory */ for (afi = AFI_IP; afi <= AFI_IP6; afi++) { + void *table_info; + for (safi = SAFI_UNICAST; safi <= SAFI_MULTICAST; safi++) { table = zvrf->table[afi][safi]; - XFREE (MTYPE_RIB_TABLE_INFO, table->info); + table_info = table->info; route_table_finish (table); + XFREE (MTYPE_RIB_TABLE_INFO, table_info); table = zvrf->stable[afi][safi]; route_table_finish (table); @@ -285,8 +288,9 @@ zebra_vrf_delete (struct vrf *vrf) if (zvrf->other_table[afi][table_id]) { table = zvrf->other_table[afi][table_id]; - XFREE (MTYPE_RIB_TABLE_INFO, table->info); + table_info = table->info; route_table_finish (table); + XFREE (MTYPE_RIB_TABLE_INFO, table_info); } route_table_finish (zvrf->rnh_table[afi]); -- 1.9.1
2 1
0 0
[cmaster-next] [PATCH] zebra-mpls: fix regression caused by wrong conflict resolution
by Renato Westphal 15 Dec '16

15 Dec '16
Signed-off-by: Renato Westphal <renato(a)opensourcerouting.org> --- zebra/zebra_vty.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index f32b51f..bde9431 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -918,6 +918,15 @@ vty_show_ip_route_detail (struct vty *vty, struct route_node *rn, int mcast) default: break; } + + /* Label information */ + if (nexthop->nh_label && nexthop->nh_label->num_labels) + { + vty_out (vty, " label %s", + mpls_label2str (nexthop->nh_label->num_labels, + nexthop->nh_label->label, buf, BUFSIZ)); + } + vty_out (vty, "%s", VTY_NEWLINE); } vty_out (vty, "%s", VTY_NEWLINE); @@ -1158,6 +1167,14 @@ vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib, break; } + /* Label information */ + if (nexthop->nh_label && nexthop->nh_label->num_labels) + { + vty_out (vty, " label %s", + mpls_label2str (nexthop->nh_label->num_labels, + nexthop->nh_label->label, buf, BUFSIZ)); + } + if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_BLACKHOLE)) vty_out (vty, ", bh"); if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_REJECT)) -- 1.9.1
3 4
0 0
  • ← Newer
  • 1
  • ...
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • ...
  • 123
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.