New port zebra-devel - development version of zebra

(after repo-copy from zebra port)

Submitted by:	Alexandr Kovalenko <never@nevermind.kiev.ua>
PR:		53556
Approved by:	fjoe (mentor) (implicit)
This commit is contained in:
Sergey A. Osokin 2003-07-02 19:47:28 +00:00
parent 13fcd4d6e6
commit ac26dfe1fa
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=84070
9 changed files with 73 additions and 3811 deletions

View file

@ -1,33 +1,78 @@
# New ports collection makefile for: zebra
# Date created: So 31 Mai 1998 11:00:30 CEST
# Whom: Andreas Klemm <andreas@klemm.gtn.com>
# New ports collection makefile for: zebra-devel
# Date created: Fri 20 Jun 2003 15:57:48 EEST
# Whom: Alexandr Kovalenko <never@nevermind.kiev.ua>
#
# $FreeBSD$
#
PORTNAME= zebra
PORTVERSION= 0.93b
PORTREVISION= 6
PORTVERSION= ${ZEBRAVERSION}.${ZEBRADATE}
PORTREVISION?= 0
CATEGORIES= net ipv6
MASTER_SITES= ftp://ftp.zebra.org/pub/zebra/ \
ftp://ftp.ripe.net/mirrors/sites/ftp.zebra.org/pub/zebra/ \
ftp://ftp.sunet.se/pub/network/zebra/ \
ftp://ftp.knowledge.com/pub/mirrors/zebra/ \
ftp://6bone.informatik.uni-leipzig.de/pub/ftp.zebra.org/pub/zebra/ \
ftp://ftp.crc.ca/pub/packages/network/zebra/ \
ftp://ftp.pop-pr.rnp.br/pub/GNU/ftp.zebra.org/zebra/
MASTER_SITES= ${MASTER_SITE_LOCAL} \
ftp://ftp7.ua.freebsd.org/pub/local-distfiles/ \
http://uafug.org.ua/~never/zebra-devel/
MASTER_SITE_SUBDIR= osa
MAINTAINER= sumikawa@FreeBSD.org
MAINTAINER= never@nevermind.kiev.ua
COMMENT= Free RIPv1, RIPv2, OSPFv2, BGP4 route software (server/reflector)
ZEBRAVERSION= 0.94
ZEBRADATE= 20030620
WRKSRC= ${WRKDIR}/${PORTNAME}-${ZEBRAVERSION}
USE_SUBMAKE= yes
USE_BZIP2= yes
GNU_CONFIGURE= yes
CONFIGURE_ARGS+=--sysconfdir=${PREFIX}/etc/zebra --enable-vtysh
CONFIGURE_ARGS+=--sysconfdir=${PREFIX}/etc/zebra
SCRIPTS_ENV= WRKDIRPREFIX=${WRKDIRPREFIX}
MAN1= vtysh.1
MAN8= bgpd.8 ospf6d.8 ospfd.8 ripd.8 ripngd.8 zebra.8
.if defined (WITHOUT_IPV6)
CONFIGURE_ARGS+=--disable-ipv6
WITHOUT_OSPF6D= yes
WITHOUT_RIPNGD= yes
.endif
.if !defined(WITHOUT_BGPD)
PLIST_SUB+= BGPD=""
.else
CONFIGURE_ARGS+=--disable-bgpd
PLIST_SUB+= BGPD="@comment "
.endif
.if !defined(WITHOUT_OSPF6D)
PLIST_SUB+= OSPF6D=""
.else
CONFIGURE_ARGS+=--disable-ospf6d
PLIST_SUB+= OSPF6D="@comment "
.endif
.if !defined(WITHOUT_OSPFD)
PLIST_SUB+= OSPF6D=""
PLIST_SUB+= OSPFD=""
.else
CONFIGURE_ARGS+=--disable-ospfd
PLIST_SUB+= OSPFD="@comment "
.endif
.if !defined(WITHOUT_RIPD)
PLIST_SUB+= RIPD=""
.else
CONFIGURE_ARGS+=--disable-ripd
PLIST_SUB+= RIPD="@comment "
.endif
.if !defined(WITHOUT_RIPNGD)
PLIST_SUB+= RIPNGD=""
.else
CONFIGURE_ARGS+=--disable-ripngd
PLIST_SUB+= RIPNGD="@comment "
.endif
.if !defined(BATCH)
pre-configure:
@${RM} -f ${WRKDIRPREFIX}${.CURDIR}/Makefile.inc
@ -41,7 +86,7 @@ post-clean:
.endif
post-install:
@( cd ${WRKSRC}/doc; rm -f zebra*info*; ${MAKE} zebra.info install )
@( cd ${WRKSRC}/doc; ${RM} -f zebra*info*; ${MAKE} zebra.info install )
@${ECHO} "===> installing zebra startup file..."
@${SED} -e "s=!!PREFIX!!=${PREFIX}=" \
< ${FILESDIR}/zebractl.sh \

