bug-zebra
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

*PATCH* ospfd on point-to-multipoint networks


From: Roger Venning
Subject: *PATCH* ospfd on point-to-multipoint networks
Date: Fri, 26 Jul 2002 00:32:03 +1000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9) Gecko/20020408

all,

please find patch against latest CVS to correctly support point-to-multipoint support as per RFC 2328.

Compiles, runs, tested, makes a vast improvement over being able to configure the feature but not have *anything* work, not even distribution of the correct LSAs. Incorporates another patch that was previously posted on the list that didn't fix up the whole story - it still needed to correct next hop resolution in shortest path first calculation. Also slightly changes the multicast hello process on point-to-multipoint media (only) so that automatic neighbour discovery is supported in situations where it is possible with the media (e.g. 802.11 in ad-hoc mode).

Example configs that were used for testing and a brief amount of output are also attached.

(Apologies to individuals who receive multiple copies, but I want to be certain that this receives attention from whoever has the ability to commit to CVS. Also I know that I should add summary-route and other options in the config but at first I just needed to get something working...)

Roger.

--
-------------------------------------------------------------
Roger Venning   \ Do not go gentle into that good night
Melbourne        \ Rage, rage against the dying of the light.
Australia <address@hidden>                 Dylan Thomas


diff -Nur zebra-cvs-25-7/ospfd/ospf_lsa.c zebra/ospfd/ospf_lsa.c
--- zebra-cvs-25-7/ospfd/ospf_lsa.c     Thu Jul  4 12:46:00 2002
+++ zebra/ospfd/ospf_lsa.c      Thu Jul 25 23:37:33 2002
@@ -589,6 +589,44 @@
 
 #define lsa_link_nbma_set(S,O)  lsa_link_broadcast_set (S, O)
 
+/* this function add for support point-to-multipoint ,see rfc2328 
+12.4.1.4.*/
+/* from "edward rrr" <address@hidden>
+   http://marc.theaimsgroup.com/?l=zebra&m=100739222210507&w=2 */
+int lsa_link_ptomultip_set (struct stream *s, struct ospf_interface *oi)
+{
+  int links = 0;
+  struct route_node *rn;
+  struct ospf_neighbor *nbr = NULL;
+  struct in_addr id, mask;
+
+  mask.s_addr = 0xffffffff;
+  id.s_addr = oi->address->u.prefix4.s_addr;
+  link_info_set (s, id, mask, LSA_LINK_TYPE_STUB, 0, 0);
+  links++;
+
+  zlog_info ("PointToMultipoint: running ptomultip_set");
+
+  /* Search neighbor, */
+  for (rn = route_top (oi->nbrs); rn; rn = route_next (rn))
+    if ((nbr = rn->info) != NULL)
+      /* Ignore myself. */
+      if (!IPV4_ADDR_SAME (&nbr->router_id, &ospf_top->router_id))
+       if (nbr->state == NSM_Full)
+
+         {
+           
+           link_info_set (s, nbr->router_id, oi->address->u.prefix4,
+                          LSA_LINK_TYPE_POINTOPOINT, 0, oi->output_cost);
+           links++;
+           zlog_info ("PointToMultipoint: set link to %s",
+                      inet_ntoa(oi->address->u.prefix4));
+         }
+  
+  return links;
+  
+}
+
 /* Set router-LSA link information. */
 int
 router_lsa_link_set (struct stream *s, struct ospf_area *area)
@@ -619,7 +657,7 @@
                  links += lsa_link_nbma_set (s, oi);
                  break;
                case OSPF_IFTYPE_POINTOMULTIPOINT:
-                 /* Not supproted yet. */
+                 links += lsa_link_ptomultip_set (s, oi);
                  break;
                case OSPF_IFTYPE_VIRTUALLINK:
                  links += lsa_link_virtuallink_set (s, oi);
diff -Nur zebra-cvs-25-7/ospfd/ospf_packet.c zebra/ospfd/ospf_packet.c
--- zebra-cvs-25-7/ospfd/ospf_packet.c  Thu Jul  4 12:46:00 2002
+++ zebra/ospfd/ospf_packet.c   Thu Jul 25 21:23:46 2002
@@ -3108,6 +3108,8 @@
   else if ((oi->type == OSPF_IFTYPE_POINTOPOINT) 
           && (flag == OSPF_SEND_PACKET_INDIRECT))
      p.prefix.s_addr = htonl (OSPF_ALLSPFROUTERS);
