diff options
Diffstat (limited to 'lib/log.c')
| -rw-r--r-- | lib/log.c | 58 |
1 files changed, 42 insertions, 16 deletions
@@ -14,10 +14,9 @@ * 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 GNU Zebra; see the file COPYING. If not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 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 */ #define FRR_DEFINE_DESC_TABLE @@ -478,15 +477,17 @@ void zlog_signal(int signo, const char *action ); s = buf; - if (!thread_current) + struct thread *tc; + tc = pthread_getspecific(thread_current); + if (!tc) s = str_append(LOC, "no thread information available\n"); else { s = str_append(LOC, "in thread "); - s = str_append(LOC, thread_current->funcname); + s = str_append(LOC, tc->funcname); s = str_append(LOC, " scheduled from "); - s = str_append(LOC, thread_current->schedfrom); + s = str_append(LOC, tc->schedfrom); s = str_append(LOC, ":"); - s = num_append(LOC, thread_current->schedfrom_line); + s = num_append(LOC, tc->schedfrom_line); s = str_append(LOC, "\n"); } @@ -667,12 +668,14 @@ ZLOG_FUNC(zlog_debug, LOG_DEBUG) void zlog_thread_info(int log_level) { - if (thread_current) + struct thread *tc; + tc = pthread_getspecific(thread_current); + + if (tc) zlog(log_level, "Current thread function %s, scheduled from " "file %s, line %u", - thread_current->funcname, thread_current->schedfrom, - thread_current->schedfrom_line); + tc->funcname, tc->schedfrom, tc->schedfrom_line); else zlog(log_level, "Current thread not known/applicable"); } @@ -726,6 +729,18 @@ void openzlog(const char *progname, const char *protoname, u_short instance, openlog(progname, syslog_flags, zl->facility); zlog_default = zl; + +#ifdef HAVE_GLIBC_BACKTRACE + /* work around backtrace() using lazily resolved dynamically linked + * symbols, which will otherwise cause funny breakage in the SEGV + * handler. + * (particularly, the dynamic linker can call malloc(), which uses locks + * in programs linked with -pthread, thus can deadlock.) */ + void *bt[4]; + backtrace(bt, array_size(bt)); + free(backtrace_symbols(bt, 0)); + backtrace_symbols_fd(bt, 0, 0); +#endif } void closezlog(void) @@ -744,11 +759,6 @@ void closezlog(void) zlog_default = NULL; } -const char *zlog_protoname(void) -{ - return zlog_default ? zlog_default->protoname : "NONE"; -} - /* Called from command.c. */ void zlog_set_level(zlog_dest_t dest, int log_level) { @@ -847,6 +857,7 @@ static const struct zebra_desc_table command_types[] = { DESC_ENTRY(ZEBRA_INTERFACE_ADDRESS_DELETE), DESC_ENTRY(ZEBRA_INTERFACE_UP), DESC_ENTRY(ZEBRA_INTERFACE_DOWN), + DESC_ENTRY(ZEBRA_INTERFACE_SET_MASTER), DESC_ENTRY(ZEBRA_IPV4_ROUTE_ADD), DESC_ENTRY(ZEBRA_IPV4_ROUTE_DELETE), DESC_ENTRY(ZEBRA_IPV6_ROUTE_ADD), @@ -896,6 +907,15 @@ static const struct zebra_desc_table command_types[] = { DESC_ENTRY(ZEBRA_LABEL_MANAGER_CONNECT), DESC_ENTRY(ZEBRA_GET_LABEL_CHUNK), DESC_ENTRY(ZEBRA_RELEASE_LABEL_CHUNK), + DESC_ENTRY(ZEBRA_ADVERTISE_ALL_VNI), + DESC_ENTRY(ZEBRA_VNI_ADD), + DESC_ENTRY(ZEBRA_VNI_DEL), + DESC_ENTRY(ZEBRA_REMOTE_VTEP_ADD), + DESC_ENTRY(ZEBRA_REMOTE_VTEP_DEL), + DESC_ENTRY(ZEBRA_MACIP_ADD), + DESC_ENTRY(ZEBRA_MACIP_DEL), + DESC_ENTRY(ZEBRA_REMOTE_MACIP_ADD), + DESC_ENTRY(ZEBRA_REMOTE_MACIP_DEL), DESC_ENTRY(ZEBRA_PW_ADD), DESC_ENTRY(ZEBRA_PW_DELETE), DESC_ENTRY(ZEBRA_PW_SET), @@ -972,6 +992,8 @@ int proto_redistnum(int afi, const char *s) return ZEBRA_ROUTE_STATIC; else if (strmatch(s, "rip")) return ZEBRA_ROUTE_RIP; + else if (strmatch(s, "eigrp")) + return ZEBRA_ROUTE_EIGRP; else if (strmatch(s, "ospf")) return ZEBRA_ROUTE_OSPF; else if (strmatch(s, "isis")) @@ -986,6 +1008,8 @@ int proto_redistnum(int afi, const char *s) return ZEBRA_ROUTE_VNC_DIRECT; else if (strmatch(s, "nhrp")) return ZEBRA_ROUTE_NHRP; + else if (strmatch(s, "babel")) + return ZEBRA_ROUTE_BABEL; } if (afi == AFI_IP6) { if (strmatch(s, "kernel")) @@ -1010,6 +1034,8 @@ int proto_redistnum(int afi, const char *s) return ZEBRA_ROUTE_VNC_DIRECT; else if (strmatch(s, "nhrp")) return ZEBRA_ROUTE_NHRP; + else if (strmatch(s, "babel")) + return ZEBRA_ROUTE_BABEL; } return -1; } |
