The show command presently sorts things based on last handshake time: https://git.zx2c4.com/wireguard-tools/tree/src/show.c#n27

It sounds like you'd like the output of showconf to be sorted too so that peers have some stable output order; perhaps you have diffing configs in mind?

The kernel will output peers in the order that they were added, iirc. Maybe wireguard-go should do the same?

Alternatively, we could sort this in the showconf code? But then we need some sorting criteria, and people might wish instead for things to match the input order of the original file.

In other words, either showconf sorts, or wireguard-go retains its input order. I think I'd prefer the latter. Do you have a preference?

Jason


On Sat, Feb 15, 2020, 23:42 <mikma.wg@lists.m7n.se> wrote:
Hello,

I have an improvement to IpcGetOperation in wireguard-go.

uapi: IpcGetOperation: return peers in sorted order

Sort peers based on the public key.
The pros of using a sorted peer list is that the order doesn't change in
each ipc operation, or execution of the "wg showconf" command. Which
could be the case previously with an unsorted peer list.

The output from git format-patch is attached. The patch is also
available at
https://cgit.m7n.se/pub/wireguard-go/commit/?id=027bf58651f1a7b2be1bedfde187e5277a13f48e

/Mikael
_______________________________________________
WireGuard mailing list
WireGuard@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/wireguard