Commit fdf67f28 authored by Denis's avatar Denis
Browse files

first commit

parents
Copyright (c) 2015, Denis Fondras <>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# OpenBSD
OpenBSD misc patches
## List
* **arpkeep.diff** = Add a sysctl knob `net.inet.ip.arpkeep` to set ARP timeout value.
* **auto_update.conf** = A sample file to auto_update OpenBSD
\ No newline at end of file
Index: sys/netinet/if_ether.c
===================================================================
RCS file: /cvs/src/sys/netinet/if_ether.c,v
retrieving revision 1.160
diff -u -p -r1.160 if_ether.c
--- sys/netinet/if_ether.c 17 Aug 2015 09:58:10 -0000 1.160
+++ sys/netinet/if_ether.c 19 Aug 2015 08:46:50 -0000
@@ -87,9 +87,9 @@ struct llinfo_arp {
#define LA_HOLD_TOTAL 100
/* timer values */
-int arpt_prune = (5*60*1); /* walk list every 5 minutes */
-int arpt_keep = (20*60); /* once resolved, good for 20 more minutes */
-int arpt_down = 20; /* once declared down, don't send for 20 secs */
+int arpt_prune = (5*60*1); /* walk list every 5 minutes */
+extern int arpt_keep;
+int arpt_down = 20; /* once declared down, don't send for 20 secs */
void arptfree(struct llinfo_arp *);
void arptimer(void *);
Index: sys/netinet/in.h
===================================================================
RCS file: /cvs/src/sys/netinet/in.h,v
retrieving revision 1.114
diff -u -p -r1.114 in.h
--- sys/netinet/in.h 14 Apr 2015 12:22:15 -0000 1.114
+++ sys/netinet/in.h 19 Aug 2015 08:46:50 -0000
@@ -681,7 +681,8 @@ struct ip_mreq {
#define IPCTL_ARPQUEUED 36
#define IPCTL_MRTMFC 37
#define IPCTL_MRTVIF 38
-#define IPCTL_MAXID 39
+#define IPCTL_ARPKEEP 39
+#define IPCTL_MAXID 40
#define IPCTL_NAMES { \
{ 0, 0 }, \
@@ -723,6 +724,7 @@ struct ip_mreq {
{ "arpqueued", CTLTYPE_INT }, \
{ "mrtmfc", CTLTYPE_STRUCT }, \
{ "mrtvif", CTLTYPE_STRUCT }, \
+ { "arpkeep", CTLTYPE_INT }, \
}
#define IPCTL_VARS { \
NULL, \
@@ -764,6 +766,7 @@ struct ip_mreq {
&la_hold_total, \
NULL, \
NULL, \
+ &arpt_keep, \
}
#endif /* __BSD_VISIBLE */
Index: sys/netinet/ip_input.c
===================================================================
RCS file: /cvs/src/sys/netinet/ip_input.c,v
retrieving revision 1.252
diff -u -p -r1.252 ip_input.c
--- sys/netinet/ip_input.c 16 Jul 2015 21:14:21 -0000 1.252
+++ sys/netinet/ip_input.c 19 Aug 2015 08:46:51 -0000
@@ -105,6 +105,7 @@ int ip_defttl = IPDEFTTL;
int ip_mtudisc = 1;
u_int ip_mtudisc_timeout = IPMTUDISCTIMEOUT;
int ip_directedbcast = 0;
+int arpt_keep = (20 * 60); /* timeout is 20min by default */
struct rttimer_queue *ip_mtudisc_timeout_q = NULL;
@@ -1638,6 +1639,8 @@ ip_sysctl(int *name, u_int namelen, void
case IPCTL_MRTVIF:
return (EOPNOTSUPP);
#endif
+ case IPCTL_ARPKEEP:
+ return (sysctl_int(oldp, oldlenp, newp, newlen, &arpt_keep));
default:
if (name[0] < IPCTL_MAXID)
return (sysctl_int_arr(ipctl_vars, name, namelen,
Location of sets = http
HTTP Server = 185.1.2.12
Unable to connect using https. Use http instead = yes
Set name(s) = -g* -x*
# For octeon/ER-X :
Cannot determine prefetch area. Continue without verification = yes
Index: area.c
===================================================================
RCS file: /cvs/src/usr.sbin/ospf6d/area.c,v
retrieving revision 1.4
diff -u -p -r1.4 area.c
--- area.c 28 Dec 2008 20:08:31 -0000 1.4
+++ area.c 13 Dec 2019 22:24:09 -0000
@@ -88,19 +95,24 @@ area_find(struct ospfd_conf *conf, struc
}
void
-area_track(struct area *area, int state)
+area_track(struct area *area)
{
- int old = area->active;
+ int old = area->active;
+ struct iface *iface;
- if (state & NBR_STA_FULL)
- area->active++;
- else if (area->active == 0)
- fatalx("area_track: area already inactive");
- else
- area->active--;
+ area->active = 0;
+ LIST_FOREACH(iface, &area->iface_list, entry) {
+ if (iface->state & IF_STA_DOWN)
+ continue;
+ area->active = 1;
+ break;
+ }
- if (area->active == 0 || old == 0)
+ if (area->active != old) {
+ ospfe_imsg_compose_rde(IMSG_AREA_CHANGE, area->id.s_addr, 0,
+ &area->active, sizeof(area->active));
ospfe_demote_area(area, old == 0);
+ }
}
int
@@ -110,7 +122,7 @@ area_border_router(struct ospfd_conf *co
int active = 0;
LIST_FOREACH(area, &conf->area_list, entry)
- if (area->active > 0)
+ if (area->active)
active++;
return (active > 1);
@@ -124,5 +136,5 @@ area_ospf_options(struct area *area)
if (area && !area->stub)
opt |= OSPF_OPTION_E;
- return opt;
+ return (opt);
}
Index: database.c
===================================================================
RCS file: /cvs/src/usr.sbin/ospf6d/database.c,v
retrieving revision 1.17
diff -u -p -r1.17 database.c
--- database.c 11 Dec 2019 21:33:56 -0000 1.17
+++ database.c 14 Dec 2019 12:08:37 -0000
@@ -43,7 +43,6 @@ send_db_description(struct nbr *nbr)
struct db_dscrp_hdr dd_hdr;
struct lsa_entry *le, *nle;
struct ibuf *buf;
- int ret = 0;
u_int8_t bits = 0;
if ((buf = ibuf_open(nbr->iface->mtu - sizeof(struct ip6_hdr))) == NULL)
@@ -63,11 +62,10 @@ send_db_description(struct nbr *nbr)
case NBR_STA_INIT:
case NBR_STA_2_WAY:
case NBR_STA_SNAP:
- log_debug("send_db_description: cannot send packet in state %s,"
- " neighbor ID %s", nbr_state_name(nbr->state),
- inet_ntoa(nbr->id));
- ret = -1;
- goto done;
+ log_debug("send_db_description: neighbor ID %s: "
+ "cannot send packet in state %s", inet_ntoa(nbr->id),
+ nbr_state_name(nbr->state));
+ goto fail;
case NBR_STA_XSTRT:
bits |= OSPF_DBD_MS | OSPF_DBD_M | OSPF_DBD_I;
nbr->dd_more = 1;
@@ -134,8 +132,7 @@ send_db_description(struct nbr *nbr)
fatalx("send_db_description: unknown interface type");
}
- dd_hdr.opts = htonl(area_ospf_options(area_find(oeconf,
- nbr->iface->area_id)));
+ dd_hdr.opts = htonl(area_ospf_options(nbr->iface->area));
dd_hdr.bits = bits;
dd_hdr.dd_seq_num = htonl(nbr->dd_seq_num);
@@ -147,10 +144,11 @@ send_db_description(struct nbr *nbr)
goto fail;
/* transmit packet */
- ret = send_packet(nbr->iface, buf, &dst);
-done:
+ if (send_packet(nbr->iface, buf, &dst) == -1)
+ goto fail;
+
ibuf_free(buf);
- return (ret);
+ return (0);
fail:
log_warn("send_db_description");
ibuf_free(buf);
@@ -164,8 +162,8 @@ recv_db_description(struct nbr *nbr, cha
int dupe = 0;
if (len < sizeof(dd_hdr)) {
- log_warnx("recv_db_description: "
- "bad packet size, neighbor ID %s", inet_ntoa(nbr->id));
+ log_warnx("recv_db_description: neighbor ID %s: "
+ "bad packet size", inet_ntoa(nbr->id));
return;
}
memcpy(&dd_hdr, buf, sizeof(dd_hdr));
@@ -174,9 +172,9 @@ recv_db_description(struct nbr *nbr, cha
/* db description packet sanity checks */
if (ntohs(dd_hdr.iface_mtu) > nbr->iface->mtu) {
- log_warnx("recv_db_description: invalid MTU %d sent by "
- "neighbor ID %s, expected %d", ntohs(dd_hdr.iface_mtu),
- inet_ntoa(nbr->id), nbr->iface->mtu);
+ log_warnx("recv_db_description: neighbor ID %s: "
+ "invalid MTU %d expected %d", inet_ntoa(nbr->id),
+ ntohs(dd_hdr.iface_mtu), nbr->iface->mtu);
return;
}
@@ -184,7 +182,7 @@ recv_db_description(struct nbr *nbr, cha
nbr->last_rx_bits == dd_hdr.bits &&
ntohl(dd_hdr.dd_seq_num) == nbr->dd_seq_num - nbr->dd_master ?
1 : 0) {
- log_debug("recv_db_description: dupe from ID %s",
+ log_debug("recv_db_description: dupe from neighbor ID %s",
inet_ntoa(nbr->id));
dupe = 1;
}
@@ -194,9 +192,9 @@ recv_db_description(struct nbr *nbr, cha
case NBR_STA_ATTEMPT:
case NBR_STA_2_WAY:
case NBR_STA_SNAP:
- log_debug("recv_db_description: packet ignored in state %s, "
- "neighbor ID %s", nbr_state_name(nbr->state),
- inet_ntoa(nbr->id));
+ log_debug("recv_db_description: neighbor ID %s: "
+ "packet ignored in state %s", inet_ntoa(nbr->id),
+ nbr_state_name(nbr->state));
return;
case NBR_STA_INIT:
/* evaluate dr and bdr after issuing a 2-Way event */
@@ -225,9 +223,11 @@ recv_db_description(struct nbr *nbr, cha
} else if (!(dd_hdr.bits & (OSPF_DBD_I | OSPF_DBD_MS))) {
/* M only case: we are master */
if (ntohl(dd_hdr.dd_seq_num) != nbr->dd_seq_num) {
- log_warnx("recv_db_description: invalid "
- "seq num, mine %x his %x",
- nbr->dd_seq_num, ntohl(dd_hdr.dd_seq_num));
+ log_warnx("recv_db_description: "
+ "neighbor ID %s: "
+ "invalid seq num, mine %x his %x",
+ inet_ntoa(nbr->id), nbr->dd_seq_num,
+ ntohl(dd_hdr.dd_seq_num));
return;
}
nbr->dd_seq_num++;
@@ -243,9 +243,9 @@ recv_db_description(struct nbr *nbr, cha
}
} else {
/* ignore packet */
- log_debug("recv_db_description: packet ignored in "
- "state %s (bad flags), neighbor ID %s",
- nbr_state_name(nbr->state), inet_ntoa(nbr->id));
+ log_debug("recv_db_description: neighbor ID %s: "
+ "packet ignored in state %s (bad flags)",
+ inet_ntoa(nbr->id), nbr_state_name(nbr->state));
}
break;
case NBR_STA_XCHNG:
@@ -253,15 +253,16 @@ recv_db_description(struct nbr *nbr, cha
case NBR_STA_FULL:
if (dd_hdr.bits & OSPF_DBD_I ||
!(dd_hdr.bits & OSPF_DBD_MS) == !nbr->dd_master) {
- log_warnx("recv_db_description: seq num mismatch, "
- "bad flags");
+ log_warnx("recv_db_description: neighbor ID %s: "
+ "seq num mismatch, bad flags", inet_ntoa(nbr->id));
nbr_fsm(nbr, NBR_EVT_SEQ_NUM_MIS);
return;
}
if (nbr->last_rx_options != dd_hdr.opts) {
- log_warnx("recv_db_description: seq num mismatch, "
- "bad options");
+ log_warnx("recv_db_description: neighbor ID %s: "
+ "seq num mismatch, bad options",
+ inet_ntoa(nbr->id));
nbr_fsm(nbr, NBR_EVT_SEQ_NUM_MIS);
return;
}
@@ -274,9 +275,10 @@ recv_db_description(struct nbr *nbr, cha
}
if (nbr->state != NBR_STA_XCHNG) {
- log_warnx("recv_db_description: invalid "
- "seq num, mine %x his %x",
- nbr->dd_seq_num, ntohl(dd_hdr.dd_seq_num));
+ log_warnx("recv_db_description: neighbor ID %s: "
+ "invalid seq num, mine %x his %x",
+ inet_ntoa(nbr->id), nbr->dd_seq_num,
+ ntohl(dd_hdr.dd_seq_num));
nbr_fsm(nbr, NBR_EVT_SEQ_NUM_MIS);
return;
}
@@ -285,9 +287,11 @@ recv_db_description(struct nbr *nbr, cha
if (nbr->dd_master) {
/* master */
if (ntohl(dd_hdr.dd_seq_num) != nbr->dd_seq_num) {
- log_warnx("recv_db_description: invalid "
- "seq num, mine %x his %x",
- nbr->dd_seq_num, ntohl(dd_hdr.dd_seq_num));
+ log_warnx("recv_db_description: "
+ "neighbor ID %s: "
+ "invalid seq num, mine %x his %x, master",
+ inet_ntoa(nbr->id), nbr->dd_seq_num,
+ ntohl(dd_hdr.dd_seq_num));
nbr_fsm(nbr, NBR_EVT_SEQ_NUM_MIS);
return;
}
@@ -295,9 +299,11 @@ recv_db_description(struct nbr *nbr, cha
} else {
/* slave */
if (ntohl(dd_hdr.dd_seq_num) != nbr->dd_seq_num + 1) {
- log_warnx("recv_db_description: invalid "
- "seq num, mine %x his %x",
- nbr->dd_seq_num, ntohl(dd_hdr.dd_seq_num));
+ log_warnx("recv_db_description: "
+ "neighbor ID %s: "
+ "invalid seq num, mine %x his %x, slave",
+ inet_ntoa(nbr->id), nbr->dd_seq_num,
+ ntohl(dd_hdr.dd_seq_num));
nbr_fsm(nbr, NBR_EVT_SEQ_NUM_MIS);
return;
}
@@ -381,8 +387,8 @@ db_tx_timer(int fd, short event, void *a
send_db_description(nbr);
break;
default:
- log_debug("db_tx_timer: unknown neighbor state, "
- "neighbor ID %s", inet_ntoa(nbr->id));
+ log_debug("db_tx_timer: neighbor ID %s: unknown neighbor state",
+ inet_ntoa(nbr->id));
break;
}
Index: database.c
===================================================================
RCS file: /cvs/src/usr.sbin/ospf6d/database.c,v
retrieving revision 1.17
diff -u -p -r1.17 database.c
--- database.c 11 Dec 2019 21:33:56 -0000 1.17
+++ database.c 14 Dec 2019 21:58:38 -0000
@@ -134,8 +134,7 @@ send_db_description(struct nbr *nbr)
fatalx("send_db_description: unknown interface type");
}
- dd_hdr.opts = htonl(area_ospf_options(area_find(oeconf,
- nbr->iface->area_id)));
+ dd_hdr.opts = htonl(area_ospf_options(nbr->iface->area));
dd_hdr.bits = bits;
dd_hdr.dd_seq_num = htonl(nbr->dd_seq_num);
Index: hello.c
===================================================================
RCS file: /cvs/src/usr.sbin/ospf6d/hello.c,v
retrieving revision 1.19
diff -u -p -r1.19 hello.c
--- hello.c 11 Dec 2019 21:33:56 -0000 1.19
+++ hello.c 14 Dec 2019 21:58:38 -0000
@@ -72,7 +72,7 @@ send_hello(struct iface *iface)
/* hello header */
hello.iface_id = htonl(iface->ifindex);
LSA_24_SETHI(hello.opts, iface->priority);
- opts = area_ospf_options(area_find(oeconf, iface->area_id));
+ opts = area_ospf_options(iface->area);
LSA_24_SETLO(hello.opts, opts);
hello.opts = htonl(hello.opts);
@@ -148,7 +148,7 @@ recv_hello(struct iface *iface, struct i
return;
}
- if ((area = area_find(oeconf, iface->area_id)) == NULL)
+ if ((area = iface->area) == NULL)
fatalx("interface lost area");
opts = LSA_24_GETLO(ntohl(hello.opts));
Index: interface.c
===================================================================
RCS file: /cvs/src/usr.sbin/ospf6d/interface.c,v
retrieving revision 1.25
diff -u -p -r1.25 interface.c
--- interface.c 28 Jun 2019 13:32:49 -0000 1.25
+++ interface.c 14 Dec 2019 21:58:38 -0000
@@ -649,7 +649,7 @@ if_to_ctl(struct iface *iface)
memcpy(ictl.name, iface->name, sizeof(ictl.name));
memcpy(&ictl.addr, &iface->addr, sizeof(ictl.addr));
ictl.rtr_id.s_addr = ospfe_router_id();
- memcpy(&ictl.area, &iface->area_id, sizeof(ictl.area));
+ memcpy(&ictl.area, &iface->area->id, sizeof(ictl.area));
if (iface->dr) {
memcpy(&ictl.dr_id, &iface->dr->id, sizeof(ictl.dr_id));
memcpy(&ictl.dr_addr, &iface->dr->addr, sizeof(ictl.dr_addr));
Index: neighbor.c
===================================================================
RCS file: /cvs/src/usr.sbin/ospf6d/neighbor.c,v
retrieving revision 1.14
diff -u -p -r1.14 neighbor.c
--- neighbor.c 9 Feb 2018 03:53:37 -0000 1.14
+++ neighbor.c 14 Dec 2019 21:58:38 -0000
@@ -202,8 +202,7 @@ nbr_fsm(struct nbr *nbr, enum nbr_event
* neighbor changed from/to FULL
* originate new rtr and net LSA
*/
- area_track(area_find(oeconf, nbr->iface->area_id),
- nbr->state);
+ area_track(nbr->iface->area, nbr->state);
orig_rtr_lsa(nbr->iface);
if (nbr->iface->state & IF_STA_DR)
orig_net_lsa(nbr->iface);
@@ -319,7 +318,7 @@ nbr_new(u_int32_t nbr_id, struct iface *
if (addr)
rn.addr = *addr;
rn.id.s_addr = nbr->id.s_addr;
- rn.area_id.s_addr = nbr->iface->area_id.s_addr;
+ rn.area_id.s_addr = nbr->iface->area->id.s_addr;
rn.ifindex = nbr->iface->ifindex;
rn.iface_id = nbr->iface_id;
rn.state = nbr->state;
@@ -660,7 +659,7 @@ nbr_to_ctl(struct nbr *nbr)
memcpy(&nctl.addr, &nbr->addr, sizeof(nctl.addr));
memcpy(&nctl.dr, &nbr->dr, sizeof(nctl.dr));
memcpy(&nctl.bdr, &nbr->bdr, sizeof(nctl.bdr));
- memcpy(&nctl.area, &nbr->iface->area_id, sizeof(nctl.area));
+ memcpy(&nctl.area, &nbr->iface->area->id, sizeof(nctl.area));
/* this list is 99% of the time empty so that's OK for now */
nctl.db_sum_lst_cnt = 0;
Index: ospf6d.h
===================================================================
RCS file: /cvs/src/usr.sbin/ospf6d/ospf6d.h,v
retrieving revision 1.40
diff -u -p -r1.40 ospf6d.h
--- ospf6d.h 11 Jun 2019 05:00:09 -0000 1.40
+++ ospf6d.h 14 Dec 2019 21:58:38 -0000
@@ -304,10 +304,10 @@ struct iface {
struct in6_addr addr;
struct in6_addr dst;
struct in_addr abr_id;
- struct in_addr area_id;
struct nbr *dr; /* designated router */
struct nbr *bdr; /* backup designated router */
struct nbr *self;
+ struct area *area;
u_int64_t baudrate;
u_int32_t ls_ack_cnt;
Index: ospfe.c
===================================================================
RCS file: /cvs/src/usr.sbin/ospf6d/ospfe.c,v
retrieving revision 1.56
diff -u -p -r1.56 ospfe.c
--- ospfe.c 11 Jun 2019 05:00:09 -0000 1.56
+++ ospfe.c 14 Dec 2019 21:58:38 -0000
@@ -341,8 +341,8 @@ ospfe_dispatch_main(int fd, short event,
TAILQ_INIT(&iface->ls_ack_list);
RB_INIT(&iface->lsa_tree);
- area = area_find(oeconf, iface->area_id);
- LIST_INSERT_HEAD(&area->iface_list, iface, entry);
+ LIST_INSERT_HEAD(&iface->area->iface_list, iface,
+ entry);
break;
case IMSG_IFDELETE:
if (imsg.hdr.len != IMSG_HEADER_SIZE +
@@ -600,10 +600,10 @@ ospfe_dispatch_rde(int fd, short event,
* flood on all area interfaces on
* area 0.0.0.0 include also virtual links.
*/
- if ((area = area_find(oeconf,
- nbr->iface->area_id)) == NULL)
+ if (nbr->iface->area == NULL)
fatalx("interface lost area");
- LIST_FOREACH(iface, &area->iface_list, entry) {
+ LIST_FOREACH(iface,
+ &nbr->iface->area->iface_list, entry) {
noack += lsa_flood(iface, nbr,
&lsa_hdr, imsg.data);
}
@@ -778,7 +778,7 @@ find_vlink(struct abr_rtr *ar)
if (iface->abr_id.s_addr == ar->abr_id.s_addr &&
iface->type == IF_TYPE_VIRTUALLINK &&
//XXX iface->area->id.s_addr == ar->area.s_addr) {
- iface->area_id.s_addr == ar->area.s_addr) {
+ iface->area->id.s_addr == ar->area.s_addr) {
//XXX iface->dst.s_addr = ar->dst_ip.s_addr;
iface->dst = ar->dst_ip;
//XXX iface->addr.s_addr = ar->addr.s_addr;
@@ -808,11 +808,9 @@ orig_rtr_lsa_all(struct area *area)
void
orig_rtr_lsa(struct iface *iface)
{
- struct area *area;
-
- if ((area = area_find(oeconf, iface->area_id)) == NULL)
+ if (iface->area == NULL)
fatalx("interface lost area");
- orig_rtr_lsa_area(area);
+ orig_rtr_lsa_area(iface->area);
}
void
@@ -1155,7 +1153,7 @@ orig_link_lsa(struct iface *iface)
/* LSA link header (lladdr has already been filled in above) */
LSA_24_SETHI(lsa_link.opts, iface->priority);
- options = area_ospf_options(area_find(oeconf, iface->area_id));
+ options = area_ospf_options(iface->area);
LSA_24_SETLO(lsa_link.opts, options);
lsa_link.opts = htonl(lsa_link.opts);
lsa_link.numprefix = htonl(num_prefix);
Index: packet.c
===================================================================
RCS file: /cvs/src/usr.sbin/ospf6d/packet.c,v
retrieving revision 1.16
diff -u -p -r1.16 packet.c
--- packet.c 11 Dec 2019 21:33:56 -0000 1.16
+++ packet.c 14 Dec 2019 21:58:38 -0000
@@ -52,7 +52,7 @@ gen_ospf_hdr(struct ibuf *buf, struct if
ospf_hdr.type = type;
ospf_hdr.rtr_id = ospfe_router_id();
if (iface->type != IF_TYPE_VIRTUALLINK)
- ospf_hdr.area_id = iface->area_id.s_addr;
+ ospf_hdr.area_id = iface->area->id.s_addr;
ospf_hdr.instance = DEFAULT_INSTANCE_ID;
ospf_hdr.zero = 0; /* must be zero */
@@ -270,7 +270,7 @@ ospf_hdr_sanity_check(struct ospf_hdr *o
}
if (iface->type != IF_TYPE_VIRTUALLINK) {
- if (ospf_hdr->area_id != iface->area_id.s_addr) {
+ if (ospf_hdr->area_id != iface->area->id.s_addr) {
id.s_addr = ospf_hdr->area_id;
log_debug("recv_packet: invalid area ID %s, "
"interface %s", inet_ntoa(id), iface->name);
Index: parse.y
===================================================================
RCS file: /cvs/src/usr.sbin/ospf6d/parse.y,v
retrieving revision 1.45
diff -u -p -r1.45 parse.y
--- parse.y 11 Jun 2019 05:00:09 -0000 1.45
+++ parse.y 14 Dec 2019 21:58:38 -0000
@@ -533,7 +533,7 @@ interface : INTERFACE STRING {
YYERROR;
}
free($2);
- iface->area_id.s_addr = area->id.s_addr;
+ iface->area = area;
LIST_INSERT_HEAD(&area->iface_list, iface, entry);
memcpy(&ifacedefs, defs, sizeof(ifacedefs));
Index: rde.c
===================================================================
RCS file: /cvs/src/usr.sbin/ospf6d/rde.c,v
retrieving revision 1.80
diff -u -p -r1.80 rde.c
--- rde.c 11 Jun 2019 05:00:09 -0000 1.80
+++ rde.c 14 Dec 2019 21:58:39 -0000
@@ -740,10 +740,9 @@ rde_dispatch_parent(int fd, short event,
if (prev_link_ok == link_ok)
break;
- area = area_find(rdeconf, iface->area_id);
- if (!area)
+ if (iface->area == NULL)
fatalx("interface lost area");
- orig_intra_area_prefix_lsas(area);
+ orig_intra_area_prefix_lsas(iface->area);
break;
case IMSG_IFADD:
@@ -755,8 +754,7 @@ rde_dispatch_parent(int fd, short event,
TAILQ_INIT(&iface->ls_ack_list);
RB_INIT(&iface->lsa_tree);
- area = area_find(rdeconf, iface->area_id);
- LIST_INSERT_HEAD(&area->iface_list, iface, entry);
+ LIST_INSERT_HEAD(&iface->area->iface_list, iface, entry);
break;
case IMSG_IFDELETE:
if (imsg.hdr.len != IMSG_HEADER_SIZE +
@@ -789,9 +787,8 @@ rde_dispatch_parent(int fd, short event,
ia->prefixlen = ifc->prefixlen;
TAILQ_INSERT_TAIL(&iface->ifa_list, ia, entry);
- area = area_find(rdeconf, iface->area_id);
- if (area)
- orig_intra_area_prefix_lsas(area);
+ if (iface->area)
+ orig_intra_area_prefix_lsas(iface->area);
break;
case IMSG_IFADDRDEL:
if (imsg.hdr.len != IMSG_HEADER_SIZE +
@@ -815,9 +812,8 @@ rde_dispatch_parent(int fd, short event,
break;
}
}
- area = area_find(rdeconf, iface->area_id);
- if (area)
- orig_intra_area_prefix_lsas(area);
+ if (iface->area)
+ orig_intra_area_prefix_lsas(iface->area);
break;
case IMSG_RECONF_CONF:
if ((nconf = malloc(sizeof(struct ospfd_conf))) ==
Index: rde_lsdb.c
===================================================================