Page MenuHomeFreeBSD

D23850.diff
No OneTemporary

D23850.diff

Index: lib/libnetgraph/msg.c
===================================================================
--- lib/libnetgraph/msg.c
+++ lib/libnetgraph/msg.c
@@ -74,7 +74,6 @@
msg.header.version = NG_VERSION;
msg.header.typecookie = cookie;
msg.header.token = atomic_fetch_add(&gMsgId, 1) & INT_MAX;
- msg.header.flags = NGF_ORIG;
msg.header.cmd = cmd;
snprintf((char *)msg.header.cmdstr, NG_CMDSTRSIZ, "cmd%d", cmd);
@@ -166,7 +165,7 @@
/* Prepare message header */
rep = *msg;
- rep.header.flags = NGF_RESP;
+ rep.header.flags |= NGF_RESP;
/* Deliver message */
return (NgDeliverMsg(cs, path, &rep, args, arglen));
Index: share/man/man4/netgraph.4
===================================================================
--- share/man/man4/netgraph.4
+++ share/man/man4/netgraph.4
@@ -842,11 +842,11 @@
.Bd -literal
#define NG_CMDSTRSIZ 32 /* Max command string (including null) */
+/* real structures can differ, these are the names which can be used */
struct ng_mesg {
struct ng_msghdr {
u_char version; /* Must equal NG_VERSION */
- u_char spare; /* Pad to 4 bytes */
- uint16_t spare2;
+ uint16_t fragment; /* fragment counter */
uint32_t arglen; /* Length of cmd/resp data */
uint32_t cmd; /* Command identifier */
uint32_t flags; /* Message status flags */
@@ -859,8 +859,8 @@
#define NG_ABI_VERSION 12 /* Netgraph kernel ABI version */
#define NG_VERSION 8 /* Netgraph message version */
-#define NGF_ORIG 0x00000000 /* The msg is the original request */
#define NGF_RESP 0x00000001 /* The message is a response */
+#define NGF_FRAGMENT 0x00000002 /* More fragments follow */
.Ed
.Pp
Control messages have the fixed header shown above, followed by a
Index: sys/netgraph/ng_message.h
===================================================================
--- sys/netgraph/ng_message.h
+++ sys/netgraph/ng_message.h
@@ -56,9 +56,9 @@
/* A netgraph message */
struct ng_mesg {
struct ng_msghdr {
- u_char version; /* == NGM_VERSION */
- u_char spare; /* pad to 4 bytes */
- u_int16_t spare2;
+ u_char version; /* == NG_VERSION */
+ u_char spare; /* pad */
+ u_int16_t fragment; /* fragment counter */
u_int32_t arglen; /* length of data */
u_int32_t cmd; /* command identifier */
u_int32_t flags; /* message status */
@@ -78,7 +78,7 @@
#define NG_GENERIC_NG_MESG_INFO(dtype) { \
{ "version", &ng_parse_uint8_type }, \
{ "spare", &ng_parse_uint8_type }, \
- { "spare2", &ng_parse_uint16_type }, \
+ { "fragment", &ng_parse_uint16_type }, \
{ "arglen", &ng_parse_uint32_type }, \
{ "cmd", &ng_parse_uint32_type }, \
{ "flags", &ng_parse_hint32_type }, \
@@ -93,12 +93,15 @@
* Netgraph message header compatibility field
* Interfaces within the kernel are defined by a different
* value (see NG_ABI_VERSION in netgraph.h)
+ *
+ * Support both NG_VERSION and NG_VERSION2 as long as needed.
*/
#define NG_VERSION 8
+#define NG_VERSION2 9
/* Flags field flags */
-#define NGF_ORIG 0x00000000 /* the msg is the original request */
#define NGF_RESP 0x00000001 /* the message is a response */
+#define NGF_FRAG 0x00000002 /* more fragments (NG_VERSION2 only) */
/* Type of a unique node ID. */
#define ng_ID_t uint32_t
Index: sys/netgraph/ng_socket.c
===================================================================
--- sys/netgraph/ng_socket.c
+++ sys/netgraph/ng_socket.c
@@ -616,6 +616,10 @@
pcbp = malloc(sizeof(struct ngpcb), M_PCB, M_WAITOK | M_ZERO);
pcbp->type = type;
+ /* Store the current parameters of socket initialization */
+ pcbp->recvspace = ngpdg_recvspace;
+ pcbp->sendspace = ngpdg_sendspace;
+
/* Link the pcb and the socket. */
so->so_pcb = (caddr_t)pcbp;
pcbp->ng_socket = so;
Index: sys/netgraph/ng_socketvar.h
===================================================================
--- sys/netgraph/ng_socketvar.h
+++ sys/netgraph/ng_socketvar.h
@@ -51,5 +51,7 @@
LIST_ENTRY(ngpcb) socks; /* linked list of sockets */
int type; /* NG_CONTROL or NG_DATA */
ng_ID_t node_id; /* a hint for netstat(1) to find the node */
+ u_long sendspace; /* buffer space for socket */
+ u_long recvspace; /* buffer space for socket */
};
#endif /* _NETGRAPH_NG_SOCKETVAR_H_ */

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 8, 8:37 PM (22 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14542325
Default Alt Text
D23850.diff (4 KB)

Event Timeline