Revision 153f02da proto/radv/radv.c

View differences:

proto/radv/radv.c
138 138
  radv_iface_notify(ifa, RA_EV_INIT);
139 139
}
140 140

  
141
static inline struct ifa *
142
find_lladdr(struct iface *iface)
143
{
144
  struct ifa *a;
145
  WALK_LIST(a, iface->addrs)
146
    if ((a->prefix.type == NET_IP6) && (a->scope == SCOPE_LINK))
147
      return a;
148

  
149
  return NULL;
150
}
151

  
152 141
static void
153 142
radv_iface_new(struct radv_proto *p, struct iface *iface, struct radv_iface_config *cf)
154 143
{
......
161 150
  ifa->ra = p;
162 151
  ifa->cf = cf;
163 152
  ifa->iface = iface;
153
  ifa->addr = iface->llv6;
164 154

  
165 155
  add_tail(&p->iface_list, NODE ifa);
166 156

  
167
  ifa->addr = find_lladdr(iface);
168
  if (!ifa->addr)
169
  {
170
    log(L_ERR "%s: Missing link-local address on interface %s", p->p.name, iface->name);
171
    return;
172
  }
173

  
174 157
  timer *tm = tm_new(pool);
175 158
  tm->hook = radv_timer;
176 159
  tm->data = ifa;
......
216 199

  
217 200
  if (flags & IF_CHANGE_UP)
218 201
  {
219
    struct radv_iface_config *ic = (struct radv_iface_config *)
220
      iface_patt_find(&cf->patt_list, iface, NULL);
202
    struct radv_iface_config *ic = (void *) iface_patt_find(&cf->patt_list, iface, NULL);
203

  
204
    /* Ignore non-multicast ifaces */
205
    if (!(iface->flags & IF_MULTICAST))
206
      return;
207

  
208
    /* Ignore ifaces without link-local address */
209
    if (!iface->llv6)
210
      return;
221 211

  
222 212
    if (ic)
223 213
      radv_iface_new(p, iface, ic);
......
395 385
  struct iface *iface;
396 386
  WALK_LIST(iface, iface_list)
397 387
  {
388
    if (!(iface->flags & IF_UP))
389
      continue;
390

  
391
    /* Ignore non-multicast ifaces */
392
    if (!(iface->flags & IF_MULTICAST))
393
      continue;
394

  
395
    /* Ignore ifaces without link-local address */
396
    if (!iface->llv6)
397
      continue;
398

  
398 399
    struct radv_iface *ifa = radv_iface_find(p, iface);
399 400
    struct radv_iface_config *ic = (struct radv_iface_config *)
400 401
      iface_patt_find(&new->patt_list, iface, NULL);

Also available in: Unified diff