Revision a97122a3

View differences:

proto/ospf/topology.c
20 20
#define HASH_LO_STEP 2
21 21
#define HASH_LO_MIN 8
22 22

  
23
int ptp_unnumbered_stub_lsa = 0;
24

  
23 25
static void *
24 26
originate_rt_lsa_body(struct ospf_area *oa, u16 * length)
25 27
{
......
28 30
  int j = 0, k = 0;
29 31
  u16 i = 0;
30 32
  struct ospf_lsa_rt *rt;
31
  struct ospf_lsa_rt_link *ln;
33
  struct ospf_lsa_rt_link *ln, *ln_after;
32 34
  struct ospf_neighbor *neigh;
33 35

  
34 36
  DBG("%s: Originating RT_lsa body for area \"%I\".\n", po->proto.name,
......
39 41
    if ((ifa->oa == oa) && (ifa->state != OSPF_IS_DOWN))
40 42
    {
41 43
      i++;
44
      if ((ifa->type == OSPF_IT_PTP) && (ifa->state == OSPF_IS_PTP) &&
45
      	  (ptp_unnumbered_stub_lsa || !(ifa->iface->addr->flags & IA_UNNUMBERED)))
46
        i++;
42 47
    }
43 48
  }
44 49
  rt = mb_allocz(po->proto.pool, sizeof(struct ospf_lsa_rt) +
......
48 53
  if ((po->ebit) && (!oa->stub))
49 54
    rt->veb.bit.e = 1;
50 55
  ln = (struct ospf_lsa_rt_link *) (rt + 1);
56
  ln_after = ln + i;
51 57

  
52 58
  WALK_LIST(ifa, po->iface_list)
53 59
  {
......
61 67
    if ((ifa->oa != oa) || (ifa->state == OSPF_IS_DOWN))
62 68
      continue;
63 69

  
70
    if (ln == ln_after)
71
      die("LSA space overflow");
72

  
64 73
    if (ifa->state == OSPF_IS_LOOP)
65 74
    {
66 75
      ln->type = 3;
......
81 90
	  ln->id = neigh->rid;
82 91
	  ln->metric = ifa->cost;
83 92
	  ln->notos = 0;
84
	  if (ifa->iface->flags && IA_UNNUMBERED)
93
	  if (ifa->iface->addr->flags & IA_UNNUMBERED)
85 94
	  {
86 95
	    ln->data = ifa->iface->index;
87 96
	  }
......
92 101
	}
93 102
	else
94 103
	{
95
	  if (ifa->state == OSPF_IS_PTP)
104
          ln--;
105
	  i--;		/* No link added */
106
        }
107

  
108
	if ((ifa->state == OSPF_IS_PTP) && 
109
	    (ptp_unnumbered_stub_lsa || !(ifa->iface->addr->flags & IA_UNNUMBERED)))
110
	{
111
	  ln++;
112
	  if (ln == ln_after)
113
            die("LSA space overflow");
114

  
115
	  ln->type = LSART_STUB;
116
	  ln->metric = ifa->cost;
117
	  ln->notos = 0;
118
	  if (ifa->iface->addr->flags & IA_UNNUMBERED)
96 119
	  {
97
	    ln->type = LSART_STUB;
98
	    ln->id = ln->id = ipa_to_u32(ifa->iface->addr->opposite);
99
	    ln->metric = ifa->cost;
100
	    ln->notos = 0;
120
	    ln->id = ipa_to_u32(ifa->iface->addr->opposite);
101 121
	    ln->data = 0xffffffff;
102 122
	  }
103 123
	  else
104
          {
105
            ln--;
106
	    i--;		/* No link added */
107
          }
124
	  {
125
	    ln->data = ipa_to_u32(ipa_mkmask(ifa->iface->addr->pxlen));
126
	    ln->id = ipa_to_u32(ifa->iface->addr->prefix) & ln->data;
127
	  }
108 128
	}
109 129
	break;
110 130
      case OSPF_IT_BCAST:

Also available in: Unified diff