+  else if (oi->type == OSPF_IFTYPE_POINTOMULTIPOINT)
+     p.prefix.s_addr = htonl (OSPF_ALLSPFROUTERS);
   else
      p.prefix.s_addr = htonl (OSPF_ALLDROUTERS);
 
diff -Nur zebra-cvs-25-7/ospfd/ospf_spf.c zebra/ospfd/ospf_spf.c
--- zebra-cvs-25-7/ospfd/ospf_spf.c     Sun Jun 30 23:54:00 2002
+++ zebra/ospfd/ospf_spf.c      Thu Jul 25 23:46:01 2002
@@ -365,18 +365,39 @@
              
              if (l->m[0].type == LSA_LINK_TYPE_POINTOPOINT)
                {
-                 while ((l2 = ospf_get_next_link (w, v, l2)))
+                 /* check for PtMP, signified by PtP link V->W with link_data 
our PtMP interface */
+                  oi = ospf_if_is_configured(&l->link_data);
+                  if (oi && oi->type == OSPF_IFTYPE_POINTOMULTIPOINT)
                    {
-                     oi = ospf_if_is_configured (&(l2->link_data));
+                   
+                     struct prefix_ipv4 * la = prefix_ipv4_new();
+                     la->prefixlen = oi->address->prefixlen;
                      
-                     if (oi == NULL)
-                       continue;
-                     
-                     if (! IPV4_ADDR_SAME (&oi->address->u.prefix4,
-                                           &l->link_data))
-                       continue;
-                     
-                     break;
+                     /* we link to them on PtMP interface - find the interface 
on w */
+                     while ((l2 = ospf_get_next_link (w, v, l2)))
+                       {
+                         la->prefix = l2->link_data;
+                         
+                         if (prefix_cmp((struct prefix *)la, oi->address) == 0)
+                           /* link_data is on our PtMP network */
+                           break;
+                         
+                       }
+                   }
+                 else
+                   {                                
+                     while ((l2 = ospf_get_next_link (w, v, l2)))
+                       {
+                         oi = ospf_if_is_configured (&(l2->link_data));
+                         
+                         if (oi == NULL)
+                           continue;
+                         
+                         if (!IPV4_ADDR_SAME (&oi->address->u.prefix4, 
&l->link_data))
+                           continue;
+                         
+                         break;
+                      }
                    }
                  
                  if (oi && l2)
!
! Zebra configuration saved from vty
!   2002/07/07 14:28:49
!
hostname Collingwood_Wireless
password secret
enable password secret
log stdout
!
!
!
interface lo
!
interface wlan0
!
interface eth1
 ip ospf network point-to-multipoint
!
interface sit0
!
interface tunl0
!
interface eth0
!
router ospf
 ospf router-id 172.16.80.2
 redistribute connected
 redistribute static
 network 172.16.80.0/23 area 0
!
line vty
!
!
! Zebra configuration saved from vty
!   2002/06/17 08:23:52
!
hostname zooropa
password secret
enable password secret
log stdout
!
!
!
interface lo
!
interface eth1
!
interface sit0
!
interface eth0
 ip ospf network broadcast 
!
router ospf
 ospf router-id 10.10.0.33
 redistribute connected
 network 10.10.0.32/27 area 172.16.80.5
 !network 10.10.0.32/27 area 0
! default-information originate metric 100
!
line vty
!
!
! Zebra configuration saved from vty
!   2002/07/06 17:54:31
!
hostname CIAgw
password secret
enable password secret
log stdout
!
!
!
interface lo
!
interface sit0
!
interface eth1
 ip ospf network broadcast 
!
interface eth0
 ip ospf network point-to-multipoint
!
router ospf
 ospf router-id 172.16.80.5
 redistribute kernel
 redistribute connected
 redistribute static
 network 172.16.80.0/23 area 0
 network 10.10.0.32/27 area 172.16.80.5
!
line vty
!
Collingwood_Wireless# show ip ospf neighbor 

Neighbor ID     Pri   State           Dead Time   Address         Interface     
      RXmtL RqstL DBsmL
172.16.80.5       1   Full/DROther    00:00:37    172.16.80.5     
eth1:172.16.80.2     0     0     0
Collingwood_Wireless# show ip os
Collingwood_Wireless# show ip ospf rou
Collingwood_Wireless# show ip ospf route 
============ OSPF network routing table ============
N IA 10.10.0.32/28         [20] area: 0.0.0.0
                           via 172.16.80.5, eth1
N IA 10.10.0.48/29         [30] area: 0.0.0.0
                           via 172.16.80.5, eth1
N    172.16.80.5/32        [10] area: 0.0.0.0
                           via 172.16.80.5, eth1

============ OSPF router routing table =============
R    10.10.0.33         IA [20] area: 0.0.0.0, ASBR
                           via 172.16.80.5, eth1
R    172.16.80.5           [10] area: 0.0.0.0, ABR, ASBR
                           via 172.16.80.5, eth1

============ OSPF external routing table ===========
N E2 203.220.79.9/32       [20/20] tag: 0
                           via 172.16.80.5, eth1

Collingwood_Wireless# exit
Connection closed by foreign host.
address@hidden /root]# ip route show
bash: ip: command not found
address@hidden /root]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
203.220.79.9    172.16.80.5     255.255.255.255 UGH   20     0        0 eth1
10.10.0.16      0.0.0.0         255.255.255.252 U     0      0        0 eth0
10.10.0.48      172.16.80.5     255.255.255.248 UG    30     0        0 eth1
10.10.0.0       10.10.0.17      255.255.255.248 UG    0      0        0 eth0
10.10.0.8       0.0.0.0         255.255.255.248 U     0      0        0 wlan0
10.10.0.32      172.16.80.5     255.255.255.240 UG    20     0        0 eth1
172.16.80.0     172.16.80.5     255.255.254.0   UG    0      0        0 eth1
172.16.80.0     0.0.0.0         255.255.254.0   U     0      0        0 eth1
10.10.0.0       172.16.80.5     255.255.254.0   UG    0      0        0 eth1
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
zooropa# show ip ospf neighbor 