View file

@ -1 +1 @@
MD5 (zebra-0.93b.tar.gz) = 9ca7dc5e0afb9b6470e4b1e21c271fe1
MD5 (zebra-0.94.20030620.tar.bz2) = 8ee3cc1326b42a6a8600ce8b9dd3f35d

View file

@ -1,31 +0,0 @@
$FreeBSD$
--- zebra/ioctl.c.orig Tue Oct 23 11:31:29 2001
+++ zebra/ioctl.c Fri Oct 4 19:45:04 2002
@@ -349,6 +349,7 @@
int ret;
struct ifreq ifreq;
+ bzero(&ifreq, sizeof(struct ifreq));
ifreq_set_name (&ifreq, ifp);
ifreq.ifr_flags = ifp->flags;
@@ -371,6 +372,7 @@
int ret;
struct ifreq ifreq;
+ bzero(&ifreq, sizeof(struct ifreq));
ifreq_set_name (&ifreq, ifp);
ifreq.ifr_flags = ifp->flags;
@@ -473,6 +475,9 @@
mask.sin6_len = sizeof (struct sockaddr_in6);
#endif
memcpy (&addreq.ifra_prefixmask, &mask, sizeof (struct sockaddr_in6));
+
+ addreq.ifra_lifetime.ia6t_vltime = 0xffffffff;
+ addreq.ifra_lifetime.ia6t_pltime = 0xffffffff;
addreq.ifra_lifetime.ia6t_pltime = ND6_INFINITE_LIFETIME;
addreq.ifra_lifetime.ia6t_vltime = ND6_INFINITE_LIFETIME;

File diff suppressed because it is too large Load diff

View file

@ -1,11 +0,0 @@
--- ospfd/ospf_packet.c.orig Thu Jul 4 05:06:41 2002
+++ ospfd/ospf_packet.c Fri Mar 28 00:05:26 2003
@@ -276,7 +276,7 @@
/* check crypto seqnum. */
nbr = ospf_nbr_lookup_by_routerid (oi->nbrs, &ospfh->router_id);
- if (nbr && ntohl(nbr->crypt_seqnum) >= ntohl(ospfh->u.crypt.crypt_seqnum))
+ if (nbr && ntohl(nbr->crypt_seqnum) > ntohl(ospfh->u.crypt.crypt_seqnum))
return 0;
/* Generate a digest for the ospf packet - their digest + our digest. */

View file

