Sfoglia il codice sorgente

fully work-off this package

Ralf S. Engelschall 23 anni fa
parent
commit
e5efc6e5af
4 ha cambiato i file con 149 aggiunte e 23 eliminazioni
  1. 18 8
      zebra/rc.zebra
  2. 6 0
      zebra/vtysh.conf
  3. 99 0
      zebra/zebra.patch
  4. 26 15
      zebra/zebra.spec

+ 18 - 8
zebra/rc.zebra

@@ -5,18 +5,28 @@
 
 %config
     zebra_enable="yes"
+    zebra_protocols="rip ospf bgp"
 
 %start -p 200 -u root
     opServiceEnabled zebra || exit 0
-    @l_prefix@/sbin/zebra -d
-    @l_prefix@/sbin/ripd  -d
-    @l_prefix@/sbin/ospfd -d
-    @l_prefix@/sbin/bgpd  -d
+    ( cd @l_prefix@/etc/zebra
+      @l_prefix@/sbin/zebra -d
+      for protocol in $zebra_protocols; do
+          if [ -f @l_prefix@/sbin/${protocol}d ]; then
+              @l_prefix@/sbin/${protocol}d  -d
+          fi
+      done
+      @l_prefix@/bin/vtysh -b
+    )
 
 %stop -p 200 -u root
     opServiceEnabled zebra || exit 0
-    kill -TERM `cat @l_prefix@/var/zebra/bgpd.pid`
-    kill -TERM `cat @l_prefix@/var/zebra/ospfd.pid`
-    kill -TERM `cat @l_prefix@/var/zebra/ripd.pid`
-    kill -TERM `cat @l_prefix@/var/zebra/zebra.pid`
+    if [ -f @l_prefix@/var/zebra/zebra.pid ]; then
+        kill -TERM `cat @l_prefix@/var/zebra/zebra.pid` >/dev/null 2>&1 || true
+    fi
+    for protocol in $zebra_protocols; do
+        if [ -f @l_prefix@/var/zebra/${protocol}d.pid ]; then
+            kill -TERM `cat @l_prefix@/var/zebra/${protocol}d.pid` >/dev/null 2>&1 || true
+        fi
+    done
 

+ 6 - 0
zebra/vtysh.conf

@@ -0,0 +1,6 @@
+!
+!   vtysh.conf -- Zebra VTY Shell Configuration
+!
+username zebra nopassword
+log file @l_prefix@/var/zebra/vtysh.log
+!

+ 99 - 0
zebra/zebra.patch

@@ -0,0 +1,99 @@
+--- ripd/ripd.c
++++ ripd/ripd.c
+@@ -51,6 +51,10 @@
+ 
+ /* RIP queries. */
+ long rip_global_queries = 0;
++
++/* Should we trust netmasks or rather apply_classful_mask_ipv4()
++   in rip_output_process() ? */
++char rip_should_trust_netmasks = 0;
+ 
+ /* Prototypes. */
+ void rip_event (enum rip_event, int);
+@@ -1963,7 +1967,9 @@
+ 	      zlog_info("%s/%d before RIPv1 mask check ",
+ 			inet_ntoa (classfull.prefix), classfull.prefixlen);
+ 
+-	    apply_classful_mask_ipv4 (&classfull);
++		if (!rip_should_trust_netmasks)
++		  apply_classful_mask_ipv4 (&classfull);
++
+ 	    p = &classfull;
+ 
+ 	    if (IS_RIP_DEBUG_PACKET)
+@@ -2705,6 +2711,26 @@
+ 
+   return CMD_SUCCESS;
+ }
++
++DEFUN (rip_trust_netmasks,
++       rip_trust_netmasks_cmd,
++       "trust netmasks",
++       "Tell Zebra to trust netmasks and not to recalculate them.\n"
++       "Netmasks will be trusted.\n")
++{
++  rip_should_trust_netmasks = 1;
++  return CMD_SUCCESS;
++}
++
++DEFUN (no_rip_trust_netmasks,
++       no_rip_trust_netmasks_cmd,
++       "no trust netmasks",
++       "Tell Zebra not to trust netmasks and recalculate them.\n"
++       "Netmasks will be recalculated.\n")
++{
++  rip_should_trust_netmasks = 0;
++  return CMD_SUCCESS;
++}
+ 
+ struct route_table *rip_distance_table;
+ 
+@@ -3503,6 +3529,8 @@
+   install_element (RIP_NODE, &no_rip_distance_source_cmd);
+   install_element (RIP_NODE, &rip_distance_source_access_list_cmd);
+   install_element (RIP_NODE, &no_rip_distance_source_access_list_cmd);
++  install_element (RIP_NODE, &rip_trust_netmasks_cmd);
++  install_element (RIP_NODE, &no_rip_trust_netmasks_cmd);
+ 
+   /* Debug related init. */
+   rip_debug_init ();
+--- 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; 
+--- lib/vty.h.orig	Sun Aug 18 16:34:00 2002
++++ lib/vty.h	Wed Mar 12 11:10:05 2003
+@@ -128,7 +128,7 @@
+ };
+ 
+ /* Integrated configuration file. */
+-#define INTEGRATE_DEFAULT_CONFIG "Zebra.conf"
++#define INTEGRATE_DEFAULT_CONFIG "zebra.conf.integrate"
+ 
+ /* Small macro to determine newline is newline only or linefeed needed. */
+ #define VTY_NEWLINE  ((vty->type == VTY_TERM) ? "\r\n" : "\n")

