diff options
| -rw-r--r-- | babeld/babel_errors.c | 8 | ||||
| -rw-r--r-- | babeld/babel_errors.h | 8 | ||||
| -rw-r--r-- | babeld/babel_interface.c | 20 | ||||
| -rw-r--r-- | babeld/babel_main.c | 10 | ||||
| -rw-r--r-- | babeld/babeld.c | 8 | ||||
| -rw-r--r-- | babeld/message.c | 52 | ||||
| -rw-r--r-- | babeld/neighbour.c | 2 | ||||
| -rw-r--r-- | babeld/route.c | 18 | ||||
| -rw-r--r-- | babeld/source.c | 2 | 
9 files changed, 64 insertions, 64 deletions
diff --git a/babeld/babel_errors.c b/babeld/babel_errors.c index e03cace379..b22b1d5cbf 100644 --- a/babeld/babel_errors.c +++ b/babeld/babel_errors.c @@ -26,25 +26,25 @@  /* clang-format off */  static struct log_ref ferr_babel_err[] = {  	{ -		.code = BABEL_ERR_MEMORY, +		.code = EC_BABEL_MEMORY,  		.title = "BABEL Memory Errors",  		.description = "Babel has failed to allocate memory, the system is about to run out of memory",  		.suggestion = "Find the process that is causing memory shortages, remediate that process and restart FRR"  	},  	{ -		.code = BABEL_ERR_PACKET, +		.code = EC_BABEL_PACKET,  		.title = "BABEL Packet Error",  		.description = "Babel has detected a packet encode/decode problem",  		.suggestion = "Collect relevant log files and file an Issue"  	},  	{ -		.code = BABEL_ERR_CONFIG, +		.code = EC_BABEL_CONFIG,  		.title = "BABEL Configuration Error",  		.description = "Babel has detected a configuration error of some sort",  		.suggestion = "Ensure that the configuration is correct"  	},  	{ -		.code = BABEL_ERR_ROUTE, +		.code = EC_BABEL_ROUTE,  		.title = "BABEL Route Error",  		.description = "Babel has detected a routing error and has an inconsistent state",  		.suggestion = "Gather data for filing an Issue and then restart FRR" diff --git a/babeld/babel_errors.h b/babeld/babel_errors.h index 19adc63f04..629b6604be 100644 --- a/babeld/babel_errors.h +++ b/babeld/babel_errors.h @@ -24,10 +24,10 @@  #include "lib/ferr.h"  enum babel_log_refs { -	BABEL_ERR_MEMORY = BABEL_FERR_START, -	BABEL_ERR_PACKET, -	BABEL_ERR_CONFIG, -	BABEL_ERR_ROUTE, +	EC_BABEL_MEMORY = BABEL_FERR_START, +	EC_BABEL_PACKET, +	EC_BABEL_CONFIG, +	EC_BABEL_ROUTE,  };  extern void babel_error_init(void); diff --git a/babeld/babel_interface.c b/babeld/babel_interface.c index b7c01e73dc..22bdf1fe1e 100644 --- a/babeld/babel_interface.c +++ b/babeld/babel_interface.c @@ -169,7 +169,7 @@ babel_interface_address_add (int cmd, struct zclient *client,          if (babel_ifp->ipv4 == NULL) {              babel_ifp->ipv4 = malloc(4);              if (babel_ifp->ipv4 == NULL) { -                flog_err(BABEL_ERR_MEMORY, "not enough memory"); +                flog_err(EC_BABEL_MEMORY, "not enough memory");              } else {                  memcpy(babel_ifp->ipv4, &prefix->u.prefix4, 4);              } @@ -709,7 +709,7 @@ interface_recalculate(struct interface *ifp)      tmp = babel_ifp->sendbuf;      babel_ifp->sendbuf = realloc(babel_ifp->sendbuf, babel_ifp->bufsize);      if(babel_ifp->sendbuf == NULL) { -        flog_err(BABEL_ERR_MEMORY, "Couldn't reallocate sendbuf."); +        flog_err(EC_BABEL_MEMORY, "Couldn't reallocate sendbuf.");          free(tmp);          babel_ifp->bufsize = 0;          return -1; @@ -1060,7 +1060,7 @@ DEFUN (show_babel_route,          }          route_stream_done(routes);      } else { -        flog_err(BABEL_ERR_MEMORY, "Couldn't allocate route stream."); +        flog_err(EC_BABEL_MEMORY, "Couldn't allocate route stream.");      }      xroutes = xroute_stream();      if(xroutes) { @@ -1072,7 +1072,7 @@ DEFUN (show_babel_route,          }          xroute_stream_done(xroutes);      } else { -        flog_err(BABEL_ERR_MEMORY, "Couldn't allocate route stream."); +        flog_err(EC_BABEL_MEMORY, "Couldn't allocate route stream.");      }      return CMD_SUCCESS;  } @@ -1107,7 +1107,7 @@ DEFUN (show_babel_route_prefix,          }          route_stream_done(routes);      } else { -        flog_err(BABEL_ERR_MEMORY, "Couldn't allocate route stream."); +        flog_err(EC_BABEL_MEMORY, "Couldn't allocate route stream.");      }      xroutes = xroute_stream();      if(xroutes) { @@ -1119,7 +1119,7 @@ DEFUN (show_babel_route_prefix,          }          xroute_stream_done(xroutes);      } else { -        flog_err(BABEL_ERR_MEMORY, "Couldn't allocate route stream."); +        flog_err(EC_BABEL_MEMORY, "Couldn't allocate route stream.");      }      return CMD_SUCCESS;  } @@ -1165,7 +1165,7 @@ DEFUN (show_babel_route_addr,          }          route_stream_done(routes);      } else { -        flog_err(BABEL_ERR_MEMORY, "Couldn't allocate route stream."); +        flog_err(EC_BABEL_MEMORY, "Couldn't allocate route stream.");      }      xroutes = xroute_stream();      if(xroutes) { @@ -1177,7 +1177,7 @@ DEFUN (show_babel_route_addr,          }          xroute_stream_done(xroutes);      } else { -        flog_err(BABEL_ERR_MEMORY, "Couldn't allocate route stream."); +        flog_err(EC_BABEL_MEMORY, "Couldn't allocate route stream.");      }      return CMD_SUCCESS;  } @@ -1224,7 +1224,7 @@ DEFUN (show_babel_route_addr6,          }          route_stream_done(routes);      } else { -        flog_err(BABEL_ERR_MEMORY, "Couldn't allocate route stream."); +        flog_err(EC_BABEL_MEMORY, "Couldn't allocate route stream.");      }      xroutes = xroute_stream();      if(xroutes) { @@ -1236,7 +1236,7 @@ DEFUN (show_babel_route_addr6,          }          xroute_stream_done(xroutes);      } else { -        flog_err(BABEL_ERR_MEMORY, "Couldn't allocate route stream."); +        flog_err(EC_BABEL_MEMORY, "Couldn't allocate route stream.");      }      return CMD_SUCCESS;  } diff --git a/babeld/babel_main.c b/babeld/babel_main.c index 31a3fb5b4d..f075767204 100644 --- a/babeld/babel_main.c +++ b/babeld/babel_main.c @@ -297,7 +297,7 @@ babel_load_state_file(void)                  unsigned char sid[8];                  rc = parse_eui64(buf2, sid);                  if(rc < 0) { -                    flog_err(BABEL_ERR_CONFIG, "Couldn't parse babel-state."); +                    flog_err(EC_BABEL_CONFIG, "Couldn't parse babel-state.");                  } else {                      struct timeval realnow;                      debugf(BABEL_DEBUG_COMMON, @@ -307,13 +307,13 @@ babel_load_state_file(void)                      if(memcmp(sid, myid, 8) == 0)                          myseqno = seqno_plus(s, 1);                      else -                        flog_err(BABEL_ERR_CONFIG, +                        flog_err(EC_BABEL_CONFIG,  				 "ID mismatch in babel-state. id=%s; old=%s",                                   format_eui64(myid),                                   format_eui64(sid));                  }              } else { -                flog_err(BABEL_ERR_CONFIG, "Couldn't parse babel-state."); +                flog_err(EC_BABEL_CONFIG, "Couldn't parse babel-state.");              }          }          goto fini; @@ -364,12 +364,12 @@ babel_save_state_file(void)                        format_eui64(myid), (int)myseqno,                        (long)realnow.tv_sec);          if(rc < 0 || rc >= 100) { -            flog_err(BABEL_ERR_CONFIG, "write(babel-state): overflow."); +            flog_err(EC_BABEL_CONFIG, "write(babel-state): overflow.");              unlink(state_file);          } else {              rc = write(fd, buf, rc);              if(rc < 0) { -                flog_err(BABEL_ERR_CONFIG, "write(babel-state): %s", +                flog_err(EC_BABEL_CONFIG, "write(babel-state): %s",  			  safe_strerror(errno));                  unlink(state_file);              } diff --git a/babeld/babeld.c b/babeld/babeld.c index 54692cdf2e..18e5b479bc 100644 --- a/babeld/babeld.c +++ b/babeld/babeld.c @@ -255,12 +255,12 @@ babel_get_myid(void)          return;      } -    flog_err(BABEL_ERR_CONFIG, +    flog_err(EC_BABEL_CONFIG,  	      "Warning: couldn't find router id -- using random value.");      rc = read_random_bytes(myid, 8);      if(rc < 0) { -        flog_err(BABEL_ERR_CONFIG, "read(random): %s (cannot assign an ID)", +        flog_err(EC_BABEL_CONFIG, "read(random): %s (cannot assign an ID)",  		  safe_strerror(errno));          exit(1);      } @@ -519,7 +519,7 @@ resize_receive_buffer(int size)      if(receive_buffer == NULL) {          receive_buffer = malloc(size);          if(receive_buffer == NULL) { -            flog_err(BABEL_ERR_MEMORY, "malloc(receive_buffer): %s", +            flog_err(EC_BABEL_MEMORY, "malloc(receive_buffer): %s",  		      safe_strerror(errno));              return -1;          } @@ -528,7 +528,7 @@ resize_receive_buffer(int size)          unsigned char *new;          new = realloc(receive_buffer, size);          if(new == NULL) { -            flog_err(BABEL_ERR_MEMORY, "realloc(receive_buffer): %s", +            flog_err(EC_BABEL_MEMORY, "realloc(receive_buffer): %s",  		      safe_strerror(errno));              return -1;          } diff --git a/babeld/message.c b/babeld/message.c index 09eaca7a48..f85a08ac3a 100644 --- a/babeld/message.c +++ b/babeld/message.c @@ -141,12 +141,12 @@ parse_update_subtlv(const unsigned char *a, int alen,          }          if(i + 1 > alen) { -            flog_err(BABEL_ERR_PACKET, "Received truncated attributes."); +            flog_err(EC_BABEL_PACKET, "Received truncated attributes.");              return;          }          len = a[i + 1];          if(i + len > alen) { -            flog_err(BABEL_ERR_PACKET, "Received truncated attributes."); +            flog_err(EC_BABEL_PACKET, "Received truncated attributes.");              return;          } @@ -154,14 +154,14 @@ parse_update_subtlv(const unsigned char *a, int alen,              /* Nothing. */          } else if(type == SUBTLV_DIVERSITY) {              if(len > DIVERSITY_HOPS) { -                flog_err(BABEL_ERR_PACKET, +                flog_err(EC_BABEL_PACKET,  			  "Received overlong channel information (%d > %d).n",                            len, DIVERSITY_HOPS);                  len = DIVERSITY_HOPS;              }              if(memchr(a + i + 2, 0, len) != NULL) {                  /* 0 is reserved. */ -                flog_err(BABEL_ERR_PACKET, "Channel information contains 0!"); +                flog_err(EC_BABEL_PACKET, "Channel information contains 0!");                  return;              }              memset(channels, 0, DIVERSITY_HOPS); @@ -189,13 +189,13 @@ parse_hello_subtlv(const unsigned char *a, int alen,          }          if(i + 1 > alen) { -            flog_err(BABEL_ERR_PACKET, +            flog_err(EC_BABEL_PACKET,  		      "Received truncated sub-TLV on Hello message.");              return -1;          }          len = a[i + 1];          if(i + len > alen) { -            flog_err(BABEL_ERR_PACKET, +            flog_err(EC_BABEL_PACKET,  		      "Received truncated sub-TLV on Hello message.");              return -1;          } @@ -207,7 +207,7 @@ parse_hello_subtlv(const unsigned char *a, int alen,                  DO_NTOHL(*hello_send_us, a + i + 2);                  ret = 1;              } else { -                flog_err(BABEL_ERR_PACKET, +                flog_err(EC_BABEL_PACKET,  			  "Received incorrect RTT sub-TLV on Hello message.");              }          } else { @@ -235,13 +235,13 @@ parse_ihu_subtlv(const unsigned char *a, int alen,          }          if(i + 1 > alen) { -            flog_err(BABEL_ERR_PACKET, +            flog_err(EC_BABEL_PACKET,  		      "Received truncated sub-TLV on IHU message.");              return -1;          }          len = a[i + 1];          if(i + len > alen) { -            flog_err(BABEL_ERR_PACKET, +            flog_err(EC_BABEL_PACKET,  		      "Received truncated sub-TLV on IHU message.");              return -1;          } @@ -255,7 +255,7 @@ parse_ihu_subtlv(const unsigned char *a, int alen,                  ret = 1;              }              else { -                flog_err(BABEL_ERR_PACKET, +                flog_err(EC_BABEL_PACKET,  			  "Received incorrect RTT sub-TLV on IHU message.");              }          } else { @@ -345,14 +345,14 @@ parse_packet(const unsigned char *from, struct interface *ifp,      }      if(!linklocal(from)) { -        flog_err(BABEL_ERR_PACKET, +        flog_err(EC_BABEL_PACKET,  		  "Received packet from non-local address %s.",                    format_address(from));          return;      }      if (babel_packet_examin (packet, packetlen)) { -        flog_err(BABEL_ERR_PACKET, +        flog_err(EC_BABEL_PACKET,  		  "Received malformed packet on %s from %s.",                    ifp->name, format_address(from));          return; @@ -360,14 +360,14 @@ parse_packet(const unsigned char *from, struct interface *ifp,      neigh = find_neighbour(from, ifp);      if(neigh == NULL) { -        flog_err(BABEL_ERR_PACKET, "Couldn't allocate neighbour."); +        flog_err(EC_BABEL_PACKET, "Couldn't allocate neighbour.");          return;      }      DO_NTOHS(bodylen, packet + 2);      if(bodylen + 4 > packetlen) { -        flog_err(BABEL_ERR_PACKET, "Received truncated packet (%d + 4 > %d).", +        flog_err(EC_BABEL_PACKET, "Received truncated packet (%d + 4 > %d).",                   bodylen, packetlen);          bodylen = packetlen - 4;      } @@ -516,7 +516,7 @@ parse_packet(const unsigned char *from, struct interface *ifp,                  have_router_id = 1;              }              if(!have_router_id && message[2] != 0) { -                flog_err(BABEL_ERR_PACKET, +                flog_err(EC_BABEL_PACKET,  			  "Received prefix with no router id.");                  goto fail;              } @@ -528,7 +528,7 @@ parse_packet(const unsigned char *from, struct interface *ifp,              if(message[2] == 0) {                  if(metric < 0xFFFF) { -                    flog_err(BABEL_ERR_PACKET, +                    flog_err(EC_BABEL_PACKET,  			      "Received wildcard update with finite metric.");                      goto done;                  } @@ -621,7 +621,7 @@ parse_packet(const unsigned char *from, struct interface *ifp,          continue;      fail: -        flog_err(BABEL_ERR_PACKET, +        flog_err(EC_BABEL_PACKET,  		  "Couldn't parse packet (%d, %d) from %s on %s.",                    message[0], message[1], format_address(from), ifp->name);          goto done; @@ -710,7 +710,7 @@ fill_rtt_message(struct interface *ifp)              DO_HTONL(babel_ifp->sendbuf + babel_ifp->buffered_hello + 10, time);              return 1;          } else { -            flog_err(BABEL_ERR_PACKET, "No space left for timestamp sub-TLV " +            flog_err(EC_BABEL_PACKET, "No space left for timestamp sub-TLV "                       "(this shouldn't happen)");              return -1;          } @@ -745,9 +745,9 @@ flushbuf(struct interface *ifp)                              babel_ifp->sendbuf, babel_ifp->buffered,                              (struct sockaddr*)&sin6, sizeof(sin6));              if(rc < 0) -                flog_err(BABEL_ERR_PACKET, "send: %s", safe_strerror(errno)); +                flog_err(EC_BABEL_PACKET, "send: %s", safe_strerror(errno));          } else { -            flog_err(BABEL_ERR_PACKET, +            flog_err(EC_BABEL_PACKET,  		      "Warning: bucket full, dropping packet to %s.",                        ifp->name);          } @@ -870,7 +870,7 @@ start_unicast_message(struct neighbour *neigh, int type, int len)      if(!unicast_buffer)          unicast_buffer = malloc(UNICAST_BUFSIZE);      if(!unicast_buffer) { -        flog_err(BABEL_ERR_MEMORY, "malloc(unicast_buffer): %s", +        flog_err(EC_BABEL_MEMORY, "malloc(unicast_buffer): %s",  		  safe_strerror(errno));          return -1;      } @@ -1007,10 +1007,10 @@ flush_unicast(int dofree)                          unicast_buffer, unicast_buffered,                          (struct sockaddr*)&sin6, sizeof(sin6));          if(rc < 0) -            flog_err(BABEL_ERR_PACKET, "send(unicast): %s", +            flog_err(EC_BABEL_PACKET, "send(unicast): %s",  		      safe_strerror(errno));      } else { -        flog_err(BABEL_ERR_PACKET, +        flog_err(EC_BABEL_PACKET,  		  "Warning: bucket full, dropping unicast packet to %s if %s.",                    format_address(unicast_neighbour->address),                    unicast_neighbour->ifp->name); @@ -1318,7 +1318,7 @@ buffer_update(struct interface *ifp,      again:          babel_ifp->buffered_updates = malloc(n *sizeof(struct buffered_update));          if(babel_ifp->buffered_updates == NULL) { -            flog_err(BABEL_ERR_MEMORY, "malloc(buffered_updates): %s", +            flog_err(EC_BABEL_MEMORY, "malloc(buffered_updates): %s",  		      safe_strerror(errno));              if(n > 4) {                  /* Try again with a tiny buffer. */ @@ -1382,7 +1382,7 @@ send_update(struct interface *ifp, int urgent,              }              route_stream_done(routes);          } else { -            flog_err(BABEL_ERR_MEMORY, "Couldn't allocate route stream."); +            flog_err(EC_BABEL_MEMORY, "Couldn't allocate route stream.");          }          set_timeout(&babel_ifp->update_timeout, babel_ifp->update_interval);          babel_ifp->last_update_time = babel_now.tv_sec; @@ -1460,7 +1460,7 @@ send_self_update(struct interface *ifp)          }          xroute_stream_done(xroutes);      } else { -        flog_err(BABEL_ERR_MEMORY, "Couldn't allocate xroute stream."); +        flog_err(EC_BABEL_MEMORY, "Couldn't allocate xroute stream.");      }  } diff --git a/babeld/neighbour.c b/babeld/neighbour.c index 512b60e29a..83f05bb5cf 100644 --- a/babeld/neighbour.c +++ b/babeld/neighbour.c @@ -94,7 +94,7 @@ find_neighbour(const unsigned char *address, struct interface *ifp)      neigh = malloc(sizeof(struct neighbour));      if(neigh == NULL) { -        flog_err(BABEL_ERR_MEMORY, "malloc(neighbour): %s", +        flog_err(EC_BABEL_MEMORY, "malloc(neighbour): %s",  		  safe_strerror(errno));          return NULL;      } diff --git a/babeld/route.c b/babeld/route.c index ceeaa10577..76f038cda5 100644 --- a/babeld/route.c +++ b/babeld/route.c @@ -399,14 +399,14 @@ install_route(struct babel_route *route)          return;      if(!route_feasible(route)) -        flog_err(BABEL_ERR_ROUTE, "WARNING: installing unfeasible route " +        flog_err(EC_BABEL_ROUTE, "WARNING: installing unfeasible route "                    "(this shouldn't happen).");      i = find_route_slot(route->src->prefix, route->src->plen, NULL);      assert(i >= 0 && i < route_slots);      if(routes[i] != route && routes[i]->installed) { -        flog_err(BABEL_ERR_ROUTE, +        flog_err(EC_BABEL_ROUTE,  		  "WARNING: attempting to install duplicate route "                    "(this shouldn't happen).");          return; @@ -418,7 +418,7 @@ install_route(struct babel_route *route)                        metric_to_kernel(route_metric(route)), NULL, 0, 0);      if(rc < 0) {          int save = errno; -        flog_err(BABEL_ERR_ROUTE, "kernel_route(ADD): %s", +        flog_err(EC_BABEL_ROUTE, "kernel_route(ADD): %s",  		  safe_strerror(errno));          if(save != EEXIST)              return; @@ -441,7 +441,7 @@ uninstall_route(struct babel_route *route)                        route->neigh->ifp->ifindex,                        metric_to_kernel(route_metric(route)), NULL, 0, 0);      if(rc < 0) -        flog_err(BABEL_ERR_ROUTE, "kernel_route(FLUSH): %s", +        flog_err(EC_BABEL_ROUTE, "kernel_route(FLUSH): %s",  		  safe_strerror(errno));      route->installed = 0; @@ -465,7 +465,7 @@ switch_routes(struct babel_route *old, struct babel_route *new)          return;      if(!route_feasible(new)) -        flog_err(BABEL_ERR_ROUTE, "WARNING: switching to unfeasible route " +        flog_err(EC_BABEL_ROUTE, "WARNING: switching to unfeasible route "                    "(this shouldn't happen).");      rc = kernel_route(ROUTE_MODIFY, old->src->prefix, old->src->plen, @@ -474,7 +474,7 @@ switch_routes(struct babel_route *old, struct babel_route *new)                        new->nexthop, new->neigh->ifp->ifindex,                        metric_to_kernel(route_metric(new)));      if(rc < 0) { -        flog_err(BABEL_ERR_ROUTE, "kernel_route(MODIFY): %s", +        flog_err(EC_BABEL_ROUTE, "kernel_route(MODIFY): %s",  		  safe_strerror(errno));          return;      } @@ -503,7 +503,7 @@ change_route_metric(struct babel_route *route,                            route->nexthop, route->neigh->ifp->ifindex,                            new);          if(rc < 0) { -            flog_err(BABEL_ERR_ROUTE, "kernel_route(MODIFY metric): %s", +            flog_err(EC_BABEL_ROUTE, "kernel_route(MODIFY metric): %s",  		      safe_strerror(errno));              return;          } @@ -798,7 +798,7 @@ update_route(const unsigned char *router_id,          return NULL;      if(martian_prefix(prefix, plen)) { -        flog_err(BABEL_ERR_ROUTE, "Rejecting martian route to %s through %s.", +        flog_err(EC_BABEL_ROUTE, "Rejecting martian route to %s through %s.",                   format_prefix(prefix, plen), format_address(nexthop));          return NULL;      } @@ -906,7 +906,7 @@ update_route(const unsigned char *router_id,          route->next = NULL;          new_route = insert_route(route);          if(new_route == NULL) { -            flog_err(BABEL_ERR_ROUTE, "Couldn't insert route."); +            flog_err(EC_BABEL_ROUTE, "Couldn't insert route.");              free(route);              return NULL;          } diff --git a/babeld/source.c b/babeld/source.c index 75bca06206..ed165b41b4 100644 --- a/babeld/source.c +++ b/babeld/source.c @@ -63,7 +63,7 @@ find_source(const unsigned char *id, const unsigned char *p, unsigned char plen,      src = malloc(sizeof(struct source));      if(src == NULL) { -        flog_err(BABEL_ERR_MEMORY, "malloc(source): %s", safe_strerror(errno)); +        flog_err(EC_BABEL_MEMORY, "malloc(source): %s", safe_strerror(errno));          return NULL;      }  | 