@ -1,301 +0,0 @@
--- lib/if.c.orig Fri Jun 21 23:49:50 2002
+++ lib/if.c Mon Oct 14 17:25:42 2002
@@ -553,6 +553,65 @@
return NULL;
}
+/* Find the IPv4 address on our side that will be used when packets
+ are sent to dst. */
+struct connected *
+connected_lookup_address (struct interface *ifp, struct in_addr dst)
+{
+ struct prefix addr;
+ struct prefix best;
+ listnode cnode;
+ struct prefix *p;
+ struct connected *c;
+ struct connected *match;
+
+ /* Zero structures - get rid of rubbish from stack */
+ memset(&addr, 0, sizeof(addr));
+ memset(&best, 0, sizeof(best));
+
+ addr.family = AF_INET;
+ addr.u.prefix4 = dst;
+ addr.prefixlen = IPV4_MAX_BITLEN;
+
+ match = NULL;
+
+ for (cnode = listhead (ifp->connected); cnode; nextnode (cnode))
+ {
+ c = getdata (cnode);
+
+ if (if_is_pointopoint (ifp))
+ {
+ p = c->address;
+
+ if (p && p->family == AF_INET)
+ {
+#ifdef OLD_RIB /* PTP links are conventionally identified
+ by the address of the far end - MAG */
+ if (IPV4_ADDR_SAME (&p->u.prefix4, &dst))
+ return c;
+#endif
+ p = c->destination;
+ if (p && IPV4_ADDR_SAME (&p->u.prefix4, &dst))
+ return c;
+ }
+ }
+ else
+ {
+ p = c->address;
+
+ if (p->family == AF_INET)
+ {
+ if (prefix_match (p, &addr) && p->prefixlen > best.prefixlen)
+ {
+ best = *p;
+ match = c;
+ }
+ }
+ }
+ }
+ return match;
+}
+
/* Check the connected information is PtP style or not. */
int
ifc_pointopoint (struct connected *ifc)
--- ./lib/if.h.orig Fri Jun 21 23:49:50 2002
+++ ./lib/if.h Mon Oct 14 17:25:42 2002
@@ -202,6 +202,7 @@
void connected_free (struct connected *);
void connected_add (struct interface *, struct connected *);
struct connected *connected_delete_by_prefix (struct interface *, struct prefix *);
+struct connected *connected_lookup_address (struct interface *, struct in_addr);
int ifc_pointopoint (struct connected *);
#ifndef HAVE_IF_NAMETOINDEX
--- ./ripd/ripd.c.orig Mon Jul 1 02:57:22 2002
+++ ./ripd/ripd.c Tue Oct 15 10:02:11 2002
@@ -55,8 +55,8 @@
/* Prototypes. */
void rip_event (enum rip_event, int);
-void rip_output_process (struct interface *, struct sockaddr_in *,
- int, u_char);
+void rip_output_process (struct interface *, struct prefix *,
+ struct sockaddr_in *, int, u_char);
/* RIP output routes type. */
enum
@@ -955,7 +955,14 @@
{
caddr_t lim;
struct rte *rte;
+ struct prefix_ipv4 ifaddr;
+ struct prefix_ipv4 ifaddrclass;
+ struct connected *c;
+ int subnetted;
+ /* We don't know yet. */
+ subnetted = -1;
+
/* The Response must be ignored if it is not from the RIP
port. (RFC2453 - Sec. 3.9.2)*/
if (ntohs (from->sin_port) != RIP_PORT_DEFAULT)
@@ -1108,23 +1115,51 @@
{
u_int32_t destination;
- destination = ntohl (rte->prefix.s_addr);
-
- if (destination & 0xff)
+ if (subnetted == -1)
{
- masklen2ip (32, &rte->mask);
+ c = connected_lookup_address (ifp, from->sin_addr);
+ if (c != NULL)
+ {
+ memcpy (&ifaddr, c->address, sizeof (struct prefix_ipv4));
+ memcpy (&ifaddrclass, &ifaddr, sizeof (struct prefix_ipv4));
+ apply_classful_mask_ipv4 (&ifaddrclass);
+ subnetted = 0;
+ if (ifaddr.prefixlen > ifaddrclass.prefixlen)
+ subnetted = 1;
+ }
}
- else if ((destination & 0xff00) || IN_CLASSC (destination))
- {
+
+ destination = ntohl (rte->prefix.s_addr);
+
+ if (IN_CLASSA (destination))
+ masklen2ip (8, &rte->mask);
+ else if (IN_CLASSB (destination))
+ masklen2ip (16, &rte->mask);
+ else if (IN_CLASSC (destination))
masklen2ip (24, &rte->mask);
+
+ if (subnetted == 1)
+ masklen2ip (ifaddrclass.prefixlen,
+ (struct in_addr *) &destination);
+ if ((subnetted == 1) && ((rte->prefix.s_addr & destination) ==
+ ifaddrclass.prefix.s_addr))
+ {
+ masklen2ip (ifaddr.prefixlen, &rte->mask);
+ if ((rte->prefix.s_addr & rte->mask.s_addr) != rte->prefix.s_addr)
+ masklen2ip (32, &rte->mask);
+ if (IS_RIP_DEBUG_EVENT)
+ zlog_info ("Subnetted route %s", inet_ntoa (rte->prefix));
}
- else if ((destination & 0xff0000) || IN_CLASSB (destination))
+ else
{
- masklen2ip (16, &rte->mask);
+ if ((rte->prefix.s_addr & rte->mask.s_addr) != rte->prefix.s_addr)
+ continue;
}
- else
+
+ if (IS_RIP_DEBUG_EVENT)
{
- masklen2ip (8, &rte->mask);
+ zlog_info ("Resultant route %s", inet_ntoa (rte->prefix));
+ zlog_info ("Resultant mask %s", inet_ntoa (rte->mask));
}
}
@@ -1353,7 +1388,7 @@
ntohl (rte->metric) == RIP_METRIC_INFINITY)
{
/* All route with split horizon */
- rip_output_process (ifp, from, rip_all_route, packet->version);
+ rip_output_process (ifp, NULL, from, rip_all_route, packet->version);
}
else
{
@@ -1884,8 +1919,8 @@
/* Send update to the ifp or spcified neighbor. */
void
-rip_output_process (struct interface *ifp, struct sockaddr_in *to,
- int route_type, u_char version)
+rip_output_process (struct interface *ifp, struct prefix *ifaddr,
+ struct sockaddr_in *to, int route_type, u_char version)
{
int ret;
struct stream *s;
@@ -1894,8 +1929,11 @@
struct rip_interface *ri;
struct prefix_ipv4 *p;
struct prefix_ipv4 classfull;
+ struct prefix_ipv4 ifaddrclass;
+ struct connected *c;
int num;
int rtemax;
+ int subnetted;
/* Logging output event. */
if (IS_RIP_DEBUG_EVENT)
@@ -1946,29 +1984,60 @@
rtemax -=1;
}
+ if (version == RIPv1)
+ {
+ if (ifaddr == NULL)
+ {
+ c = connected_lookup_address (ifp, to->sin_addr);
+ if (c != NULL)
+ ifaddr = c->address;
+ }
+ if (ifaddr == NULL)
+ {
+ zlog_warn ("cannot find source address for packets to neighbor %s",
+ inet_ntoa (to->sin_addr));
+ return;
+ }
+ memcpy (&ifaddrclass, ifaddr, sizeof (struct prefix_ipv4));
+ apply_classful_mask_ipv4 (&ifaddrclass);
+ subnetted = 0;
+ if (ifaddr->prefixlen > ifaddrclass.prefixlen)
+ subnetted = 1;
+ }
+
for (rp = route_top (rip->table); rp; rp = route_next (rp))
if ((rinfo = rp->info) != NULL)
{
- /* Some inheritance stuff: */
- /* Before we process with ipv4 prefix we should mask it */
- /* with Classful mask if we send RIPv1 packet.That's because */
- /* user could set non-classful mask or we could get it by RIPv2 */
- /* or other protocol. checked with Cisco's way of life :) */
+ /* For RIPv1, if we are subnetted, output subnets in our network */
+ /* that have the same mask as the output "interface". For other */
+ /* networks, only the classfull version is output. */
if (version == RIPv1)
{
- memcpy (&classfull, &rp->p, sizeof (struct prefix_ipv4));
+ p = (struct prefix_ipv4 *) &rp->p;
if (IS_RIP_DEBUG_PACKET)
- zlog_info("%s/%d before RIPv1 mask check ",
- inet_ntoa (classfull.prefix), classfull.prefixlen);
-
- apply_classful_mask_ipv4 (&classfull);
- p = &classfull;
+ zlog_info("RIPv1 mask check, %s/%d considered for output",
+ inet_ntoa (rp->p.u.prefix4), rp->p.prefixlen);
+ if (subnetted &&
+ prefix_match ((struct prefix *) &ifaddrclass, &rp->p))
+ {
+ if ((ifaddr->prefixlen != rp->p.prefixlen) &&
+ (rp->p.prefixlen != 32))
+ continue;
+ }
+ else
+ {
+ memcpy (&classfull, &rp->p, sizeof(struct prefix_ipv4));
+ apply_classful_mask_ipv4(&classfull);
+ if (rp->p.u.prefix4.s_addr != 0 &&
+ classfull.prefixlen != rp->p.prefixlen)
+ continue;
+ }
if (IS_RIP_DEBUG_PACKET)
- zlog_info("%s/%d after RIPv1 mask check",
- inet_ntoa (p->prefix), p->prefixlen);
+ zlog_info("RIPv1 mask check, %s/%d made it through",
+ inet_ntoa (rp->p.u.prefix4), rp->p.prefixlen);
}
else
p = (struct prefix_ipv4 *) &rp->p;
@@ -2109,7 +2178,7 @@
if (IS_RIP_DEBUG_EVENT)
zlog_info ("multicast announce on %s ", ifp->name);
- rip_output_process (ifp, NULL, route_type, version);
+ rip_output_process (ifp, NULL, NULL, route_type, version);
return;
}
@@ -2136,7 +2205,8 @@
if_is_pointopoint (ifp) ? "unicast" : "broadcast",
inet_ntoa (to.sin_addr), ifp->name);
- rip_output_process (ifp, &to, route_type, version);
+ rip_output_process (ifp, connected->address, &to, route_type,
+ version);
}
}
}
@@ -2224,7 +2294,7 @@
to.sin_port = htons (RIP_PORT_DEFAULT);
/* RIP version is rip's configuration. */
- rip_output_process (ifp, &to, route_type, rip->version);
+ rip_output_process (ifp, NULL, &to, route_type, rip->version);
}
}

