From 29d03d081ec9b635ce488e063234bfea0ff113c8 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Thu, 26 May 2016 02:12:02 +0000 Subject: [PATCH] zebra: remove netlink_route() it is no longer used Signed-off-by: Daniel Walton --- zebra/rt_netlink.c | 88 ---------------------------------------------- 1 file changed, 88 deletions(-) diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 9274f20826..9c2942a5f5 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -1659,94 +1659,6 @@ netlink_talk (struct nlmsghdr *n, struct nlsock *nl, struct zebra_ns *zns) return netlink_parse_info (netlink_talk_filter, nl, zns, 0); } -/* Routing table change via netlink interface. */ -static int -netlink_route (int cmd, int family, void *dest, int length, void *gate, - int index, int zebra_flags, int table) -{ - int ret; - int bytelen; - struct sockaddr_nl snl; - int discard; - - struct zebra_ns *zns = zebra_ns_lookup (NS_DEFAULT); - - struct - { - struct nlmsghdr n; - struct rtmsg r; - char buf[NL_PKT_BUF_SIZE]; - } req; - - memset (&req, 0, sizeof req - NL_PKT_BUF_SIZE); - - bytelen = (family == AF_INET ? 4 : 16); - - req.n.nlmsg_len = NLMSG_LENGTH (sizeof (struct rtmsg)); - req.n.nlmsg_flags = NLM_F_CREATE | NLM_F_REQUEST; - req.n.nlmsg_type = cmd; - req.r.rtm_family = family; - req.r.rtm_dst_len = length; - req.r.rtm_protocol = RTPROT_ZEBRA; - req.r.rtm_scope = RT_SCOPE_UNIVERSE; - - if ((zebra_flags & ZEBRA_FLAG_BLACKHOLE) - || (zebra_flags & ZEBRA_FLAG_REJECT)) - discard = 1; - else - discard = 0; - - if (cmd == RTM_NEWROUTE) - { - if (discard) - { - if (zebra_flags & ZEBRA_FLAG_BLACKHOLE) - req.r.rtm_type = RTN_BLACKHOLE; - else if (zebra_flags & ZEBRA_FLAG_REJECT) - req.r.rtm_type = RTN_UNREACHABLE; - else - assert (RTN_BLACKHOLE != RTN_UNREACHABLE); /* false */ - - if (IS_ZEBRA_DEBUG_KERNEL) - zlog_debug ("%s: Adding discard route for family %s\n", - __FUNCTION__, family == AF_INET ? "IPv4" : "IPv6"); - } - else - req.r.rtm_type = RTN_UNICAST; - } - - if (dest) - addattr_l (&req.n, sizeof req, RTA_DST, dest, bytelen); - - /* Table corresponding to this route. */ - if (table < 256) - req.r.rtm_table = table; - else - { - req.r.rtm_table = RT_TABLE_UNSPEC; - addattr32(&req.n, sizeof req, RTA_TABLE, table); - } - - if (!discard) - { - if (gate) - addattr_l (&req.n, sizeof req, RTA_GATEWAY, gate, bytelen); - if (index > 0) - addattr32 (&req.n, sizeof req, RTA_OIF, index); - } - - /* Destination netlink address. */ - memset (&snl, 0, sizeof snl); - snl.nl_family = AF_NETLINK; - - /* Talk to netlink socket. */ - ret = netlink_talk (&req.n, &zns->netlink_cmd, NS_DEFAULT); - if (ret < 0) - return -1; - - return 0; -} - /* This function takes a nexthop as argument and adds * the appropriate netlink attributes to an existing * netlink message. -- 2.39.5