+ 26 - 15
zebra/zebra.spec

@@ -33,7 +33,7 @@ Distribution: OpenPKG [BASE]
 Group:        Network
 License:      GPL
 Version:      0.93b
-Release:      20020913
+Release:      20030312
 
 #   list of sources
 Source0:      ftp://ftp.zebra.org/pub/zebra/zebra-%{version}.tar.gz
@@ -42,11 +42,12 @@ Source2:      bgpd.conf
 Source3:      ospfd.conf
 Source4:      ripd.conf
 Source5:      zebra.conf
+Patch0:       zebra.patch
 
 #   build information
 Prefix:       %{l_prefix}
 BuildRoot:    %{l_buildroot}
-BuildPreReq:  OpenPKG, openpkg >= 20020206, gcc
+BuildPreReq:  OpenPKG, openpkg >= 20020206, gcc, readline
 PreReq:       OpenPKG, openpkg >= 20020206
 AutoReq:      no
 AutoReqProv:  no
@@ -63,6 +64,7 @@ AutoReqProv:  no
 
 %prep
     %setup -q
+    %patch -p0
 
 %build
     #   patch configure script for correct pid directory
@@ -73,10 +75,16 @@ AutoReqProv:  no
     #   configure package
     CC="%{l_cc}" \
     CFLAGS="%{l_cflags -O}" \
+    CPPFLAGS="%{l_cppflags}" \
+    LDFLAGS="%{l_ldflags}" \
     ./configure \
         --prefix=%{l_prefix} \
         --sysconfdir=%{l_prefix}/etc/zebra \
-        --disable-ipv6
+        --enable-vtysh \
+        --disable-ospf6d \
+        --disable-ripngd \
+        --disable-ipv6 \
+        --without-libpam
 
     #   build package
     %{l_make} %{l_mflags -O}
@@ -88,28 +96,31 @@ AutoReqProv:  no
     %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
 
     #   strip down package
-    rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/vtysh.1
+    rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/ospf6d.8
+    rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/ripngd.8
     rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dir
     strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
 
     #   replace default configuration
     rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/zebra/*
-    %{l_shtool} install -c -m 600 -e 's;@l_prefix@;%{l_prefix};g' \
-        %{SOURCE bgpd.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/zebra/
-    %{l_shtool} install -c -m 600 -e 's;@l_prefix@;%{l_prefix};g' \
-        %{SOURCE ospfd.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/zebra/
-    %{l_shtool} install -c -m 600 -e 's;@l_prefix@;%{l_prefix};g' \
-        %{SOURCE ripd.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/zebra/
-    %{l_shtool} install -c -m 600 -e 's;@l_prefix@;%{l_prefix};g' \
-        %{SOURCE zebra.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/zebra/
+    %{l_shtool} install -c -m 600 \
+        -e 's;@l_prefix@;%{l_prefix};g' \
+        %{SOURCE zebra.conf} %{SOURCE vtysh.conf} \
+        %{SOURCE ripd.conf} %{SOURCE ospfd.conf} %{SOURCE bgpd.conf} \
+        $RPM_BUILD_ROOT%{l_prefix}/etc/zebra/
+    %{l_shtool} install -c -m 600 /dev/null \
+        $RPM_BUILD_ROOT%{l_prefix}/etc/zebra/zebra.conf.integrate
 
     #   install run-command script
-    %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
-    %{l_shtool} install -c -m 755 -e 's;@l_prefix@;%{l_prefix};g' \
+    %{l_shtool} mkdir -f -p -m 755 \
+        $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
+    %{l_shtool} install -c -m 755 \
+        -e 's;@l_prefix@;%{l_prefix};g' \
         %{SOURCE rc.zebra} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
 
     #   make sure pid and log directory exists
-    %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/var/zebra
+    %{l_shtool} mkdir -f -p -m 755 \
+        $RPM_BUILD_ROOT%{l_prefix}/var/zebra
 
     #   determine package file list
     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \