diff options
-rw-r--r-- | filter/test.conf | 12 | ||||
-rw-r--r-- | proto/bgp/bgp.c | 2 | ||||
-rw-r--r-- | proto/bgp/bgp.h | 4 | ||||
-rw-r--r-- | proto/bgp/packets.c | 10 | ||||
-rw-r--r-- | proto/pipe/pipe.c | 4 | ||||
-rw-r--r-- | sysdep/unix/alloc.c | 9 |
6 files changed, 28 insertions, 13 deletions
diff --git a/filter/test.conf b/filter/test.conf index 9b24a408..17aaf8cf 100644 --- a/filter/test.conf +++ b/filter/test.conf @@ -219,6 +219,18 @@ function t_int() bt_assert(123/45 = 2); bt_assert(0xfee1a | 0xbeef = 0xffeff); bt_assert(0xfee1a & 0xbeef = 0xae0a); + + case i { + 4200000000: bt_assert(true); + else: bt_assert(false); + } + + case four { + 4: bt_assert(true); + else: bt_assert(false); + } + + } bt_test_suite(t_int, "Testing integers"); diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c index e8e65ad7..48e98bdf 100644 --- a/proto/bgp/bgp.c +++ b/proto/bgp/bgp.c @@ -2431,7 +2431,7 @@ bgp_show_afis(int code, char *s, u32 *afis, uint count) cli_msg(code, b.start); } -static const char * +const char * bgp_format_role_name(u8 role) { static const char *bgp_role_names[] = { "provider", "rs_server", "rs_client", "customer", "peer" }; diff --git a/proto/bgp/bgp.h b/proto/bgp/bgp.h index 5a680022..6402921a 100644 --- a/proto/bgp/bgp.h +++ b/proto/bgp/bgp.h @@ -554,9 +554,7 @@ void bgp_refresh_begin(struct bgp_channel *c); void bgp_refresh_end(struct bgp_channel *c); void bgp_store_error(struct bgp_proto *p, struct bgp_conn *c, u8 class, u32 code); void bgp_stop(struct bgp_proto *p, int subcode, byte *data, uint len); - -struct rte_source *bgp_find_source(struct bgp_proto *p, u32 path_id); -struct rte_source *bgp_get_source(struct bgp_proto *p, u32 path_id); +const char *bgp_format_role_name(u8 role); static inline int rte_resolvable(const rte *rt) diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c index 0b8a899a..924d6828 100644 --- a/proto/bgp/packets.c +++ b/proto/bgp/packets.c @@ -908,10 +908,10 @@ bgp_rx_open(struct bgp_conn *conn, byte *pkt, uint len) (local_role == BGP_ROLE_PROVIDER && neigh_role == BGP_ROLE_CUSTOMER) || (local_role == BGP_ROLE_RS_CLIENT && neigh_role == BGP_ROLE_RS_SERVER) || (local_role == BGP_ROLE_RS_SERVER && neigh_role == BGP_ROLE_RS_CLIENT))) - { bgp_error(conn, 2, 11, NULL, 0); return; } + { bgp_error(conn, 2, 11, &neigh_role, -1); return; } if ((p->cf->require_roles) && (neigh_role == BGP_ROLE_UNDEFINED)) - { bgp_error(conn, 2, 11, NULL, 0); return; } + { bgp_error(conn, 2, 11, &neigh_role, -1); return; } /* Check the other connection */ other = (conn == &p->outgoing_conn) ? &p->incoming_conn : &p->outgoing_conn; @@ -3152,6 +3152,12 @@ bgp_log_error(struct bgp_proto *p, u8 class, char *msg, uint code, uint subcode, goto done; } + if ((code == 2) && (subcode == 11) && (len == 1)) + { + t += bsprintf(t, " (%s)", bgp_format_role_name(get_u8(data))); + goto done; + } + /* RFC 8203 - shutdown communication */ if (((code == 6) && ((subcode == 2) || (subcode == 4)))) if (bgp_handle_message(p, data, len, &t)) diff --git a/proto/pipe/pipe.c b/proto/pipe/pipe.c index 0b0d9151..9d1bb6ce 100644 --- a/proto/pipe/pipe.c +++ b/proto/pipe/pipe.c @@ -43,10 +43,6 @@ #include "pipe.h" -#ifdef CONFIG_BGP -#include "proto/bgp/bgp.h" -#endif - static void pipe_rt_notify(struct proto *P, struct channel *src_ch, const net_addr *n, rte *new, const rte *old) { diff --git a/sysdep/unix/alloc.c b/sysdep/unix/alloc.c index 04cf7498..6c68a865 100644 --- a/sysdep/unix/alloc.c +++ b/sysdep/unix/alloc.c @@ -22,6 +22,9 @@ #ifdef CONFIG_DISABLE_THP #include <sys/prctl.h> +#ifndef PR_SET_THP_DISABLE +#define PR_SET_THP_DISABLE 41 +#endif #endif long page_size = 0; @@ -78,7 +81,7 @@ alloc_sys_page(void) void *ptr = mmap(NULL, page_size * ALLOC_PAGES_AT_ONCE, PROT_WRITE | PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (ptr == MAP_FAILED) - bug("mmap(%lu) failed: %m", page_size); + die("mmap(%ld) failed: %m", (s64) page_size); return ptr; } @@ -99,7 +102,7 @@ alloc_page(void) int err = posix_memalign(&ptr, page_size, page_size); if (err || !ptr) - bug("posix_memalign(%lu) failed", (long unsigned int) page_size); + die("posix_memalign(%ld) failed", (s64) page_size); return ptr; } @@ -298,7 +301,7 @@ resource_sys_init(void) #ifdef CONFIG_DISABLE_THP /* Disable transparent huge pages, they do not work properly with madvice(MADV_DONTNEED) */ if (prctl(PR_SET_THP_DISABLE, (unsigned long) 1, (unsigned long) 0, (unsigned long) 0, (unsigned long) 0) < 0) - die("prctl(PR_SET_THP_DISABLE) failed: %m"); + log(L_WARN "Cannot disable transparent huge pages: prctl(PR_SET_THP_DISABLE) failed: %m"); #endif #ifdef HAVE_MMAP |