]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: remove netlink_route() it is no longer used
authorDaniel Walton <dwalton@cumulusnetworks.com>
Thu, 26 May 2016 02:12:02 +0000 (02:12 +0000)
committerDaniel Walton <dwalton@cumulusnetworks.com>
Thu, 26 May 2016 15:25:13 +0000 (15:25 +0000)
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
zebra/rt_netlink.c

index 9274f208269d7d29d7d8c74d78d936d7f6ea60e7..9c2942a5f5c4204de107adcc83cae2f7f7d662eb 100644 (file)
@@ -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.