Development discussion of WireGuard
 help / color / mirror / Atom feed
From: Kalin KOZHUHAROV <me.kalin@gmail.com>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: WireGuard mailing list <wireguard@lists.zx2c4.com>
Subject: [WireGuard] RFE: A notion of VERSION (was: Debugging AllowedIps)
Date: Mon, 14 Nov 2016 23:34:11 +0900	[thread overview]
Message-ID: <CAKXLc7fZYEejEu0FmATWX6_8aAPRUxkPL429UK-39TGsFF4aUA@mail.gmail.com> (raw)

Hi Jason,

On Mon, Nov 14, 2016 at 11:28 AM, John Huttley <john@mib-infotech.co.nz> wrote:
> RFE: when the module loads and prints its test at startup, please print its
> version and compile flags as well.
>

I second that! There is not (yet) a notion of VERSION in the code,
better not wait till 1.0 to put it :-)

One can use the commit from git, but that assumes always build from git sources.
Examples:
GIT_COMMIT := $(shell git log -n 1 --pretty=format:"%h" HEAD 2>/dev/null)
GIT_TAG := $(shell git tag --points HEAD 2>/dev/null)

( NOTE: GIT_TAG is only available if we have a tag defined at current HEAD, e.g.

$ git checkout bebcae1
HEAD is now at bebcae1... chacha20poly1305: cleanup magic constants

$ git tag --points HEAD
experimental-0.0.20161105
)

I'd rather see a VERSION.txt file, or a `VERSION := 0.0.something`
inside Makefile.

Or even directly hardcoded in main.c:

diff --git a/src/main.c b/src/main.c
index e381d09..4991812 100644
--- a/src/main.c
+++ b/src/main.c
@@ -13,6 +13,9 @@
 #include <linux/module.h>
 #include <net/rtnetlink.h>

+#define DRV_VERSION "0.0.20161105"
+const char wireguard_driver_version[] = DRV_VERSION;
+
 static int __init mod_init(void)
 {
        int ret = 0;
@@ -29,25 +32,31 @@ static int __init mod_init(void)
        chacha20poly1305_init();
        noise_init();

+#ifdef CONFIG_WIREGUARD_PARALLEL
        ret = packet_init_data_caches();
        if (ret < 0)
                return ret;
+#endif

        ret = device_init();
        if (ret < 0) {
+#ifdef CONFIG_WIREGUARD_PARALLEL
                packet_deinit_data_caches();
+#endif
                return ret;
        }

-       pr_info("WireGuard loaded. See www.wireguard.io for information.\n");
-       pr_info("(C) Copyright 2015-2016 Jason A. Donenfeld
<Jason@zx2c4.com>. All Rights Reserved.\n");
+       pr_info("WireGuard %s loaded. See www.wireguard.io for
information.\n", wireguard_driver_version);
+       pr_info("Copyright (c) 2015-2016 Jason A. Donenfeld
<Jason@zx2c4.com>. All rights reserved.\n");
        return ret;
 }

 static void __exit mod_exit(void)
 {
        device_uninit();
+#ifdef CONFIG_WIREGUARD_PARALLEL
        packet_deinit_data_caches();
+#endif
        pr_debug("WireGuard has been unloaded\n");
 }

@@ -57,3 +66,4 @@ MODULE_LICENSE("GPL v2");
 MODULE_DESCRIPTION("Simple, secure, and speedy VPN tunnel");
 MODULE_AUTHOR("Jason A. Donenfeld <Jason@zx2c4.com>");
 MODULE_ALIAS_RTNL_LINK(KBUILD_MODNAME);
+MODULE_VERSION(DRV_VERSION);


Not sure if const char casting is needed (was copying from e1000e driver) ;-/

I changed slightly the Copyright pr_info, actually I guess you should
remove "All  rights reserved." altogether from it (but keep it in the
source).

Cheers,
Kalin.

             reply	other threads:[~2016-11-14 14:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-14 14:34 Kalin KOZHUHAROV [this message]
2016-11-16 17:39 ` Jason A. Donenfeld
2016-11-16 17:40   ` Jason A. Donenfeld
2016-11-16 18:18     ` Kalin KOZHUHAROV
2016-11-16 21:01     ` Daniel Kahn Gillmor
2016-11-16 21:10       ` Jason A. Donenfeld
2016-11-18  5:00         ` Jason A. Donenfeld

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKXLc7fZYEejEu0FmATWX6_8aAPRUxkPL429UK-39TGsFF4aUA@mail.gmail.com \
    --to=me.kalin@gmail.com \
    --cc=Jason@zx2c4.com \
    --cc=wireguard@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).