Neighbor ID     Pri   State           Dead Time   Address         Interface     
      RXmtL RqstL DBsmL
172.16.80.5       1   Full/Backup     00:00:34    10.10.0.34      
eth0:10.10.0.33     0     0     0
zooropa# show ip 
access-list ospf       prefix-list 
zooropa# show ip o
zooropa# show ip ospf rou
zooropa# show ip ospf route 
============ OSPF network routing table ============
N    10.10.0.32/28         [10] area: 172.16.80.5
                           directly attached to eth0
N    10.10.0.48/29         [10] area: 172.16.80.5
                           directly attached to eth1
N    10.10.0.57/32         [10] area: 172.16.80.5
                           via 10.10.0.34, eth0
N IA 172.16.80.2/32        [20] area: 172.16.80.5
                           via 10.10.0.34, eth0

============ OSPF router routing table =============
R    172.16.80.2        IA [20] area: 172.16.80.5, ASBR
                           via 10.10.0.34, eth0
R    172.16.80.5           [10] area: 172.16.80.5, ABR, ASBR
                           via 10.10.0.34, eth0

============ OSPF external routing table ===========

zooropa# exit
Connection closed by foreign host.
address@hidden etc]# ip route show
203.220.79.9 dev ppp0  proto kernel  scope link  src 203.220.12.113 
10.10.0.48/29 dev eth1  scope link 
10.10.0.32/28 dev eth0  scope link 
10.10.0.0/16 via 10.10.0.34 dev eth0 
172.16.0.0/16 via 10.10.0.34 dev eth0 
127.0.0.0/8 dev lo  scope link 
default via 203.220.79.9 dev ppp0 
address@hidden etc]# telnet localhost zebra
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

Hello, this is zebra (version 0.92a).
Copyright 1996-2001 Kunihiro Ishiguro.


User Access Verification

Password: 
zooropa> ena
Password: 
zooropa# show ip os
zooropa# show ip rou
zooropa# show ip route 
Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF,
       B - BGP, > - selected route, * - FIB route

