From f036d4081d9d044f98aa1db0907a5520b6de2e13 Mon Sep 17 00:00:00 2001 From: Julian Elischer Date: Fri, 20 Aug 2004 01:24:23 +0000 Subject: [PATCH] Align netgraph message fields ready for 64-bit (and 128 bit :-) machines. requires a recompile of netgraph users. Also change the size of a field in the bluetooth code that was waiting for the next change that needed recompiles so it could piggyback its way in. Submitted by: jdp, maksim MFC after: 2 days --- UPDATING | 7 +++++++ sys/netgraph/bluetooth/include/ng_btsocket.h | 7 +------ sys/netgraph/netgraph.h | 2 +- sys/netgraph/ng_message.h | 8 +++++--- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/UPDATING b/UPDATING index 2890ddb6f3ee..2aa5b7a03988 100644 --- a/UPDATING +++ b/UPDATING @@ -21,6 +21,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 5.x IS SLOW: developers choose to disable these features on build machines to maximize performance. +20040819: + Netgraph changed its message format slightly to align the data + portion well on 64 bit machines. + Netgraph using utilities (e.g. ngctl, nghook, ppp, mpd, + pppoed, bluetooth, ATM) should be recompiled when a new kernel + is installed. + 20040817: IPFW has been converted to use PFIL_HOOKS. This change is transparent to userland and preserves the ipfw ABI. The ipfw diff --git a/sys/netgraph/bluetooth/include/ng_btsocket.h b/sys/netgraph/bluetooth/include/ng_btsocket.h index d13c650dd73a..f02b5f7abab5 100644 --- a/sys/netgraph/bluetooth/include/ng_btsocket.h +++ b/sys/netgraph/bluetooth/include/ng_btsocket.h @@ -42,17 +42,12 @@ /* * Bluetooth version of struct sockaddr for raw HCI sockets - * - * XXX: sizeof(hci_node) was NG_NODELEN + 1, but NG_NODESIZ (the equivalent - * of NG_NODELEN + 1) has been bumped to 32. The code currently - * truncates the node name to sizeof(hci_node), although it would be - * possible to correctly handle this by means of the hci_len field. */ struct sockaddr_hci { u_char hci_len; /* total length */ u_char hci_family; /* address family */ - char hci_node[16]; /* address */ + char hci_node[32]; /* address (size == NG_NODESIZ ) */ }; /* Raw HCI socket options */ diff --git a/sys/netgraph/netgraph.h b/sys/netgraph/netgraph.h index b390a4c963d9..8ef9aa624997 100644 --- a/sys/netgraph/netgraph.h +++ b/sys/netgraph/netgraph.h @@ -62,7 +62,7 @@ * Change it for NETGRAPH_DEBUG version so we cannot mix debug and non debug * modules. */ -#define _NG_ABI_VERSION 9 +#define _NG_ABI_VERSION 10 #ifdef NETGRAPH_DEBUG /*----------------------------------------------*/ #define NG_ABI_VERSION (_NG_ABI_VERSION + 0x10000) #else /* NETGRAPH_DEBUG */ /*----------------------------------------------*/ diff --git a/sys/netgraph/ng_message.h b/sys/netgraph/ng_message.h index 715d1148ef2b..a8f42546e10c 100644 --- a/sys/netgraph/ng_message.h +++ b/sys/netgraph/ng_message.h @@ -67,10 +67,11 @@ struct ng_mesg { u_char version; /* == NGM_VERSION */ u_char spare; /* pad to 2 bytes */ u_int16_t arglen; /* length of data */ + u_int32_t cmd; /* command identifier */ u_int32_t flags; /* message status */ + u_int32_t spare2; /* pad to 8 bytes */ u_int32_t token; /* match with reply */ u_int32_t typecookie; /* node's type cookie */ - u_int32_t cmd; /* command identifier */ u_char cmdstr[NG_CMDSTRSIZ]; /* cmd string + \0 */ } header; char data[]; /* placeholder for actual data */ @@ -84,10 +85,11 @@ struct ng_mesg { { "version", &ng_parse_uint8_type }, \ { "spare", &ng_parse_uint8_type }, \ { "arglen", &ng_parse_uint16_type }, \ + { "cmd", &ng_parse_uint32_type }, \ { "flags", &ng_parse_hint32_type }, \ + { "spare2", &ng_parse_uint32_type }, \ { "token", &ng_parse_uint32_type }, \ { "typecookie", &ng_parse_uint32_type }, \ - { "cmd", &ng_parse_uint32_type }, \ { "cmdstr", &ng_parse_cmdbuf_type }, \ { "data", (dtype) }, \ { NULL } \ @@ -98,7 +100,7 @@ struct ng_mesg { * Interfaces within the kernel are defined by a different * value (see NG_ABI_VERSION in netgraph.g) */ -#define NG_VERSION 6 +#define NG_VERSION 7 /* Flags field flags */ #define NGF_ORIG 0x00000000 /* the msg is the original request */