Revision c8cafc8e

View differences:

conf/cf-lex.l
589 589
    cf_lex_init_kh();
590 590

  
591 591
  ifs_head = ifs = push_ifs(NULL);
592
  if (!is_cli) 
592
  if (!is_cli)
593 593
    {
594 594
      ifs->file_name = c->file_name;
595 595
      ifs->fd = c->file_fd;
conf/conf.c
85 85
 * further use. Returns a pointer to the structure.
86 86
 */
87 87
struct config *
88
config_alloc(byte *name)
88
config_alloc(const byte *name)
89 89
{
90 90
  pool *p = rp_new(&root_pool, "Config");
91 91
  linpool *l = lp_new(p, 4080);
......
405 405
 * if it's been queued due to another reconfiguration being in progress now,
406 406
 * %CONF_UNQUEUED if a scheduled reconfiguration is removed, %CONF_NOTHING
407 407
 * if there is no relevant configuration to undo (the previous config request
408
 * was config_undo() too)  or %CONF_SHUTDOWN if BIRD is in shutdown mode and 
408
 * was config_undo() too)  or %CONF_SHUTDOWN if BIRD is in shutdown mode and
409 409
 * no new configuration changes  are accepted.
410 410
 */
411 411
int
......
530 530
 * and we want to preserve it for further use.
531 531
 */
532 532
char *
533
cfg_strdup(char *c)
533
cfg_strdup(const char *c)
534 534
{
535 535
  int l = strlen(c) + 1;
536 536
  char *z = cfg_allocu(l);
conf/conf.h
21 21
  list protos;				/* Configured protocol instances (struct proto_config) */
22 22
  list tables;				/* Configured routing tables (struct rtable_config) */
23 23
  list roa_tables;			/* Configured ROA tables (struct roa_table_config) */
24
  list logfiles;			/* Configured log fils (sysdep) */
24
  list logfiles;			/* Configured log files (sysdep) */
25 25

  
26 26
  int mrtdump_file;			/* Configured MRTDump file (sysdep, fd in unix) */
27 27
  char *syslog_name;			/* Name used for syslog (NULL -> no syslog) */
......
61 61
extern struct config *config;		/* Currently active configuration */
62 62
extern struct config *new_config;	/* Configuration being parsed */
63 63

  
64
struct config *config_alloc(byte *name);
64
struct config *config_alloc(const byte *name);
65 65
int config_parse(struct config *);
66 66
int cli_parse(struct config *);
67 67
void config_free(struct config *);
......
95 95
#define cfg_alloc(size) lp_alloc(cfg_mem, size)
96 96
#define cfg_allocu(size) lp_allocu(cfg_mem, size)
97 97
#define cfg_allocz(size) lp_allocz(cfg_mem, size)
98
char *cfg_strdup(char *c);
98
char *cfg_strdup(const char *c);
99 99
void cfg_copy_list(list *dest, list *src, unsigned node_size);
100 100

  
101 101
/* Lexer */
conf/confbase.Y
138 138
/* Switches */
139 139

  
140 140
bool:
141
   expr {$$ = !!$1; }
141
   expr { $$ = !!$1; }
142 142
 | ON { $$ = 1; }
143 143
 | YES { $$ = 1; }
144 144
 | OFF { $$ = 0; }
filter/config.Y
158 158

  
159 159
static inline struct f_inst *
160 160
f_generate_empty(struct f_inst *dyn)
161
{ 
161
{
162 162
  struct f_inst *e = f_new_inst();
163 163
  e->code = 'E';
164 164

  
......
261 261

  
262 262
  if (c1 && c2) {
263 263
    u64 ec;
264
  
264

  
265 265
    if (kind == EC_GENERIC) {
266 266
      ec = ec_generic(key, val2);
267 267
    }
......
280 280
    NEW_F_VAL;
281 281
    rv = f_new_inst();
282 282
    rv->code = 'C';
283
    rv->a1.p = val;    
283
    rv->a1.p = val;
284 284
    val->type = T_EC;
285 285
    val->val.ec = ec;
286 286
  }
......
355 355
%type <e> pair_item ec_item lc_item set_item switch_item set_items switch_items switch_body
356 356
%type <trie> fprefix_set
357 357
%type <v> set_atom switch_atom fprefix fprefix_s fipa
358
%type <s> decls declsn one_decl function_params 
358
%type <s> decls declsn one_decl function_params
359 359
%type <h> bgp_path bgp_path_tail1 bgp_path_tail2
360 360

  
361 361
CF_GRAMMAR
......
391 391
 | CLIST { $$ = T_CLIST; }
392 392
 | ECLIST { $$ = T_ECLIST; }
393 393
 | LCLIST { $$ = T_LCLIST; }
394
 | type SET { 
394
 | type SET {
395 395
	switch ($1) {
396 396
	  case T_INT:
397 397
	  case T_PAIR:
......
506 506
   } function_params function_body {
507 507
     $2->def = $5;
508 508
     $2->aux2 = $4;
509
     DBG("Hmm, we've got one function here - %s\n", $2->name); 
509
     DBG("Hmm, we've got one function here - %s\n", $2->name);
510 510
     cf_pop_scope();
511 511
   }
512 512
 ;
......
652 652
   fprefix_s { $$ = $1; }
653 653
 | fprefix_s '+' { $$ = $1; $$.val.px.len |= LEN_PLUS; }
654 654
 | fprefix_s '-' { $$ = $1; $$.val.px.len |= LEN_MINUS; }
655
 | fprefix_s '{' NUM ',' NUM '}' { 
655
 | fprefix_s '{' NUM ',' NUM '}' {
656 656
     if (! ((0 <= $3) && ($3 <= $5) && ($5 <= MAX_PREFIX_LENGTH))) cf_error("Invalid prefix pattern range: {%d, %d}.", $3, $5);
657 657
     $$ = $1; $$.val.px.len |= LEN_RANGE | ($3 << 16) | ($5 << 8);
658 658
   }
......
671 671
       t->data = $4;
672 672
     $$ = f_merge_items($1, $2);
673 673
   }
674
 | switch_body ELSECOL cmds { 
674
 | switch_body ELSECOL cmds {
675 675
     struct f_tree *t = f_new_tree();
676 676
     t->from.type = t->to.type = T_VOID;
677 677
     t->right = t;
......
683 683
/* CONST '(' expr ')' { $$ = f_new_inst(); $$->code = 'c'; $$->aux = T_INT; $$->a2.i = $3; } */
684 684

  
685 685
bgp_path_expr:
686
   symbol       { $$ = $1; }   
686
   symbol       { $$ = $1; }
687 687
 | '(' term ')' { $$ = $2; }
688 688
 ;
689 689

  
......
836 836
 | '-' EMPTY '-' { $$ = f_new_inst(); $$->code = 'E'; $$->aux = T_CLIST; }
837 837
 | '-' '-' EMPTY '-' '-' { $$ = f_new_inst(); $$->code = 'E'; $$->aux = T_ECLIST; }
838 838
 | '-' '-' '-' EMPTY '-' '-' '-' { $$ = f_new_inst(); $$->code = 'E'; $$->aux = T_LCLIST; }
839
 | PREPEND '(' term ',' term ')' { $$ = f_new_inst(); $$->code = P('A','p'); $$->a1.p = $3; $$->a2.p = $5; } 
840
 | ADD '(' term ',' term ')' { $$ = f_new_inst(); $$->code = P('C','a'); $$->a1.p = $3; $$->a2.p = $5; $$->aux = 'a'; } 
839
 | PREPEND '(' term ',' term ')' { $$ = f_new_inst(); $$->code = P('A','p'); $$->a1.p = $3; $$->a2.p = $5; }
840
 | ADD '(' term ',' term ')' { $$ = f_new_inst(); $$->code = P('C','a'); $$->a1.p = $3; $$->a2.p = $5; $$->aux = 'a'; }
841 841
 | DELETE '(' term ',' term ')' { $$ = f_new_inst(); $$->code = P('C','a'); $$->a1.p = $3; $$->a2.p = $5; $$->aux = 'd'; }
842 842
 | FILTER '(' term ',' term ')' { $$ = f_new_inst(); $$->code = P('C','a'); $$->a1.p = $3; $$->a2.p = $5; $$->aux = 'f'; }
843 843

  
......
892 892
   }
893 893
 ;
894 894

  
895
var_listn: term { 
895
var_listn: term {
896 896
     $$ = f_new_inst();
897 897
     $$->code = 's';
898 898
     $$->a1.p = NULL;
......
960 960
     $$ = f_new_inst();
961 961
     $$->code = P('P','S');
962 962
     $$->a1.p = $3;
963
   } 
963
   }
964 964
 | UNSET '(' rtadot dynamic_attr ')' ';' {
965 965
     $$ = $4;
966 966
     $$->aux = EAF_TYPE_UNDEF | EAF_TEMP;
filter/filter.h
35 35
/* Not enough fields in f_inst for three args used by roa_check() */
36 36
struct f_inst_roa_check {
37 37
  struct f_inst i;
38
  struct roa_table_config *rtc;	
38
  struct roa_table_config *rtc;
39 39
};
40 40

  
41 41
struct f_inst3 {
......
65 65
    uint i;
66 66
    u64 ec;
67 67
    lcomm lc;
68
    /*    ip_addr ip; Folded into prefix */	
68
    /*    ip_addr ip; Folded into prefix */
69 69
    struct f_prefix px;
70 70
    char *s;
71 71
    struct f_tree *t;
......
190 190
#define T_PREFIX_SET 0x81
191 191

  
192 192

  
193
#define SA_FROM		 1    
194
#define SA_GW		 2      
195
#define SA_NET		 3     
196
#define SA_PROTO	 4   
197
#define SA_SOURCE	 5  
198
#define SA_SCOPE	 6   
199
#define SA_CAST    	 7
200
#define SA_DEST    	 8
201
#define SA_IFNAME  	 9
202
#define SA_IFINDEX    	10
193
#define SA_FROM		 1
194
#define SA_GW		 2
195
#define SA_NET		 3
196
#define SA_PROTO	 4
197
#define SA_SOURCE	 5
198
#define SA_SCOPE	 6
199
#define SA_CAST		 7
200
#define SA_DEST		 8
201
#define SA_IFNAME	 9
202
#define SA_IFINDEX	10
203 203

  
204 204

  
205 205
struct f_tree {
filter/tree.c
63 63
 * build_tree
64 64
 * @from: degenerated tree (linked by @tree->left) to be transformed into form suitable for find_tree()
65 65
 *
66
 * Transforms denerated tree into balanced tree.
66
 * Transforms degenerated tree into balanced tree.
67 67
 */
68 68
struct f_tree *
69 69
build_tree(struct f_tree *from)
......
162 162
tree_format(struct f_tree *t, buffer *buf)
163 163
{
164 164
  buffer_puts(buf, "[");
165
 
165

  
166 166
  tree_node_format(t, buf);
167 167

  
168 168
  if (buf->pos == buf->end)
......
171 171
  /* Undo last separator */
172 172
  if (buf->pos[-1] != '[')
173 173
    buf->pos -= 2;
174
 
174

  
175 175
  buffer_puts(buf, "]");
176 176
}
lib/buffer.h
1
/*
2
 *	BIRD Library -- Generic Buffer Structure
3
 *
4
 *	(c) 2013 Ondrej Zajicek <santiago@crfreenet.org>
5
 *	(c) 2013 CZ.NIC z.s.p.o.
6
 *
7
 *	Can be freely distributed and used under the terms of the GNU GPL.
8
 */
9

  
10
#ifndef _BIRD_BUFFER_H_
11
#define _BIRD_BUFFER_H_
12

  
13
#include "lib/resource.h"
14
#include "sysdep/config.h"
1 15

  
2 16
#define BUFFER(type)		struct { type *data; uint used, size; }
3 17

  
......
32 46

  
33 47
#define BUFFER_FLUSH(v)		({ (v).used = 0; })
34 48

  
35

  
49
#endif /* _BIRD_BUFFER_H_ */
lib/hash.h
1

  
1
/*
2
 *	BIRD Library -- Generic Hash Table
3
 *
4
 *	(c) 2013 Ondrej Zajicek <santiago@crfreenet.org>
5
 *	(c) 2013 CZ.NIC z.s.p.o.
6
 *
7
 *	Can be freely distributed and used under the terms of the GNU GPL.
8
 */
9

  
10
#ifndef _BIRD_HASH_H_
11
#define _BIRD_HASH_H_
2 12

  
3 13
#define HASH(type)		struct { type **data; uint count, order; }
4 14
#define HASH_TYPE(v)		typeof(** (v).data)
......
178 188

  
179 189
#define HASH_WALK_FILTER_END } while (0)
180 190

  
191
#endif
proto/ospf/rt.c
678 678
     which may be later used as the next hop. */
679 679

  
680 680
  /* In OSPFv2, en->lb is set here. In OSPFv3, en->lb is just cleared here,
681
     it is set in process_prefixes() to any global addres in the area */
681
     it is set in process_prefixes() to any global address in the area */
682 682

  
683 683
  en->lb = IPA_NONE;
684 684
  en->lb_id = 0;
......
930 930
  }
931 931
}
932 932

  
933
/* Decide about originating or flushing summary LSAs for condended area networks */
933
/* Decide about originating or flushing summary LSAs for condensed area networks */
934 934
static int
935 935
decide_anet_lsa(struct ospf_area *oa, struct area_net *anet, struct ospf_area *anet_oa)
936 936
{
sysdep/linux/syspriv.h
1
#ifndef _BIRD_SYSPRIV_H_
2
#define _BIRD_SYSPRIV_H_
1 3

  
4
#ifndef _GNU_SOURCE
5
#define _GNU_SOURCE
6
#endif
7

  
8
#include <unistd.h>
2 9
#include <sys/prctl.h>
3 10
#include <linux/capability.h>
4 11

  
......
70 77
  if (setresuid(uid, uid, uid) < 0)
71 78
    die("setresuid: %m");
72 79
}
80

  
81
#endif /* _BIRD_SYSPRIV_H_ */
sysdep/unix/io.c
9 9

  
10 10
/* Unfortunately, some glibc versions hide parts of RFC 3542 API
11 11
   if _GNU_SOURCE is not defined. */
12
#define _GNU_SOURCE 1
12
#ifndef _GNU_SOURCE
13
#define _GNU_SOURCE
14
#endif
13 15

  
14 16
#include <stdio.h>
15 17
#include <stdlib.h>
......
2046 2048

  
2047 2049
volatile int async_config_flag;		/* Asynchronous reconfiguration/dump scheduled */
2048 2050
volatile int async_dump_flag;
2051
volatile int async_shutdown_flag;
2049 2052

  
2050 2053
void
2051 2054
io_init(void)
sysdep/unix/main.c
8 8

  
9 9
#undef LOCAL_DEBUG
10 10

  
11
#define _GNU_SOURCE 1
11
#ifndef _GNU_SOURCE
12
#define _GNU_SOURCE
13
#endif
12 14

  
13 15
#include <stdio.h>
14 16
#include <stdlib.h>

Also available in: Unified diff