mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-22 17:51:53 +00:00
Changes to interface handling on traditional Unices:
o Aliases are interpreted as secondary addresses. o When the system doesn't supply interface indices, generate our ones.
This commit is contained in:
parent
5e13ffe6f4
commit
9273035403
5
TODO
5
TODO
@ -4,8 +4,6 @@ Core
|
|||||||
|
|
||||||
- io.c: refuse old-style multicasts for unnumbered interfaces?
|
- io.c: refuse old-style multicasts for unnumbered interfaces?
|
||||||
|
|
||||||
- prefer loopback addresses as router IDs (dummy interface?)
|
|
||||||
|
|
||||||
- config: executable config files
|
- config: executable config files
|
||||||
|
|
||||||
- do we really need preconfig?
|
- do we really need preconfig?
|
||||||
@ -13,7 +11,6 @@ Core
|
|||||||
- counters (according to SNMP MIB?)
|
- counters (according to SNMP MIB?)
|
||||||
- better memory allocators
|
- better memory allocators
|
||||||
- default preferences of protocols: prefer BGP over OSPF/RIP external routes?
|
- default preferences of protocols: prefer BGP over OSPF/RIP external routes?
|
||||||
- secondary addresses -> subinterfaces or ignore
|
|
||||||
|
|
||||||
- static: check validity of route destination?
|
- static: check validity of route destination?
|
||||||
|
|
||||||
@ -23,8 +20,6 @@ Core
|
|||||||
|
|
||||||
- netlink: import Linux route attributes to our rta's, so that they can be filtered?
|
- netlink: import Linux route attributes to our rta's, so that they can be filtered?
|
||||||
|
|
||||||
- iface: when seen an invalid broadcast, fix it up or at least report
|
|
||||||
- iface: we always need ifindex at least for PtP links (OSPF)
|
|
||||||
- iface: interface filters should support filtering by IP address as well
|
- iface: interface filters should support filtering by IP address as well
|
||||||
- iface: SIOCGIFINDEX exists on glibc systems, but it doesn't work on 2.0.x kernels!
|
- iface: SIOCGIFINDEX exists on glibc systems, but it doesn't work on 2.0.x kernels!
|
||||||
|
|
||||||
|
@ -32,10 +32,11 @@ scan_ifs(struct ifreq *r, int cnt)
|
|||||||
{
|
{
|
||||||
struct iface i, *pi;
|
struct iface i, *pi;
|
||||||
struct ifa a;
|
struct ifa a;
|
||||||
char *err;
|
char *err, *colon;
|
||||||
unsigned fl;
|
unsigned fl;
|
||||||
ip_addr netmask;
|
ip_addr netmask;
|
||||||
int l;
|
int l;
|
||||||
|
int sec = 0;
|
||||||
|
|
||||||
if_start_update();
|
if_start_update();
|
||||||
for (cnt /= sizeof(struct ifreq); cnt; cnt--, r++)
|
for (cnt /= sizeof(struct ifreq); cnt; cnt--, r++)
|
||||||
@ -43,11 +44,11 @@ scan_ifs(struct ifreq *r, int cnt)
|
|||||||
bzero(&i, sizeof(i));
|
bzero(&i, sizeof(i));
|
||||||
bzero(&a, sizeof(a));
|
bzero(&a, sizeof(a));
|
||||||
DBG("%s\n", r->ifr_name);
|
DBG("%s\n", r->ifr_name);
|
||||||
if (strchr(r->ifr_name, ':'))
|
if (colon = strchr(r->ifr_name, ':'))
|
||||||
{
|
{
|
||||||
/* FIXME: Honour aliases as secondary addresses? */
|
/* It's an alias -- let's interpret it as a secondary interface address */
|
||||||
DBG("Alias, ignored.\n");
|
sec = 1;
|
||||||
continue;
|
*colon = 0;
|
||||||
}
|
}
|
||||||
strncpy(i.name, r->ifr_name, sizeof(i.name) - 1);
|
strncpy(i.name, r->ifr_name, sizeof(i.name) - 1);
|
||||||
get_sockaddr((struct sockaddr_in *) &r->ifr_addr, &a.ip, NULL);
|
get_sockaddr((struct sockaddr_in *) &r->ifr_addr, &a.ip, NULL);
|
||||||
@ -135,9 +136,26 @@ scan_ifs(struct ifreq *r, int cnt)
|
|||||||
else
|
else
|
||||||
i.index = r->ifr_ifindex;
|
i.index = r->ifr_ifindex;
|
||||||
#else
|
#else
|
||||||
/* FIXME: What else? Guess ifindex (we need it at least for OSPF on unnumbered links)? */
|
/*
|
||||||
|
* The kernel doesn't give us real ifindices, but we still need them
|
||||||
|
* at least for OSPF unnumbered links. So let's make them up ourselves.
|
||||||
|
*/
|
||||||
|
if (pi = if_find_by_name(i.name))
|
||||||
|
i.index = pi->index;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
static int if_index_counter = 1;
|
||||||
|
i.index = if_index_counter++;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
pi = NULL;
|
||||||
|
if (sec)
|
||||||
|
{
|
||||||
|
a.flags |= IA_SECONDARY;
|
||||||
|
pi = if_find_by_index(i.index);
|
||||||
|
}
|
||||||
|
if (!pi)
|
||||||
pi = if_update(&i);
|
pi = if_update(&i);
|
||||||
a.iface = pi;
|
a.iface = pi;
|
||||||
ifa_update(&a);
|
ifa_update(&a);
|
||||||
|
Loading…
Reference in New Issue
Block a user