0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2025-01-05 08:31:53 +00:00

Merge branch 'int-new' into mq-taskqueue

This commit is contained in:
Jan Maria Matejka 2018-09-18 14:33:37 +02:00
commit c3d0f91978
14 changed files with 38 additions and 21 deletions

View File

@ -100,6 +100,7 @@ static struct include_file_stack *ifs_head;
#define YY_INPUT(buf,result,max) result = cf_read_hook(buf, max, ifs->fd); #define YY_INPUT(buf,result,max) result = cf_read_hook(buf, max, ifs->fd);
#define YY_NO_UNPUT #define YY_NO_UNPUT
#define YY_FATAL_ERROR(msg) cf_error(msg) #define YY_FATAL_ERROR(msg) cf_error(msg)
#define YY_USER_ACTION ifs->chno += yyleng; ifs->toklen = yyleng;
static void cf_include(char *arg, int alen); static void cf_include(char *arg, int alen);
static int check_eof(void); static int check_eof(void);
@ -313,7 +314,7 @@ else: {
{WHITE}+ {WHITE}+
\n ifs->lino++; \n ifs->lino++; ifs->chno = 0;
# BEGIN(COMMENT); # BEGIN(COMMENT);
@ -323,13 +324,14 @@ else: {
<COMMENT>\n { <COMMENT>\n {
ifs->lino++; ifs->lino++;
ifs->chno = 0;
BEGIN(INITIAL); BEGIN(INITIAL);
} }
<COMMENT>. <COMMENT>.
<CCOMM>\*\/ BEGIN(INITIAL); <CCOMM>\*\/ BEGIN(INITIAL);
<CCOMM>\n ifs->lino++; <CCOMM>\n ifs->lino++; ifs->chno = 0;
<CCOMM>\/\* cf_error("Comment nesting not supported"); <CCOMM>\/\* cf_error("Comment nesting not supported");
<CCOMM><<EOF>> cf_error("Unterminated comment"); <CCOMM><<EOF>> cf_error("Unterminated comment");
<CCOMM>. <CCOMM>.

View File

@ -512,6 +512,7 @@ cf_error(const char *msg, ...)
va_end(args); va_end(args);
new_config->err_msg = cfg_strdup(buf); new_config->err_msg = cfg_strdup(buf);
new_config->err_lino = ifs->lino; new_config->err_lino = ifs->lino;
new_config->err_chno = ifs->chno - ifs->toklen + 1;
new_config->err_file_name = ifs->file_name; new_config->err_file_name = ifs->file_name;
cf_lex_unwind(); cf_lex_unwind();
longjmp(conf_jmpbuf, 1); longjmp(conf_jmpbuf, 1);

View File

@ -47,6 +47,7 @@ struct config {
u32 watchdog_timeout; /* Watchdog timeout (in seconds, 0 = disabled) */ u32 watchdog_timeout; /* Watchdog timeout (in seconds, 0 = disabled) */
char *err_msg; /* Parser error message */ char *err_msg; /* Parser error message */
int err_lino; /* Line containing error */ int err_lino; /* Line containing error */
int err_chno; /* Character where the parser stopped */
char *err_file_name; /* File name containing error */ char *err_file_name; /* File name containing error */
char *file_name; /* Name of main configuration file */ char *file_name; /* Name of main configuration file */
int file_fd; /* File descriptor of main configuration file */ int file_fd; /* File descriptor of main configuration file */
@ -139,6 +140,8 @@ struct include_file_stack {
char *file_name; /* File name */ char *file_name; /* File name */
int fd; /* File descriptor */ int fd; /* File descriptor */
int lino; /* Current line num */ int lino; /* Current line num */
int chno; /* Current char num (on current line) */
int toklen; /* Current token length */
int depth; /* Include depth, 0 = cannot include */ int depth; /* Include depth, 0 = cannot include */
struct include_file_stack *prev; /* Previous record in stack */ struct include_file_stack *prev; /* Previous record in stack */
@ -147,7 +150,6 @@ struct include_file_stack {
extern struct include_file_stack *ifs; extern struct include_file_stack *ifs;
int cf_lex(void); int cf_lex(void);
void cf_lex_init(int is_cli, struct config *c); void cf_lex_init(int is_cli, struct config *c);
void cf_lex_unwind(void); void cf_lex_unwind(void);

View File

@ -424,6 +424,7 @@ int bvsnprintf(char *buf, int size, const char *fmt, va_list args)
case 'X': case 'X':
flags |= LARGE; flags |= LARGE;
/* fallthrough */
case 'x': case 'x':
base = 16; base = 16;
break; break;

View File

@ -805,7 +805,7 @@ as_path_match(const struct adata *path, struct f_path_mask *mask)
val2 = val = mask->val; val2 = val = mask->val;
goto step; goto step;
case PM_ASN_EXPR: case PM_ASN_EXPR:
ASSERT(0); bug("Expressions should be evaluated on AS path mask construction.");
case PM_ASN_RANGE: case PM_ASN_RANGE:
val = mask->val; val = mask->val;
val2 = mask->val2; val2 = mask->val2;

View File

@ -141,6 +141,7 @@ bfd_fill_authentication(struct bfd_proto *p, struct bfd_session *s, struct bfd_c
case BFD_AUTH_METICULOUS_KEYED_MD5: case BFD_AUTH_METICULOUS_KEYED_MD5:
case BFD_AUTH_METICULOUS_KEYED_SHA1: case BFD_AUTH_METICULOUS_KEYED_SHA1:
meticulous = 1; meticulous = 1;
/* fallthrough */
case BFD_AUTH_KEYED_MD5: case BFD_AUTH_KEYED_MD5:
case BFD_AUTH_KEYED_SHA1: case BFD_AUTH_KEYED_SHA1:
@ -230,6 +231,7 @@ bfd_check_authentication(struct bfd_proto *p, struct bfd_session *s, struct bfd_
case BFD_AUTH_METICULOUS_KEYED_MD5: case BFD_AUTH_METICULOUS_KEYED_MD5:
case BFD_AUTH_METICULOUS_KEYED_SHA1: case BFD_AUTH_METICULOUS_KEYED_SHA1:
meticulous = 1; meticulous = 1;
/* fallthrough */
case BFD_AUTH_KEYED_MD5: case BFD_AUTH_KEYED_MD5:
case BFD_AUTH_KEYED_SHA1: case BFD_AUTH_KEYED_SHA1:

View File

@ -353,6 +353,7 @@ ospf_receive_dbdes(struct ospf_packet *pkt, struct ospf_iface *ifa,
ospf_neigh_sm(n, INM_2WAYREC); ospf_neigh_sm(n, INM_2WAYREC);
if (n->state != NEIGHBOR_EXSTART) if (n->state != NEIGHBOR_EXSTART)
return; return;
/* fallthrough */
case NEIGHBOR_EXSTART: case NEIGHBOR_EXSTART:
if ((ifa->type != OSPF_IT_VLINK) && if ((ifa->type != OSPF_IT_VLINK) &&

View File

@ -1200,6 +1200,7 @@ ospf_sh_state(struct proto *P, int verbose, int reachable)
he->domain = 1; /* Abuse domain field to mark the LSA */ he->domain = 1; /* Abuse domain field to mark the LSA */
hex[jx++] = he; hex[jx++] = he;
} }
/* fallthrough */
default: default:
accept = 0; accept = 0;
} }

View File

@ -57,6 +57,7 @@ ospf_pkt_finalize2(struct ospf_iface *ifa, struct ospf_packet *pkt, uint *plen)
return; return;
} }
strncpy(auth->password, pass->password, sizeof(auth->password)); strncpy(auth->password, pass->password, sizeof(auth->password));
/* fallthrough */
case OSPF_AUTH_NONE: case OSPF_AUTH_NONE:
{ {

View File

@ -230,6 +230,7 @@ radv_iface_notify(struct radv_iface *ifa, int event)
{ {
case RA_EV_CHANGE: case RA_EV_CHANGE:
radv_invalidate(ifa); radv_invalidate(ifa);
/* fallthrough */
case RA_EV_INIT: case RA_EV_INIT:
ifa->initial = MAX_INITIAL_RTR_ADVERTISEMENTS; ifa->initial = MAX_INITIAL_RTR_ADVERTISEMENTS;
radv_prepare_prefixes(ifa); radv_prepare_prefixes(ifa);

View File

@ -58,7 +58,9 @@ struct rip_block_auth
{ {
u16 must_be_ffff; u16 must_be_ffff;
u16 auth_type; u16 auth_type;
char password[0]; union {
char password[16];
struct {
u16 packet_len; u16 packet_len;
u8 key_id; u8 key_id;
u8 auth_len; u8 auth_len;
@ -66,6 +68,8 @@ struct rip_block_auth
u32 unused1; u32 unused1;
u32 unused2; u32 unused2;
}; };
};
};
/* Authentication tail, RFC 4822 */ /* Authentication tail, RFC 4822 */
struct rip_auth_tail struct rip_auth_tail

View File

@ -1128,7 +1128,7 @@ sk_ssh_connect(sock *s)
default: default:
return SSH_ERROR; return SSH_ERROR;
} }
} } /* fallthrough */
case SK_SSH_SERVER_KNOWN: case SK_SSH_SERVER_KNOWN:
{ {
@ -1175,7 +1175,7 @@ sk_ssh_connect(sock *s)
if (!server_identity_is_ok) if (!server_identity_is_ok)
return SSH_ERROR; return SSH_ERROR;
} }
} } /* fallthrough */
case SK_SSH_USERAUTH: case SK_SSH_USERAUTH:
{ {
@ -1191,7 +1191,7 @@ sk_ssh_connect(sock *s)
default: default:
return SSH_ERROR; return SSH_ERROR;
} }
} } /* fallthrough */
case SK_SSH_CHANNEL: case SK_SSH_CHANNEL:
{ {
@ -1199,7 +1199,7 @@ sk_ssh_connect(sock *s)
s->ssh->channel = ssh_channel_new(s->ssh->session); s->ssh->channel = ssh_channel_new(s->ssh->session);
if (s->ssh->channel == NULL) if (s->ssh->channel == NULL)
return SSH_ERROR; return SSH_ERROR;
} } /* fallthrough */
case SK_SSH_SESSION: case SK_SSH_SESSION:
{ {
@ -1215,7 +1215,7 @@ sk_ssh_connect(sock *s)
default: default:
return SSH_ERROR; return SSH_ERROR;
} }
} } /* fallthrough */
case SK_SSH_SUBSYSTEM: case SK_SSH_SUBSYSTEM:
{ {
@ -1234,7 +1234,7 @@ sk_ssh_connect(sock *s)
return SSH_ERROR; return SSH_ERROR;
} }
} }
} } /* fallthrough */
case SK_SSH_ESTABLISHED: case SK_SSH_ESTABLISHED:
s->ssh->state = SK_SSH_ESTABLISHED; s->ssh->state = SK_SSH_ESTABLISHED;

