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.
This commit is contained in:
parent
748bd82957
commit
42c3b709c2
@ -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
|
||||
|
@ -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_p priv, hook_p hook);
|
||||
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[] = {
|
||||
{
|
||||
@ -175,13 +166,6 @@ static const struct ng_cmdlist ng_iface_cmds[] = {
|
||||
NULL,
|
||||
NULL
|
||||
},
|
||||
{
|
||||
NGM_CISCO_COOKIE,
|
||||
NGM_CISCO_GET_IPADDR,
|
||||
"getipaddr",
|
||||
NULL,
|
||||
&ng_cisco_ipaddr_type
|
||||
},
|
||||
{
|
||||
NGM_IFACE_COOKIE,
|
||||
NGM_IFACE_GET_IFINDEX,
|
||||
@ -652,43 +636,6 @@ ng_iface_rcvmsg(node_p node, item_p item, hook_p lasthook)
|
||||
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:
|
||||
|
Loading…
Reference in New Issue
Block a user