diff options
author | Wesley Shields <wxs@FreeBSD.org> | 2009-05-10 15:41:01 +0000 |
---|---|---|
committer | Wesley Shields <wxs@FreeBSD.org> | 2009-05-10 15:41:01 +0000 |
commit | fbe3f10167874da738e4a5ee2374d0bd6e9c6d34 (patch) | |
tree | d48962b48d63c76c3c7ebc5e42191391d9efe7f5 /net | |
parent | - Fix build when using DHCP_JAIL. (diff) |
- Update to 4.3.
- Remove unnecessary hash.h stuff.
- Pass maintainer to submitter.
PR: ports/129881
Submitted by: Eygene Ryabinkin <rea-fbsd@codelabs.ru>
Notes
Notes:
svn path=/head/; revision=233582
Diffstat (limited to 'net')
-rw-r--r-- | net/openospfd/Makefile | 14 | ||||
-rw-r--r-- | net/openospfd/distinfo | 9 | ||||
-rw-r--r-- | net/openospfd/files/patch-RTF_LLINFO-ARP-v2-fix | 26 | ||||
-rw-r--r-- | net/openospfd/files/patch-fix-libevent-READ-WRITE | 271 | ||||
-rw-r--r-- | net/openospfd/files/patch-ospfd_kroute.c | 45 | ||||
-rw-r--r-- | net/openospfd/files/patch-ospfd_parse.y | 16 | ||||
-rw-r--r-- | net/openospfd/files/patch-ospfd_rde_spf.c | 133 |
7 files changed, 343 insertions, 171 deletions
diff --git a/net/openospfd/Makefile b/net/openospfd/Makefile index 873a611b5e58..c165c5e6e5f7 100644 --- a/net/openospfd/Makefile +++ b/net/openospfd/Makefile @@ -6,17 +6,17 @@ # PORTNAME= openospfd -PORTVERSION= 4.2 +PORTVERSION= 4.3 CATEGORIES= net -MASTER_SITES= ftp://ftp.dkuug.dk/pub/OpenBSD/OpenBGPD/:openbsd \ +MASTER_SITES= ${MASTER_SITE_OPENBSD:S/$/:openbsd/g} \ ${MASTER_SITE_LOCAL:S/$/:freebsd/g} -MASTER_SITE_SUBDIR= flz/openospfd/:freebsd +MASTER_SITE_SUBDIR= flz/openospfd/:freebsd OpenBGPD/:openbsd DISTFILES= ${PORTNAME}-${PORTVERSION}.tgz:openbsd \ - if_media.h:freebsd hash.h:freebsd + if_media.h:freebsd DIST_SUBDIR= ${PORTNAME} EXTRACT_ONLY= ${PORTNAME}-${PORTVERSION}.tgz -MAINTAINER= ports@FreeBSD.org +MAINTAINER= rea-fbsd@codelabs.ru COMMENT= Free implementation of the Open Shortest Path First Protocol LIB_DEPENDS= event-1.4:${PORTSDIR}/devel/libevent @@ -43,10 +43,8 @@ SUBDIRS= ospfd \ post-extract: @${CP} ${DISTDIR}/${DIST_SUBDIR}/if_media.h ${WRKSRC}/ospfctl/ - @${CP} ${DISTDIR}/${DIST_SUBDIR}/hash.h ${WRKSRC}/ospfd/ post-patch: - @${REINPLACE_CMD} -e "s|sys/hash.h|hash.h|" ${WRKSRC}/ospfd/lsupdate.c @${REINPLACE_CMD} -e "s|<net/if_media.h>|\"if_media.h\"|" ${WRKSRC}/ospfctl/ospfctl.c @${REINPLACE_CMD} -e "/rc.conf.local/d" ${WRKSRC}/ospfd/ospfd.conf.5 @${REINPLACE_CMD} -e "s|SIMPLEQ|STAILQ|" ${WRKSRC}/ospfd/*.[chy] @@ -54,7 +52,7 @@ post-patch: ${WRKSRC}/ospfd/ospfd.h \ ${WRKSRC}/ospfd/ospfd.8 \ ${WRKSRC}/ospfd/ospfd.conf.5 - @${REINPLACE_CMD} -e "s|__dead||" \ + @${REINPLACE_CMD} -e "s|__dead|__dead2|" \ ${WRKSRC}/ospfd/log.h \ ${WRKSRC}/ospfd/ospfd.c \ ${WRKSRC}/ospfctl/ospfctl.c diff --git a/net/openospfd/distinfo b/net/openospfd/distinfo index 870d6441b170..b23e8cbe6e66 100644 --- a/net/openospfd/distinfo +++ b/net/openospfd/distinfo @@ -1,9 +1,6 @@ -MD5 (openospfd/openospfd-4.2.tgz) = ac919e4883105b28a846106e7c60bb80 -SHA256 (openospfd/openospfd-4.2.tgz) = 896a9e29447d7da46a1c7c1717e1527b3770425840e8f0180419ec313d3d7b00 -SIZE (openospfd/openospfd-4.2.tgz) = 93661 +MD5 (openospfd/openospfd-4.3.tgz) = dffeb5cf21cbd4f15534e658682cb6ee +SHA256 (openospfd/openospfd-4.3.tgz) = 8fd4ffb393cc06f5936e9eb444b54f72d3fb7ec27285d0d746de5e8050959a66 +SIZE (openospfd/openospfd-4.3.tgz) = 97515 MD5 (openospfd/if_media.h) = 4ff9297f5c133425dafe3ca565c0f811 SHA256 (openospfd/if_media.h) = 58225d0ed363c2beb23426f0f8254089d4541c3334776f3750ba434d4491a1d1 SIZE (openospfd/if_media.h) = 23762 -MD5 (openospfd/hash.h) = 0c397692b9b152f1bca968b6248bc09c -SHA256 (openospfd/hash.h) = 0c5561c6765325f49d82d5c5fd9471dbfadf21f44e554758eb112a23f7c317b1 -SIZE (openospfd/hash.h) = 3488 diff --git a/net/openospfd/files/patch-RTF_LLINFO-ARP-v2-fix b/net/openospfd/files/patch-RTF_LLINFO-ARP-v2-fix new file mode 100644 index 000000000000..1bc2a955fecb --- /dev/null +++ b/net/openospfd/files/patch-RTF_LLINFO-ARP-v2-fix @@ -0,0 +1,26 @@ +diff --git a/ospfd/kroute.c b/ospfd/kroute.c +index b46fa30..acc2a32 100644 +--- ospfd/kroute.c ++++ ospfd/kroute.c +@@ -1174,8 +1174,10 @@ fetchtable(void) + if ((sa = rti_info[RTAX_DST]) == NULL) + continue; + ++#if defined(RTF_LLINFO) /* FreeBSD dropped RTF_LLINFO after ARP-v2 rework */ + if (rtm->rtm_flags & RTF_LLINFO) /* arp cache */ + continue; ++#endif /* defined(RTF_LLINFO) */ + + if ((kr = calloc(1, sizeof(struct kroute_node))) == NULL) { + log_warn("fetchtable"); +@@ -1371,8 +1373,10 @@ dispatch_rtmsg(void) + if (rtm->rtm_errno) /* failed attempts... */ + continue; + ++#if defined(RTF_LLINFO) /* FreeBSD dropped RTF_LLINFO after ARP-v2 rework */ + if (rtm->rtm_flags & RTF_LLINFO) /* arp cache */ + continue; ++#endif /* defined(RTF_LLINFO) */ + + #ifdef RTF_MPATH + if (rtm->rtm_flags & RTF_MPATH) diff --git a/net/openospfd/files/patch-fix-libevent-READ-WRITE b/net/openospfd/files/patch-fix-libevent-READ-WRITE new file mode 100644 index 000000000000..f08a720a4bd8 --- /dev/null +++ b/net/openospfd/files/patch-fix-libevent-READ-WRITE @@ -0,0 +1,271 @@ +diff --git a/ospfd/libevent_helpers.h b/ospfd/libevent_helpers.h +new file mode 100644 +index 0000000..46f743d +--- /dev/null ++++ ospfd/libevent_helpers.h +@@ -0,0 +1,81 @@ ++/* ++ * Copyright (c) 2008 Eygene Ryabinkin <rea-fbsd@codelabs.ru> ++ * ++ * Permission to use, copy, modify, and 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. ++ */ ++ ++#ifndef _LIBEVENT_HELPERS_H_ ++#define _LIBEVENT_HELPERS_H_ ++ ++#include <stdio.h> ++#include <sys/types.h> ++ ++#include "log.h" ++#include "ospfd.h" ++ ++/* Inline functions */ ++ ++/* ++ * A support function that processes libevent notification in the ++ * following way: ++ * - if we are ready to write, we will try to flush the queue; ++ * - if we are ready to read, we will read the input buffer and ++ * prepare variables 'n' and 'shut' accordingly. ++ * ++ * Such handling occurs at least 6 times within the OSPFD sources, ++ * so this inline function is just an alternative to the preprocessor ++ * macros. ++ * ++ * Function returns 0 if everything was handled and no further ++ * processing is needed; it returns EV_READ if the read processing ++ * was prepared to take place. ++ */ ++static inline short ++dispatch_read_write_event(short _event, struct imsgbuf *_ibuf, ++ ssize_t *_n, int *_shut) __attribute__((always_inline)); ++ ++static inline short ++dispatch_read_write_event(short event, struct imsgbuf *ibuf, ++ ssize_t *n, int *shut) ++{ ++ static char errbuf[128]; ++ ++ /* ++ * We can have both EV_READ and EV_WRITE, since we can be ++ * subscribed to both event types. Handle write readiness ++ * first (flush the queue) and then handle reads. ++ */ ++ if ((event & ~(EV_WRITE|EV_READ))) { ++ snprintf(errbuf, sizeof(errbuf), ++ "unknown event 0x%hx", (unsigned short)event); ++ fatalx(errbuf); ++ } ++ ++ if ((event & EV_WRITE)) { ++ if (msgbuf_write(&ibuf->w) == -1) ++ fatal("msgbuf_write"); ++ imsg_event_add(ibuf); ++ } ++ if ((event & EV_READ)) { ++ if ((*n = imsg_read(ibuf)) == -1) ++ fatal("imsg_read error"); ++ if (*n == 0) /* connection closed */ ++ *shut = 1; ++ return EV_READ; ++ } else { ++ return 0; ++ } ++ /* NOTREACHED */ ++} ++ ++#endif /* _LIBEVENT_HELPERS_H_ */ +diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c +index be69cab..4e62d09 100644 +--- ospfd/ospfd.c ++++ ospfd/ospfd.c +@@ -46,6 +46,7 @@ + #include "control.h" + #include "log.h" + #include "rde.h" ++#include "libevent_helpers.h" + + void main_sig_handler(int, short, void *); + __dead void usage(void); +@@ -355,21 +356,8 @@ main_dispatch_ospfe(int fd, short event, void *bula) + ssize_t n; + int shut = 0; + +- switch (event) { +- case EV_READ: +- if ((n = imsg_read(ibuf)) == -1) +- fatal("imsg_read error"); +- if (n == 0) /* connection closed */ +- shut = 1; +- break; +- case EV_WRITE: +- if (msgbuf_write(&ibuf->w) == -1) +- fatal("msgbuf_write"); +- imsg_event_add(ibuf); ++ if (dispatch_read_write_event(event, ibuf, &n, &shut) != EV_READ) + return; +- default: +- fatalx("unknown event"); +- } + + for (;;) { + if ((n = imsg_get(ibuf, &imsg)) == -1) +@@ -434,21 +422,8 @@ main_dispatch_rde(int fd, short event, void *bula) + ssize_t n; + int count, shut = 0; + +- switch (event) { +- case EV_READ: +- if ((n = imsg_read(ibuf)) == -1) +- fatal("imsg_read error"); +- if (n == 0) /* connection closed */ +- shut = 1; +- break; +- case EV_WRITE: +- if (msgbuf_write(&ibuf->w) == -1) +- fatal("msgbuf_write"); +- imsg_event_add(ibuf); ++ if (dispatch_read_write_event(event, ibuf, &n, &shut) != EV_READ) + return; +- default: +- fatalx("unknown event"); +- } + + for (;;) { + if ((n = imsg_get(ibuf, &imsg)) == -1) +diff --git a/ospfd/ospfe.c b/ospfd/ospfe.c +index af7a406..d6a6aa9 100644 +--- ospfd/ospfe.c ++++ ospfd/ospfe.c +@@ -42,6 +42,7 @@ + #include "rde.h" + #include "control.h" + #include "log.h" ++#include "libevent_helpers.h" + + void ospfe_sig_handler(int, short, void *); + void ospfe_shutdown(void); +@@ -257,23 +258,11 @@ ospfe_dispatch_main(int fd, short event, void *bula) + struct iface *iface = NULL; + struct kif *kif; + struct auth_md md; +- int n, link_ok, stub_changed, shut = 0; +- +- switch (event) { +- case EV_READ: +- if ((n = imsg_read(ibuf)) == -1) +- fatal("imsg_read error"); +- if (n == 0) /* connection closed */ +- shut = 1; +- break; +- case EV_WRITE: +- if (msgbuf_write(&ibuf->w) == -1) +- fatal("msgbuf_write"); +- imsg_event_add(ibuf); ++ int link_ok, stub_changed, shut = 0; ++ ssize_t n; ++ ++ if (dispatch_read_write_event(event, ibuf, &n, &shut) != EV_READ) + return; +- default: +- fatalx("unknown event"); +- } + + for (;;) { + if ((n = imsg_get(ibuf, &imsg)) == -1) +@@ -401,24 +390,12 @@ ospfe_dispatch_rde(int fd, short event, void *bula) + struct lsa_entry *le; + struct imsg imsg; + struct abr_rtr ar; +- int n, noack = 0, shut = 0; ++ int noack = 0, shut = 0; + u_int16_t l, age; ++ ssize_t n; + +- switch (event) { +- case EV_READ: +- if ((n = imsg_read(ibuf)) == -1) +- fatal("imsg_read error"); +- if (n == 0) /* connection closed */ +- shut = 1; +- break; +- case EV_WRITE: +- if (msgbuf_write(&ibuf->w) == -1) +- fatal("msgbuf_write"); +- imsg_event_add(ibuf); ++ if (dispatch_read_write_event(event, ibuf, &n, &shut) != EV_READ) + return; +- default: +- fatalx("unknown event"); +- } + + for (;;) { + if ((n = imsg_get(ibuf, &imsg)) == -1) +diff --git a/ospfd/rde.c b/ospfd/rde.c +index 5dd0623..faa0c23 100644 +--- ospfd/rde.c ++++ ospfd/rde.c +@@ -37,6 +37,7 @@ + #include "ospfe.h" + #include "log.h" + #include "rde.h" ++#include "libevent_helpers.h" + + void rde_sig_handler(int sig, short, void *); + void rde_shutdown(void); +@@ -239,21 +240,8 @@ rde_dispatch_imsg(int fd, short event, void *bula) + int r, state, self, shut = 0; + u_int16_t l; + +- switch (event) { +- case EV_READ: +- if ((n = imsg_read(ibuf)) == -1) +- fatal("imsg_read error"); +- if (n == 0) /* connection closed */ +- shut = 1; +- break; +- case EV_WRITE: +- if (msgbuf_write(&ibuf->w) == -1) +- fatal("msgbuf_write"); +- imsg_event_add(ibuf); ++ if (dispatch_read_write_event(event, ibuf, &n, &shut) != EV_READ) + return; +- default: +- fatalx("unknown event"); +- } + + clock_gettime(CLOCK_MONOTONIC, &tp); + now = tp.tv_sec; +@@ -584,21 +572,8 @@ rde_dispatch_parent(int fd, short event, void *bula) + ssize_t n; + int shut = 0; + +- switch (event) { +- case EV_READ: +- if ((n = imsg_read(ibuf)) == -1) +- fatal("imsg_read error"); +- if (n == 0) /* connection closed */ +- shut = 1; +- break; +- case EV_WRITE: +- if (msgbuf_write(&ibuf->w) == -1) +- fatal("msgbuf_write"); +- imsg_event_add(ibuf); ++ if (dispatch_read_write_event(event, ibuf, &n, &shut) != EV_READ) + return; +- default: +- fatalx("unknown event"); +- } + + for (;;) { + if ((n = imsg_get(ibuf, &imsg)) == -1) diff --git a/net/openospfd/files/patch-ospfd_kroute.c b/net/openospfd/files/patch-ospfd_kroute.c index 2b1bd77f96eb..3cea2b6b9661 100644 --- a/net/openospfd/files/patch-ospfd_kroute.c +++ b/net/openospfd/files/patch-ospfd_kroute.c @@ -1,6 +1,6 @@ ---- ospfd/kroute.c.orig 2008-02-07 18:58:38.000000000 +0300 -+++ ospfd/kroute.c 2008-02-07 19:09:58.000000000 +0300 -@@ -955,9 +955,11 @@ +--- ospfd/kroute.c.orig 2009-04-29 15:07:32.000000000 -0400 ++++ ospfd/kroute.c 2009-04-29 15:07:57.000000000 -0400 +@@ -1024,9 +1024,11 @@ struct sockaddr_in prefix; struct sockaddr_in nexthop; struct sockaddr_in mask; @@ -13,7 +13,20 @@ if (kr_state.fib_sync == 0) return (0); -@@ -1011,6 +1013,7 @@ +@@ -1035,7 +1037,12 @@ + bzero(&hdr, sizeof(hdr)); + hdr.rtm_version = RTM_VERSION; + hdr.rtm_type = action; ++#if !defined(__FreeBSD__) + hdr.rtm_flags = RTF_PROTO2|RTF_MPATH; ++#else ++ /* No multipath routing in FreeBSD yet */ ++ hdr.rtm_flags = RTF_PROTO2; ++#endif /* !defined(__FreeBSD__) */ + if (action == RTM_CHANGE) /* force PROTO2 reset the other flags */ + hdr.rtm_fmask = RTF_PROTO2|RTF_PROTO1|RTF_REJECT|RTF_BLACKHOLE; + hdr.rtm_seq = kr_state.rtseq++; /* overflow doesn't matter */ +@@ -1080,6 +1087,7 @@ iov[iovcnt].iov_base = &mask; iov[iovcnt++].iov_len = sizeof(mask); @@ -21,7 +34,7 @@ if (kroute->rtlabel != 0) { sa_rl.sr_len = sizeof(sa_rl); sa_rl.sr_family = AF_UNSPEC; -@@ -1027,6 +1030,7 @@ +@@ -1096,6 +1104,7 @@ iov[iovcnt].iov_base = &sa_rl; iov[iovcnt++].iov_len = sizeof(sa_rl); } @@ -29,7 +42,7 @@ retry: -@@ -1069,7 +1073,9 @@ +@@ -1138,7 +1147,9 @@ struct rt_msghdr *rtm; struct sockaddr *sa, *rti_info[RTAX_MAX]; struct sockaddr_in *sa_in; @@ -39,7 +52,7 @@ struct kroute_node *kr; mib[0] = CTL_NET; -@@ -1078,9 +1084,13 @@ +@@ -1147,9 +1158,13 @@ mib[3] = AF_INET; mib[4] = NET_RT_DUMP; mib[5] = 0; @@ -53,7 +66,7 @@ log_warn("sysctl"); return (-1); } -@@ -1098,7 +1098,11 @@ +@@ -1157,7 +1172,11 @@ log_warn("fetchtable"); return (-1); } @@ -65,7 +78,7 @@ log_warn("sysctl"); free(buf); return (-1); -@@ -1157,6 +1163,7 @@ +@@ -1230,6 +1249,7 @@ send_rtmsg(kr_state.fd, RTM_DELETE, &kr->r); free(kr); } else { @@ -73,7 +86,7 @@ if ((label = (struct sockaddr_rtlabel *) rti_info[RTAX_LABEL]) != NULL) { kr->r.rtlabel = -@@ -1164,6 +1171,7 @@ +@@ -1237,6 +1257,7 @@ kr->r.ext_tag = rtlabel_id2tag(kr->r.rtlabel); } @@ -81,7 +94,7 @@ kroute_insert(kr); } -@@ -1257,7 +1265,9 @@ +@@ -1330,7 +1351,9 @@ struct ifa_msghdr *ifam; struct sockaddr *sa, *rti_info[RTAX_MAX]; struct sockaddr_in *sa_in; @@ -91,7 +104,7 @@ struct kroute_node *kr, *okr; struct in_addr prefix, nexthop; u_int8_t prefixlen; -@@ -1289,8 +1299,10 @@ +@@ -1364,8 +1387,10 @@ sa = (struct sockaddr *)(rtm + 1); get_rtaddrs(rtm->rtm_addrs, sa, rti_info); @@ -102,7 +115,7 @@ if (rtm->rtm_pid == kr_state.pid) /* caused by us */ continue; -@@ -1385,6 +1397,7 @@ +@@ -1462,6 +1487,7 @@ rtlabel_unref(kr->r.rtlabel); kr->r.rtlabel = 0; kr->r.ext_tag = 0; @@ -110,7 +123,7 @@ if ((label = (struct sockaddr_rtlabel *) rti_info[RTAX_LABEL]) != NULL) { kr->r.rtlabel = -@@ -1392,6 +1405,7 @@ +@@ -1469,6 +1495,7 @@ kr->r.ext_tag = rtlabel_id2tag(kr->r.rtlabel); } @@ -118,7 +131,7 @@ if (kif_validate(kr->r.ifindex)) kr->r.flags &= ~F_DOWN; -@@ -1413,6 +1427,7 @@ +@@ -1490,6 +1517,7 @@ kr->r.flags = flags; kr->r.ifindex = ifindex; @@ -126,7 +139,7 @@ if ((label = (struct sockaddr_rtlabel *) rti_info[RTAX_LABEL]) != NULL) { kr->r.rtlabel = -@@ -1420,6 +1435,7 @@ +@@ -1497,6 +1525,7 @@ kr->r.ext_tag = rtlabel_id2tag(kr->r.rtlabel); } diff --git a/net/openospfd/files/patch-ospfd_parse.y b/net/openospfd/files/patch-ospfd_parse.y index 7023a9d35ded..6c40c3e64460 100644 --- a/net/openospfd/files/patch-ospfd_parse.y +++ b/net/openospfd/files/patch-ospfd_parse.y @@ -1,6 +1,6 @@ ---- ospfd/parse.y.orig 2008-02-07 18:34:22.000000000 +0300 -+++ ospfd/parse.y 2008-02-07 18:37:46.000000000 +0300 -@@ -485,6 +485,11 @@ +--- ospfd/parse.y.orig 2008-02-26 13:09:58.000000000 +0300 ++++ ospfd/parse.y 2008-12-19 17:52:39.000000000 +0300 +@@ -503,6 +503,11 @@ areaoptsl : interface | DEMOTE STRING demotecount { @@ -9,10 +9,10 @@ + free($2); + YYERROR; +#else - if ($3 > 255) { - yyerror("demote count too big: max 255"); + if ($3 < 1 || $3 > 255) { + yyerror("demote count out of range (1-255)"); free($2); -@@ -505,6 +510,7 @@ +@@ -523,6 +528,7 @@ area->demote_group); YYERROR; } @@ -20,7 +20,7 @@ } | defaults ; -@@ -581,6 +587,11 @@ +@@ -599,6 +605,11 @@ interfaceoptsl : PASSIVE { iface->passive = 1; } | DEMOTE STRING { @@ -32,7 +32,7 @@ if (strlcpy(iface->demote_group, $2, sizeof(iface->demote_group)) >= sizeof(iface->demote_group)) { -@@ -595,6 +606,7 @@ +@@ -613,6 +624,7 @@ iface->demote_group); YYERROR; } diff --git a/net/openospfd/files/patch-ospfd_rde_spf.c b/net/openospfd/files/patch-ospfd_rde_spf.c deleted file mode 100644 index e0391f3fb88b..000000000000 --- a/net/openospfd/files/patch-ospfd_rde_spf.c +++ /dev/null @@ -1,133 +0,0 @@ ---- ospfd/rde_spf.c 2007/08/06 11:32:34 1.63 -+++ ospfd/rde_spf.c 2007/09/16 15:00:11 1.64 -@@ -1,4 +1,4 @@ --/* $OpenBSD: rde_spf.c,v 1.63 2007/08/06 11:32:34 claudio Exp $ */ -+/* $OpenBSD: rde_spf.c,v 1.64 2007/09/16 15:00:11 claudio Exp $ */ - - /* - * Copyright (c) 2005 Esben Norby <norby@openbsd.org> -@@ -37,7 +37,8 @@ - - void calc_nexthop_clear(struct vertex *); - void calc_nexthop_add(struct vertex *, struct vertex *, u_int32_t); --void calc_nexthop(struct vertex *, struct vertex *); -+void calc_nexthop(struct vertex *, struct vertex *, -+ struct area *, struct lsa_rtr_link *); - void rt_nexthop_clear(struct rt_node *); - void rt_nexthop_add(struct rt_node *, struct v_nexthead *, - struct in_addr); -@@ -134,7 +135,7 @@ - if (d < w->cost) { - w->cost = d; - calc_nexthop_clear(w); -- calc_nexthop(w, v); -+ calc_nexthop(w, v, area, rtr_link); - /* - * need to readd to candidate list - * because the list is sorted -@@ -143,12 +144,12 @@ - cand_list_add(w); - } else - /* equal cost path */ -- calc_nexthop(w, v); -+ calc_nexthop(w, v, area, rtr_link); - } else if (w->cost == LS_INFINITY && d < LS_INFINITY) { - w->cost = d; - - calc_nexthop_clear(w); -- calc_nexthop(w, v); -+ calc_nexthop(w, v, area, rtr_link); - cand_list_add(w); - } - } -@@ -384,54 +385,51 @@ - } - - void --calc_nexthop(struct vertex *dst, struct vertex *parent) -+calc_nexthop(struct vertex *dst, struct vertex *parent, -+ struct area *area, struct lsa_rtr_link *rtr_link) - { -- struct lsa_rtr_link *rtr_link = NULL; - struct v_nexthop *vn; -+ struct iface *iface; - int i; - - /* case 1 */ - if (parent == spf_root) { - switch (dst->type) { - case LSA_TYPE_ROUTER: -- for (i = 0; i < lsa_num_links(dst); i++) { -- rtr_link = get_rtr_link(dst, i); -- if (rtr_link->type == LINK_TYPE_POINTTOPOINT && -- ntohl(rtr_link->id) == parent->ls_id) { -+ if (rtr_link->type != LINK_TYPE_POINTTOPOINT) -+ fatalx("inconsistent SPF tree"); -+ LIST_FOREACH(iface, &area->iface_list, entry) { -+ if (rtr_link->data == iface->addr.s_addr) { - calc_nexthop_add(dst, parent, -- rtr_link->data); -- break; -+ iface->dst.s_addr); -+ return; - } - } -- return; -+ fatalx("no interface found for interface"); - case LSA_TYPE_NETWORK: -- for (i = 0; i < lsa_num_links(parent); i++) { -- rtr_link = get_rtr_link(parent, i); -- switch (rtr_link->type) { -- case LINK_TYPE_POINTTOPOINT: -- /* ignore */ -- break; -- case LINK_TYPE_TRANSIT_NET: -- if ((htonl(dst->ls_id) & -- dst->lsa->data.net.mask) == -- (rtr_link->data & -- dst->lsa->data.net.mask)) { -- calc_nexthop_add(dst, parent, -- rtr_link->data); -- } -- break; -- case LINK_TYPE_STUB_NET: -- break; -- -- default: -- fatalx("calc_nexthop: invalid link " -- "type"); -+ switch (rtr_link->type) { -+ case LINK_TYPE_POINTTOPOINT: -+ case LINK_TYPE_STUB_NET: -+ /* ignore */ -+ break; -+ case LINK_TYPE_TRANSIT_NET: -+ if ((htonl(dst->ls_id) & -+ dst->lsa->data.net.mask) == -+ (rtr_link->data & -+ dst->lsa->data.net.mask)) { -+ calc_nexthop_add(dst, parent, -+ rtr_link->data); - } -+ break; -+ default: -+ fatalx("calc_nexthop: invalid link " -+ "type"); - } - return; - default: - fatalx("calc_nexthop: invalid dst type"); - } -+ return; - } - - /* case 2 */ -@@ -459,7 +457,7 @@ - - /* case 3 */ - TAILQ_FOREACH(vn, &parent->nexthop, entry) -- calc_nexthop_add(dst, parent, vn->nexthop.s_addr); -+ calc_nexthop_add(dst, parent, vn->nexthop.s_addr); - } - - /* candidate list */ |