View File

@ -784,7 +784,8 @@ krt_got_route_async(struct krt_proto *p, rte *e, int new)
switch (e->u.krt.src) switch (e->u.krt.src)
{ {
case KRT_SRC_BIRD: case KRT_SRC_BIRD:
ASSERT(0); /* Should be filtered by the back end */ /* Should be filtered by the back end */
bug("BIRD originated routes should not get here.");
case KRT_SRC_REDIRECT: case KRT_SRC_REDIRECT:
if (new) if (new)

View File

@ -214,7 +214,7 @@ read_config(void)
if (!unix_read_config(&conf, config_name)) if (!unix_read_config(&conf, config_name))
{ {
if (conf->err_msg) if (conf->err_msg)
die("%s, line %d: %s", conf->err_file_name, conf->err_lino, conf->err_msg); die("%s:%d:%d %s", conf->err_file_name, conf->err_lino, conf->err_chno, conf->err_msg);
else else
die("Unable to open configuration file %s: %m", config_name); die("Unable to open configuration file %s: %m", config_name);
} }
@ -231,7 +231,7 @@ async_config(void)
if (!unix_read_config(&conf, config_name)) if (!unix_read_config(&conf, config_name))
{ {
if (conf->err_msg) if (conf->err_msg)
log(L_ERR "%s, line %d: %s", conf->err_file_name, conf->err_lino, conf->err_msg); log(L_ERR "%s:%d:%d %s", conf->err_file_name, conf->err_lino, conf->err_chno, conf->err_msg);
else else
log(L_ERR "Unable to open configuration file %s: %m", config_name); log(L_ERR "Unable to open configuration file %s: %m", config_name);
config_free(conf); config_free(conf);
@ -252,7 +252,7 @@ cmd_read_config(char *name)
if (!unix_read_config(&conf, name)) if (!unix_read_config(&conf, name))
{ {
if (conf->err_msg) if (conf->err_msg)
cli_msg(8002, "%s, line %d: %s", conf->err_file_name, conf->err_lino, conf->err_msg); cli_msg(8002, "%s:%d:%d %s", conf->err_file_name, conf->err_lino, conf->err_chno, conf->err_msg);
else else
cli_msg(8002, "%s: %m", name); cli_msg(8002, "%s: %m", name);
config_free(conf); config_free(conf);