socsvn commit: r287739 - soc2015/roam/ng_ayiya
roam at FreeBSD.org
roam at FreeBSD.org
Mon Jun 29 19:03:32 UTC 2015
Author: roam
Date: Mon Jun 29 19:03:30 2015
New Revision: 287739
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=287739
Log:
Remove GET/SET_VERSION/MOTD, handled by responders.
As noted by my mentor, the heartbeat, version, "message of the day",
and other non-IPv6-data packets would much better be processed in
userland. Thus, revert most of rev. 287682 that added four
control messages and some private structure members, as well as
the blurbs about them in the manual page.
ObQuote: "What good's causing problems when no one's complaining?"
Modified:
soc2015/roam/ng_ayiya/ng_ayiya.4
soc2015/roam/ng_ayiya/ng_ayiya.c
soc2015/roam/ng_ayiya/ng_ayiya.h
Modified: soc2015/roam/ng_ayiya/ng_ayiya.4
==============================================================================
--- soc2015/roam/ng_ayiya/ng_ayiya.4 Mon Jun 29 19:03:26 2015 (r287738)
+++ soc2015/roam/ng_ayiya/ng_ayiya.4 Mon Jun 29 19:03:30 2015 (r287739)
@@ -88,12 +88,6 @@
.Tn AYIYA
packets.
.It *
-Configure the node by sending a
-.Dv NGM_AYIYA_SET_VERSION
-and optionally a
-.Dv NGM_AYIYA_SET_MOTD
-control message.
-.It *
Connect the
.Va inet6
hook to a
@@ -199,16 +193,6 @@
heartbeat packet to the
.Va ayiya
hook and start forwarding packets between the two.
-.It Dv NGM_AYIYA_GET_VERSION
-Get the local
-.Nm ayiya
-node's version string.
-.It Dv NGM_AYIYA_GET_MOTD
-Get the local
-.Nm ayiya
-node's
-.Dq message of the day
-string.
.It Dv NGM_AYIYA_SECRETHASH
Set the secret hash used for authenticating the
.Tn AYIYA
@@ -216,16 +200,6 @@
The message parameter should be a SHA1 hash of the
.Va Password
field obtained via TIC negotiation.
-.It Dv NGM_AYIYA_SET_VERSION
-Set the local
-.Nm ayiya
-node's version string.
-.It Dv NGM_AYIYA_SET_MOTD
-Set the local
-.Nm ayiya
-node's
-.Dq message of the day
-string.
.El
.Sh SHUTDOWN
This node shuts down upon receipt of a
Modified: soc2015/roam/ng_ayiya/ng_ayiya.c
==============================================================================
--- soc2015/roam/ng_ayiya/ng_ayiya.c Mon Jun 29 19:03:26 2015 (r287738)
+++ soc2015/roam/ng_ayiya/ng_ayiya.c Mon Jun 29 19:03:30 2015 (r287739)
@@ -78,34 +78,6 @@
NULL,
&ng_parse_uint32_type,
},
- {
- NGM_AYIYA_COOKIE,
- NGM_AYIYA_SET_VERSION,
- "set_version",
- &ng_parse_string_type,
- NULL,
- },
- {
- NGM_AYIYA_COOKIE,
- NGM_AYIYA_SET_MOTD,
- "set_motd",
- &ng_parse_string_type,
- NULL,
- },
- {
- NGM_AYIYA_COOKIE,
- NGM_AYIYA_GET_VERSION,
- "get_version",
- NULL,
- &ng_parse_string_type,
- },
- {
- NGM_AYIYA_COOKIE,
- NGM_AYIYA_GET_MOTD,
- "get_motd",
- NULL,
- &ng_parse_string_type,
- },
{ 0 }
};
@@ -147,7 +119,6 @@
hook_p hooks[AYIYA_HOOK_LAST];
node_p node;
item_p configuring;
- struct mbuf *m_version, *m_motd;
bool configured;
};
typedef struct ng_ayiya_private *priv_p;
@@ -184,11 +155,6 @@
return (m2);
}
-#define AYIYA_VERSION "ng_ayiya 0.1.0.dev177"
-#define AYIYA_VERSION_SZ sizeof(AYIYA_VERSION)
-#define AYIYA_MOTD "No message of the day defined yet."
-#define AYIYA_MOTD_SZ sizeof(AYIYA_MOTD)
-
static int
ng_ayiya_constructor(const node_p node)
{
@@ -197,27 +163,7 @@
priv = malloc(sizeof(*priv), M_NETGRAPH_AYIYA, M_WAITOK | M_ZERO);
NG_NODE_SET_PRIVATE(node, priv);
priv->node = node;
-
- priv->m_version = ayiya_m_getm(AYIYA_VERSION_SZ, M_WAITOK);
- if (priv->m_version == NULL)
- goto no_mem;
- bcopy(AYIYA_VERSION, priv->m_version->m_data, AYIYA_VERSION_SZ);
-
- priv->m_motd = ayiya_m_getm(AYIYA_MOTD_SZ, M_WAITOK);
- if (priv->m_motd == NULL)
- goto no_mem;
- bcopy(AYIYA_MOTD, priv->m_motd->m_data, AYIYA_MOTD_SZ);
-
return (0);
-
-no_mem:
- m_freem(priv->m_motd);
- priv->m_motd = NULL;
- m_freem(priv->m_version);
- priv->m_version = NULL;
- free(priv, M_NETGRAPH_AYIYA);
- NG_NODE_SET_PRIVATE(node, NULL);
- return (ENOMEM);
}
#define ERROUT(x) do { error = (x); goto done; } while (0)
@@ -389,42 +335,6 @@
return (0);
}
- case NGM_AYIYA_GET_VERSION:
- {
- const priv_p priv = NG_NODE_PRIVATE(node);
- NG_MKRESPONSE(resp, msg, priv->m_version->m_len, M_WAITOK);
- bcopy(priv->m_version->m_data, resp->data, priv->m_version->m_len);
- break;
- }
-
- case NGM_AYIYA_GET_MOTD:
- {
- const priv_p priv = NG_NODE_PRIVATE(node);
- NG_MKRESPONSE(resp, msg, priv->m_motd->m_len, M_WAITOK);
- bcopy(priv->m_motd->m_data, resp->data, priv->m_motd->m_len);
- break;
- }
-
- case NGM_AYIYA_SET_VERSION:
- case NGM_AYIYA_SET_MOTD:
- {
- const size_t sz = msg->header.arglen;
- struct mbuf * const m = ayiya_m_getm(sz, M_WAITOK);
- if (m == NULL) {
- error = ENOMEM;
- break;
- }
- bcopy(msg->data, m->m_data, sz);
-
- const priv_p priv = NG_NODE_PRIVATE(node);
- struct mbuf ** const mm =
- msg->header.cmd == NGM_AYIYA_SET_VERSION?
- &priv->m_version: &priv->m_motd;
- m_freem(*mm);
- *mm = m;
- break;
- }
-
default:
error = EINVAL;
break;
@@ -542,8 +452,6 @@
if (priv != NULL) {
if (priv->configuring)
configuring_respond(node, ECONNABORTED);
- m_freem(priv->m_motd);
- m_freem(priv->m_version);
free(priv, M_NETGRAPH_AYIYA);
NG_NODE_SET_PRIVATE(node, NULL);
}
Modified: soc2015/roam/ng_ayiya/ng_ayiya.h
==============================================================================
--- soc2015/roam/ng_ayiya/ng_ayiya.h Mon Jun 29 19:03:26 2015 (r287738)
+++ soc2015/roam/ng_ayiya/ng_ayiya.h Mon Jun 29 19:03:30 2015 (r287739)
@@ -34,10 +34,6 @@
enum {
NGM_AYIYA_SECRETHASH = 1,
NGM_AYIYA_CONFIGURE,
- NGM_AYIYA_SET_VERSION,
- NGM_AYIYA_SET_MOTD,
- NGM_AYIYA_GET_VERSION,
- NGM_AYIYA_GET_MOTD,
};
typedef enum {
More information about the svn-soc-all
mailing list