Author: glebius
Date: Mon Jan 12 09:48:45 2015
New Revision: 277058
URL: https://svnweb.freebsd.org/changeset/base/277058

Log:
  Remove the support for NGM_CISCO_GET_IPADDR message from ng_iface(4).  The
  legitimacy of removal is proved by the fact that implementation contained
  a critical bug: the response allocated was sizeof(pointer), while should
  had been 2*sizeof(struct ng_cisco_ipaddr).  The reason for ng_iface(4) to
  support ng_cisco(4) message isn't explained anywhere, and code comes from
  original Whistle import.
  
  Sponsored by: Nginx, Inc.

Modified:
  head/share/man/man4/ng_iface.4
  head/sys/netgraph/ng_iface.c

Modified: head/share/man/man4/ng_iface.4
==============================================================================
--- head/share/man/man4/ng_iface.4      Mon Jan 12 09:46:49 2015        
(r277057)
+++ head/share/man/man4/ng_iface.4      Mon Jan 12 09:48:45 2015        
(r277058)
@@ -35,7 +35,7 @@
 .\" $FreeBSD$
 .\" $Whistle: ng_iface.8,v 1.5 1999/01/25 23:46:26 archie Exp $
 .\"
-.Dd October 28, 2005
+.Dd January 12, 2015
 .Dt NG_IFACE 4
 .Os
 .Sh NAME
@@ -111,12 +111,6 @@ The interface must not currently be up.
 .It Dv NGM_IFACE_BROADCAST Pq Ic broadcast
 Set the interface to broadcast mode.
 The interface must not currently be up.
-.It Dv NGM_CISCO_GET_IPADDR Pq Ic getipaddr
-This message is defined by the
-.Xr ng_cisco 4
-node type; see
-.Xr ng_cisco 4
-for a description.
 .El
 .Sh SHUTDOWN
 This node shuts down upon receipt of a

Modified: head/sys/netgraph/ng_iface.c
==============================================================================
--- head/sys/netgraph/ng_iface.c        Mon Jan 12 09:46:49 2015        
(r277057)
+++ head/sys/netgraph/ng_iface.c        Mon Jan 12 09:48:45 2015        
(r277058)
@@ -83,7 +83,6 @@
 #include <netgraph/netgraph.h>
 #include <netgraph/ng_parse.h>
 #include <netgraph/ng_iface.h>
-#include <netgraph/ng_cisco.h>
 
 #ifdef NG_SEPARATE_MALLOC
 static MALLOC_DEFINE(M_NETGRAPH_IFACE, "netgraph_iface", "netgraph iface 
node");
@@ -144,14 +143,6 @@ static iffam_p     get_iffam_from_hook(priv_
 static iffam_p get_iffam_from_name(const char *name);
 static hook_p  *get_hook_from_iffam(priv_p priv, iffam_p iffam);
 
-/* Parse type for struct ng_cisco_ipaddr */
-static const struct ng_parse_struct_field ng_cisco_ipaddr_type_fields[]
-       = NG_CISCO_IPADDR_TYPE_INFO;
-static const struct ng_parse_type ng_cisco_ipaddr_type = {
-       &ng_parse_struct_type,
-       &ng_cisco_ipaddr_type_fields
-};
-
 /* List of commands and how to convert arguments to/from ASCII */
 static const struct ng_cmdlist ng_iface_cmds[] = {
        {
@@ -176,13 +167,6 @@ static const struct ng_cmdlist ng_iface_
          NULL
        },
        {
-         NGM_CISCO_COOKIE,
-         NGM_CISCO_GET_IPADDR,
-         "getipaddr",
-         NULL,
-         &ng_cisco_ipaddr_type
-       },
-       {
          NGM_IFACE_COOKIE,
          NGM_IFACE_GET_IFINDEX,
          "getifindex",
@@ -652,43 +636,6 @@ ng_iface_rcvmsg(node_p node, item_p item
                        break;
                }
                break;
-       case NGM_CISCO_COOKIE:
-               switch (msg->header.cmd) {
-               case NGM_CISCO_GET_IPADDR:      /* we understand this too */
-                   {
-                       struct ifaddr *ifa;
-
-                       /* Return the first configured IP address */
-                       if_addr_rlock(ifp);
-                       TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
-                               struct ng_cisco_ipaddr *ips;
-
-                               if (ifa->ifa_addr->sa_family != AF_INET)
-                                       continue;
-                               NG_MKRESPONSE(resp, msg, sizeof(ips), M_NOWAIT);
-                               if (resp == NULL) {
-                                       error = ENOMEM;
-                                       break;
-                               }
-                               ips = (struct ng_cisco_ipaddr *)resp->data;
-                               ips->ipaddr = ((struct sockaddr_in *)
-                                               ifa->ifa_addr)->sin_addr;
-                               ips->netmask = ((struct sockaddr_in *)
-                                               ifa->ifa_netmask)->sin_addr;
-                               break;
-                       }
-                       if_addr_runlock(ifp);
-
-                       /* No IP addresses on this interface? */
-                       if (ifa == NULL)
-                               error = EADDRNOTAVAIL;
-                       break;
-                   }
-               default:
-                       error = EINVAL;
-                       break;
-               }
-               break;
        case NGM_FLOW_COOKIE:
                switch (msg->header.cmd) {
                case NGM_LINK_IS_UP:
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to