Revision 153f02da proto/babel/babel.c

View differences:

proto/babel/babel.c
1501 1501
  ifa->cf = ic;
1502 1502
  ifa->pool = pool;
1503 1503
  ifa->ifname = new->name;
1504
  ifa->addr = new->llv6->ip;
1504 1505

  
1505 1506
  add_tail(&p->interfaces, NODE ifa);
1506 1507

  
1507
  ip_addr addr4 = IPA_NONE;
1508
  struct ifa *addr;
1509
  WALK_LIST(addr, new->addrs)
1510
  {
1511
    if (ipa_is_link_local(addr->ip))
1512
      ifa->addr = addr->ip;
1513

  
1514
    if (ipa_zero(addr4) && ipa_is_ip4(addr->ip))
1515
      addr4 = addr->ip;
1516
  }
1517

  
1508
  ip_addr addr4 = new->addr4 ? new->addr4->ip : IPA_NONE;
1518 1509
  ifa->next_hop_ip4 = ipa_nonzero(ic->next_hop_ip4) ? ic->next_hop_ip4 : addr4;
1519 1510
  ifa->next_hop_ip6 = ipa_nonzero(ic->next_hop_ip6) ? ic->next_hop_ip6 : ifa->addr;
1520 1511

  
1521
  if (ipa_zero(ifa->addr))
1522
    log(L_WARN "%s: Cannot find link-local addr on %s", p->p.name, new->name);
1523

  
1524 1512
  if (ipa_zero(ifa->next_hop_ip4) && p->ip4_channel)
1525 1513
    log(L_WARN "%s: Cannot find IPv4 next hop addr on %s", p->p.name, new->name);
1526 1514

  
......
1576 1564
    if (!(iface->flags & IF_MULTICAST))
1577 1565
      return;
1578 1566

  
1567
    /* Ignore ifaces without link-local address */
1568
    if (!iface->llv6)
1569
      return;
1570

  
1579 1571
    if (ic)
1580 1572
      babel_add_iface(p, iface, ic);
1581 1573

  
......
1615 1607

  
1616 1608
  ifa->cf = new;
1617 1609

  
1618
  if (ipa_nonzero(new->next_hop_ip4))
1619
    ifa->next_hop_ip4 = new->next_hop_ip4;
1620
  else
1621
  {
1622
    ifa->next_hop_ip4 = IPA_NONE;
1623

  
1624
    struct ifa *addr;
1625
    WALK_LIST(addr, ifa->iface->addrs)
1626
      if (ipa_is_ip4(addr->ip))
1627
      {
1628
	ifa->next_hop_ip4 = addr->ip;
1629
	break;
1630
      }
1631
  }
1632

  
1610
  ip_addr addr4 = ifa->iface->addr4 ? ifa->iface->addr4->ip : IPA_NONE;
1611
  ifa->next_hop_ip4 = ipa_nonzero(new->next_hop_ip4) ? new->next_hop_ip4 : addr4;
1633 1612
  ifa->next_hop_ip6 = ipa_nonzero(new->next_hop_ip6) ? new->next_hop_ip6 : ifa->addr;
1634 1613

  
1635 1614
  if (ipa_zero(ifa->next_hop_ip4) && p->ip4_channel)
......
1660 1639

  
1661 1640
  WALK_LIST(iface, iface_list)
1662 1641
  {
1663
    if (! (iface->flags & IF_UP))
1642
    if (!(iface->flags & IF_UP))
1643
      continue;
1644

  
1645
    /* Ignore non-multicast ifaces */
1646
    if (!(iface->flags & IF_MULTICAST))
1647
      continue;
1648

  
1649
    /* Ignore ifaces without link-local address */
1650
    if (!iface->llv6)
1664 1651
      continue;
1665 1652

  
1666 1653
    struct babel_iface *ifa = babel_find_iface(p, iface);

Also available in: Unified diff