summaryrefslogtreecommitdiffstats
path: root/sys/netgraph/ng_socket.c
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2005-05-17 12:18:13 +0000
committerglebius <glebius@FreeBSD.org>2005-05-17 12:18:13 +0000
commit22196abfb60c07d4d4ea45b39f23b151af9c4266 (patch)
tree65e7825d1032e578cedc6004ba84a032080302f7 /sys/netgraph/ng_socket.c
parentd3a97500015b7259f6aa9364ef3e6931a51202d8 (diff)
downloadFreeBSD-src-22196abfb60c07d4d4ea45b39f23b151af9c4266.zip
FreeBSD-src-22196abfb60c07d4d4ea45b39f23b151af9c4266.tar.gz
- Unwind NG_SEND_MSG_PATH() macro and merge it with already unwinded
version under TRACE_MESSAGES. - Pass NG_WAITOK flag to ng_package_data() in unwinded macro.
Diffstat (limited to 'sys/netgraph/ng_socket.c')
-rw-r--r--sys/netgraph/ng_socket.c54
1 files changed, 26 insertions, 28 deletions
diff --git a/sys/netgraph/ng_socket.c b/sys/netgraph/ng_socket.c
index 966db37..10cb012 100644
--- a/sys/netgraph/ng_socket.c
+++ b/sys/netgraph/ng_socket.c
@@ -211,6 +211,7 @@ ngc_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr,
struct sockaddr_ng *const sap = (struct sockaddr_ng *) addr;
struct ng_mesg *msg;
struct mbuf *m0;
+ item_p item;
char *path = NULL;
int len, error = 0;
@@ -306,36 +307,33 @@ ngc_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr,
}
}
+ if ((item = ng_package_msg(msg, M_WAITOK)) == NULL) {
+ error = ENOMEM;
#ifdef TRACE_MESSAGES
- do {
- item_p item;
- if ((item = ng_package_msg(msg, M_WAITOK)) == NULL) {
- (msg) = NULL;
- (error) = ENOMEM;
- printf("ng_package_msg: err=%d\n", error);
- break;
- }
- if ((error = ng_address_path((pcbp->sockdata->node), (item),
- (path), 0)) == 0) {
- printf("[%x]:<---------[socket]: c=<%d>cmd=%x(%s) f=%x #%d (%s)\n",
- item->el_dest->nd_ID,
- msg->header.typecookie,
- msg->header.cmd,
- msg->header.cmdstr,
- msg->header.flags,
- msg->header.token,
- item->el_dest->nd_type->name);
-
- SAVE_LINE(item);
- (error) = ng_snd_item((item), 0);
- } else
- printf("ng_address_path: errx=%d\n", error);
- (msg) = NULL;
- } while (0);
-#else
- /* The callee will free the msg when done. The path is our business. */
- NG_SEND_MSG_PATH(error, pcbp->sockdata->node, msg, path, 0);
+ printf("ng_package_msg: err=%d\n", error);
+#endif
+ goto release;
+ }
+ if ((error = ng_address_path((pcbp->sockdata->node), item,
+ path, 0)) != 0) {
+#ifdef TRACE_MESSAGES
+ printf("ng_address_path: errx=%d\n", error);
+#endif
+ goto release;
+ }
+
+#ifdef TRACE_MESSAGES
+ printf("[%x]:<---------[socket]: c=<%d>cmd=%x(%s) f=%x #%d (%s)\n",
+ item->el_dest->nd_ID,
+ msg->header.typecookie,
+ msg->header.cmd,
+ msg->header.cmdstr,
+ msg->header.flags,
+ msg->header.token,
+ item->el_dest->nd_type->name);
#endif
+ SAVE_LINE(item);
+ error = ng_snd_item(item, NG_NOFLAGS);
release:
if (path != NULL)
OpenPOWER on IntegriCloud