summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2019-06-07 04:57:45 +0000
committerdlg <dlg@openbsd.org>2019-06-07 04:57:45 +0000
commitcacfc04006c659f0a2b751eeca7e1282480f1a0a (patch)
treec7e8a0440c9a2131dd99d4b6366b5e0d671159cf
parentenable mcx(4) on arm64, found in Packet's g2.large.arm servers. (diff)
downloadwireguard-openbsd-cacfc04006c659f0a2b751eeca7e1282480f1a0a.tar.xz
wireguard-openbsd-cacfc04006c659f0a2b751eeca7e1282480f1a0a.zip
Allow specifying area by number as well as id. No change to outputs.
ok remi@ (who did the same change to ospfctl, ospf6d, and ospf6ctl) ok denis@ some grumbling from sthen@ and bluhm@ who didn't want output changed.
-rw-r--r--usr.sbin/ospfd/parse.y32
1 files changed, 22 insertions, 10 deletions
diff --git a/usr.sbin/ospfd/parse.y b/usr.sbin/ospfd/parse.y
index 50e6d396b9d..7d83c531017 100644
--- a/usr.sbin/ospfd/parse.y
+++ b/usr.sbin/ospfd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.97 2019/05/16 05:49:22 denis Exp $ */
+/* $OpenBSD: parse.y,v 1.98 2019/06/07 04:57:45 dlg Exp $ */
/*
* Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -119,6 +119,7 @@ typedef struct {
int64_t number;
char *string;
struct redistribute *redist;
+ struct in_addr id;
} v;
int lineno;
} YYSTYPE;
@@ -144,6 +145,7 @@ typedef struct {
%type <v.number> deadtime
%type <v.string> string dependon
%type <v.redist> redistribute
+%type <v.id> areaid
%%
@@ -587,15 +589,8 @@ comma : ','
| /*empty*/
;
-area : AREA STRING {
- struct in_addr id;
- if (inet_aton($2, &id) == 0) {
- yyerror("error parsing area");
- free($2);
- YYERROR;
- }
- free($2);
- area = conf_get_area(id);
+area : AREA areaid {
+ area = conf_get_area($2);
memcpy(&areadefs, defs, sizeof(areadefs));
md_list_copy(&areadefs.md_list, &defs->md_list);
@@ -611,6 +606,23 @@ demotecount : NUMBER { $$ = $1; }
| /*empty*/ { $$ = 1; }
;
+areaid : NUMBER {
+ if ($1 < 0 || $1 > 0xffffffff) {
+ yyerror("invalid area id");
+ YYERROR;
+ }
+ $$.s_addr = htonl($1);
+ }
+ | STRING {
+ if (inet_aton($1, &$$) == 0) {
+ yyerror("error parsing area");
+ free($1);
+ YYERROR;
+ }
+ free($1);
+ }
+ ;
+
areaopts_l : areaopts_l areaoptsl nl
| areaoptsl optnl
;