K>* 0.0.0.0/0 via 203.220.79.9, ppp0
K * 10.10.0.0/16 via 10.10.0.34, eth0 inactive
O   10.10.0.8/29 [110/20] via 10.10.0.34 inactive, 00:00:42
O   10.10.0.16/30 [110/20] via 10.10.0.34 inactive, 00:00:42
O   10.10.0.32/28 [110/10] is directly connected, eth0, 00:04:38
K>* 10.10.0.32/28 is directly connected, eth0
C * 10.10.0.32/28 is directly connected, eth0
O   10.10.0.48/29 [110/10] is directly connected, eth1, 00:05:41
K>* 10.10.0.48/29 is directly connected, eth1
C * 10.10.0.48/29 is directly connected, eth1
O   10.10.0.57/32 [110/10] via 10.10.0.34 inactive, 00:00:57
K>* 127.0.0.0/8 is directly connected, lo
C * 127.0.0.0/8 is directly connected, lo
K * 172.16.0.0/16 via 10.10.0.34, eth0 inactive
O   172.16.80.2/32 [110/20] via 10.10.0.34 inactive, 00:00:43
C>* 203.x.x.9/32 is directly connected, ppp0
CIAgw# show ip ospf neighbor 

Neighbor ID     Pri   State           Dead Time   Address         Interface     
      RXmtL RqstL DBsmL
172.16.80.2       1   Full/DROther    00:00:27    172.16.80.2     
eth0:172.16.80.5     2     0     0
10.10.0.33        1   Full/DR         00:00:37    10.10.0.33      
eth1:10.10.0.34     1     0     0
CIAgw# show ip ospf rou      
CIAgw# show ip ospf route 
============ OSPF network routing table ============
N    10.10.0.32/28         [10] area: 172.16.80.5
                           directly attached to eth1
N    10.10.0.48/29         [20] area: 172.16.80.5
                           via 10.10.0.33, eth1
N    172.16.80.2/32        [10] area: 0.0.0.0
                           via 172.16.80.2, eth0

============ OSPF router routing table =============
R    10.10.0.33            [10] area: 172.16.80.5, ASBR
                           via 10.10.0.33, eth1
R    172.16.80.2           [10] area: 0.0.0.0, ASBR
                           via 172.16.80.2, eth0

============ OSPF external routing table ===========
N E2 10.10.0.8/29          [10/20] tag: 0
                           via 172.16.80.2, eth0
N E2 10.10.0.16/30         [10/20] tag: 0
                           via 172.16.80.2, eth0
N E2 203.x.x.9/32       [10/20] tag: 0
                           via 10.10.0.33, eth1

CIAgw# show ip ospf route 
============ OSPF network routing table ============
N    10.10.0.32/28         [10] area: 172.16.80.5
                           directly attached to eth1
N    10.10.0.48/29         [20] area: 172.16.80.5
                           via 10.10.0.33, eth1
N    172.16.80.2/32        [10] area: 0.0.0.0
                           via 172.16.80.2, eth0

============ OSPF router routing table =============
R    10.10.0.33            [10] area: 172.16.80.5, ASBR
                           via 10.10.0.33, eth1
R    172.16.80.2           [10] area: 0.0.0.0, ASBR
                           via 172.16.80.2, eth0

============ OSPF external routing table ===========
N E2 10.10.0.8/29          [10/20] tag: 0
                           via 172.16.80.2, eth0
N E2 10.10.0.16/30         [10/20] tag: 0
                           via 172.16.80.2, eth0
N E2 203.x.x.9/32       [10/20] tag: 0
                           via 10.10.0.33, eth1

CIAgw# exit
Connection closed by foreign host.
bash-2.04# ip route show
203.220.79.9 via 10.10.0.33 dev eth1  proto zebra  metric 20 
10.10.0.16/30 via 172.16.80.2 dev eth0  proto zebra  metric 20 
10.10.0.48/29 via 10.10.0.33 dev eth1  proto zebra  metric 20 
10.10.0.56/29 dev eth0  proto kernel  scope link  src 10.10.0.57 
10.10.0.8/29 via 172.16.80.2 dev eth0  proto zebra  metric 20 
10.10.0.32/28 dev eth1  proto kernel  scope link  src 10.10.0.34 
172.16.80.0/23 dev eth0  proto kernel  scope link  src 172.16.80.5 
127.0.0.0/8 dev lo  scope link 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]