01d00bc035
It's good to have SPDX identifiers in all files as the Linux kernel developers are working to add these identifiers to all files. Update all files with the correct SPDX license identifier based on the license text of the project or based on the license in the file itself. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Modified-by: Jason A. Donenfeld <Jason@zx2c4.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
40 lines
1.4 KiB
C
40 lines
1.4 KiB
C
/* SPDX-License-Identifier: GPL-2.0
|
|
*
|
|
* Copyright (C) 2015-2017 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
|
|
*/
|
|
|
|
struct def {
|
|
const char *name;
|
|
long long value;
|
|
};
|
|
extern const struct def defs[];
|
|
|
|
#ifdef __KERNEL__
|
|
#include "../../../src/device.h"
|
|
#include "../../../src/peer.h"
|
|
#include "../../../src/noise.h"
|
|
const struct def defs[] = {
|
|
{ "SOCK_DEVICE_OFFSET", offsetof(struct sock, sk_user_data) },
|
|
{ "DEVICE_NAME_OFFSET", -ALIGN(sizeof(struct net_device), NETDEV_ALIGN) + offsetof(struct net_device, name) },
|
|
{ "IFNAMSIZ", IFNAMSIZ },
|
|
{ "DEVICE_PEERS_OFFSET", offsetof(struct wireguard_device, peer_list) },
|
|
{ "PEERS_PEER_OFFSET", -offsetof(struct wireguard_peer, peer_list) },
|
|
{ "PEER_CURRENTKEY_OFFSET", offsetof(struct wireguard_peer, keypairs.current_keypair) },
|
|
{ "PEER_PREVIOUSKEY_OFFSET", offsetof(struct wireguard_peer, keypairs.previous_keypair) },
|
|
{ "PEER_NEXTKEY_OFFSET", offsetof(struct wireguard_peer, keypairs.next_keypair) },
|
|
{ "KEY_LOCALID_OFFSET", offsetof(struct noise_keypair, entry.index) },
|
|
{ "KEY_REMOTEID_OFFSET", offsetof(struct noise_keypair, remote_index) },
|
|
{ "KEY_SENDING_OFFSET", offsetof(struct noise_keypair, sending.key) },
|
|
{ "KEY_RECEIVING_OFFSET", offsetof(struct noise_keypair, receiving.key) },
|
|
{ NULL, 0 }
|
|
};
|
|
#else
|
|
#include <stdio.h>
|
|
int main(int argc, char *argv[])
|
|
{
|
|
for (const struct def *def = defs; def->name; ++def)
|
|
printf("#define %s %lld\n", def->name, def->value);
|
|
return 0;
|
|
}
|
|
#endif
|