summaryrefslogtreecommitdiff
path: root/zebra/connected.c
diff options
context:
space:
mode:
authorpaul <paul>2005-11-03 12:35:21 +0000
committerpaul <paul>2005-11-03 12:35:21 +0000
commit0752ef0b2e9bbf6c7ab20ed0fe87840b3bd1b7f4 (patch)
treed580aa8f809edf9a75968f7416e8415ffa72784c /zebra/connected.c
parent6d45276f0c8aeec1ce53f77039ec02ec0f940ca1 (diff)
2005-11-03 Paul Jakma <paul.jakma@sun.com>
* connected.{c,h}: Include memory.h (connected_add_ipv4) Use MTYPE for ifc label. (connected_add_ipv6) Also should accept label. Store it in ifp. (connected_del_ipv4) Taking label as argument is pointless. * rt_netlink.c: (netlink_interface_addr) update label usage for connected_{add,delete} functions. * if_ioctl.c: (if_getaddrs) NULL label for connected_add_ipv6. * if_ioctl_solaris.c: (interface_list_ioctl) Pass LIFC_NOXMIT so we also find out about NOXMIT interfaces like VNI. Bit of hackery to turn interface names into the primary interface name, later with routing socket messages we only will about primary interfaces anyway, so we must normalise the name. (if_get_addr) take label as argument, so it can be passed to connected_add. If label is provided, then it is interface name to issue the ioctl for address information on, not the ifp name. (interface_list) List AF_UNSPEC too, just in case. * if_proc.c: (ifaddr_proc_ipv6) label for connected_add_ipv6. * interface.c: (if_addr_wakeup) Some very bogus code - sets IFF_RUNNING - add comment. (if_refresh) (ip_address_install) Use MTYPE for ifc label. * ioctl_solaris.c: (if_mangle_up) New function. Hackery to make IFF_UP reflect whether any addresses are left on the interface, as we get signalled for IFF_UP flags change on the primary interface only. Logical interfaces dont generate IFINFO, but we do get an RTM_DELADDR. (if_get_flags) Call if_mangle_up before return. * kernel_socket.c: (ifam_read) Fixup calls to connected_{add,delete} to match above changes. Rename gate variable to brd, less confusing. Pass the interface name as a label, if it is not same name as ifp->name.
Diffstat (limited to 'zebra/connected.c')
-rw-r--r--zebra/connected.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/zebra/connected.c b/zebra/connected.c
index 58d964fc..105e4b11 100644
--- a/zebra/connected.c
+++ b/zebra/connected.c
@@ -29,6 +29,7 @@
#include "rib.h"
#include "table.h"
#include "log.h"
+#include "memory.h"
#include "zebra/zserv.h"
#include "zebra/redistribute.h"
@@ -219,7 +220,7 @@ connected_add_ipv4 (struct interface *ifp, int flags, struct in_addr *addr,
/* Label of this address. */
if (label)
- ifc->label = strdup (label);
+ ifc->label = XSTRDUP (MTYPE_CONNECTED_LABEL, label);
/* Check same connected route. */
if ((current = connected_check (ifp, (struct prefix *) ifc->address)))
@@ -267,8 +268,7 @@ connected_down_ipv4 (struct interface *ifp, struct connected *ifc)
/* Delete connected IPv4 route to the interface. */
void
connected_delete_ipv4 (struct interface *ifp, int flags, struct in_addr *addr,
- u_char prefixlen, struct in_addr *broad,
- const char *label)
+ u_char prefixlen, struct in_addr *broad)
{
struct prefix_ipv4 p;
struct connected *ifc;
@@ -330,7 +330,7 @@ connected_up_ipv6 (struct interface *ifp, struct connected *ifc)
/* Add connected IPv6 route to the interface. */
void
connected_add_ipv6 (struct interface *ifp, struct in6_addr *addr,
- u_char prefixlen, struct in6_addr *broad)
+ u_char prefixlen, struct in6_addr *broad, char *label)
{
struct prefix_ipv6 *p;
struct connected *ifc;
@@ -356,6 +356,10 @@ connected_add_ipv6 (struct interface *ifp, struct in6_addr *addr,
ifc->destination = (struct prefix *) p;
}
+ /* Label of this address. */
+ if (label)
+ ifc->label = XSTRDUP (MTYPE_CONNECTED_LABEL, label);
+
if ((current = connected_check (ifp, (struct prefix *) ifc->address)))
connected_withdraw (current); /* implicit update of existing address */