View file

@ -1,11 +0,0 @@
--- zebra/Makefile.in.orig Sat Jun 29 15:26:54 2002
+++ zebra/Makefile.in Wed Jul 24 19:16:06 2002
@@ -404,7 +404,7 @@
#client : client_main.o ../lib/libzebra.a
-# $(CC) -g -o client client_main.o ../lib/libzebra.a $(LIBS) $(LIB_IPV6)
+# $(CC) -o client client_main.o ../lib/libzebra.a $(LIBS) $(LIB_IPV6)
install-sysconfDATA: $(sysconf_DATA)
@$(NORMAL_INSTALL)

View file

@ -1,6 +1,6 @@
#! /bin/sh
#
# $FreeBSD: /tmp/pcvs/ports/net/zebra-devel/files/Attic/zebractl.sh,v 1.8 2002-08-04 20:04:50 sumikawa Exp $
# $FreeBSD: /tmp/pcvs/ports/net/zebra-devel/files/Attic/zebractl.sh,v 1.9 2003-07-02 19:47:28 osa Exp $
#
# zebra start/stop script by "Andreas Klemm <andreas@FreeBSD.ORG>"
#

View file

@ -1,19 +1,17 @@
sbin/bgpd
sbin/ospf6d
sbin/ospfd
sbin/ripd
sbin/ripngd
%%BGPD%%sbin/bgpd
%%OSPF6D%%sbin/ospf6d
%%OSPFD%%sbin/ospfd
%%RIPD%%sbin/ripd
%%RIPNGD%%sbin/ripngd
sbin/zebra
sbin/zebractl
bin/vtysh
etc/zebra/bgpd.conf.sample
etc/zebra/bgpd.conf.sample2
etc/zebra/ospf6d.conf.sample
etc/zebra/ospfd.conf.sample
etc/zebra/ripd.conf.sample
etc/zebra/ripngd.conf.sample
%%BGPD%%etc/zebra/bgpd.conf.sample
%%BGPD%%etc/zebra/bgpd.conf.sample2
%%OSPF6D%%etc/zebra/ospf6d.conf.sample
%%OSPFD%%etc/zebra/ospfd.conf.sample
%%RIPD%%etc/zebra/ripd.conf.sample
%%RIPNGD%%etc/zebra/ripngd.conf.sample
etc/zebra/zebra.conf.sample
etc/zebra/vtysh.conf.sample
@unexec install-info --delete %D/info/zebra.info %D/info/dir
info/zebra.info
info/zebra.info-1