Hello community, here is the log from the commit of package batctl for openSUSE:Factory checked in at 2016-02-12 11:22:34 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/batctl (Old) and /work/SRC/openSUSE:Factory/.batctl.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "batctl" Changes: -------- --- /work/SRC/openSUSE:Factory/batctl/batctl.changes 2015-08-28 08:27:51.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.batctl.new/batctl.changes 2016-02-12 11:22:44.000000000 +0100 @@ -1,0 +2,6 @@ +Wed Feb 10 19:03:07 UTC 2016 - [email protected] + +- Update to version 2016.0 + * No changelog available + +------------------------------------------------------------------- Old: ---- batctl-2015.1.tar.gz New: ---- batctl-2016.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ batctl.spec ++++++ --- /var/tmp/diff_new_pack.DJmOPr/_old 2016-02-12 11:22:45.000000000 +0100 +++ /var/tmp/diff_new_pack.DJmOPr/_new 2016-02-12 11:22:45.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package batctl # -# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2016 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -22,7 +22,7 @@ Name: batctl Summary: B.A.T.M.A.N. advanced control and management tool -Version: 2015.1 +Version: 2016.0 Release: 2 License: GPL-2.0 Group: Productivity/Networking/Other ++++++ batctl-2015.1.tar.gz -> batctl-2016.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/batctl-2015.1/Makefile new/batctl-2016.0/Makefile --- old/batctl-2015.1/Makefile 2015-04-28 20:49:20.000000000 +0200 +++ new/batctl-2016.0/Makefile 2016-01-06 16:45:35.000000000 +0100 @@ -1,7 +1,7 @@ #!/usr/bin/make -f # -*- makefile -*- # -# Copyright (C) 2006-2015 B.A.T.M.A.N. contributors +# Copyright (C) 2006-2016 B.A.T.M.A.N. contributors # # This program is free software; you can redistribute it and/or # modify it under the terms of version 2 of the GNU General Public diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/batctl-2015.1/allocate.h new/batctl-2016.0/allocate.h --- old/batctl-2015.1/allocate.h 2015-04-28 20:49:20.000000000 +0200 +++ new/batctl-2016.0/allocate.h 2016-01-06 16:45:35.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2015 B.A.T.M.A.N. contributors: + * Copyright (C) 2009-2016 B.A.T.M.A.N. contributors: * * Marek Lindner <[email protected]> * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/batctl-2015.1/bat-hosts.c new/batctl-2016.0/bat-hosts.c --- old/batctl-2015.1/bat-hosts.c 2015-04-28 20:49:20.000000000 +0200 +++ new/batctl-2016.0/bat-hosts.c 2016-01-06 16:45:35.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2015 B.A.T.M.A.N. contributors: + * Copyright (C) 2007-2016 B.A.T.M.A.N. contributors: * * Andreas Langer <[email protected]>, Marek Lindner <[email protected]> * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/batctl-2015.1/bat-hosts.h new/batctl-2016.0/bat-hosts.h --- old/batctl-2015.1/bat-hosts.h 2015-04-28 20:49:20.000000000 +0200 +++ new/batctl-2016.0/bat-hosts.h 2016-01-06 16:45:35.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2015 B.A.T.M.A.N. contributors: + * Copyright (C) 2009-2016 B.A.T.M.A.N. contributors: * * Marek Lindner <[email protected]> * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/batctl-2015.1/bisect_iv.c new/batctl-2016.0/bisect_iv.c --- old/batctl-2015.1/bisect_iv.c 2015-04-28 20:49:20.000000000 +0200 +++ new/batctl-2016.0/bisect_iv.c 2016-01-06 16:45:35.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2015 B.A.T.M.A.N. contributors: + * Copyright (C) 2009-2016 B.A.T.M.A.N. contributors: * * Marek Lindner <[email protected]> * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/batctl-2015.1/bisect_iv.h new/batctl-2016.0/bisect_iv.h --- old/batctl-2015.1/bisect_iv.h 2015-04-28 20:49:20.000000000 +0200 +++ new/batctl-2016.0/bisect_iv.h 2016-01-06 16:45:35.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2015 B.A.T.M.A.N. contributors: + * Copyright (C) 2009-2016 B.A.T.M.A.N. contributors: * * Marek Lindner <[email protected]> * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/batctl-2015.1/debug.c new/batctl-2016.0/debug.c --- old/batctl-2015.1/debug.c 2015-04-28 20:49:20.000000000 +0200 +++ new/batctl-2016.0/debug.c 2016-01-06 16:45:35.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2015 B.A.T.M.A.N. contributors: + * Copyright (C) 2009-2016 B.A.T.M.A.N. contributors: * * Marek Lindner <[email protected]> * @@ -31,6 +31,12 @@ const struct debug_table_data batctl_debug_tables[BATCTL_TABLE_NUM] = { { + .opt_long = "neighbors", + .opt_short = "n", + .debugfs_name = "neighbors", + .header_lines = 2, + }, + { .opt_long = "originators", .opt_short = "o", .debugfs_name = "originators", @@ -219,6 +225,20 @@ batctl_debug_tables[debug_table].header_lines); } +int print_routing_algos(void) { + char full_path[MAX_PATH+1]; + char *debugfs_mnt; + + debugfs_mnt = debugfs_mount(NULL); + if (!debugfs_mnt) { + fprintf(stderr, "Error - can't mount or find debugfs\n"); + return -1; + } + + debugfs_make_path(DEBUG_BATIF_PATH_FMT, "", full_path, sizeof(full_path)); + return read_file(full_path, DEBUG_ROUTING_ALGOS, 0, 0, 0, 0); +} + int print_vis_info(char *mesh_iface) { char full_path[MAX_PATH+1]; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/batctl-2015.1/debug.h new/batctl-2016.0/debug.h --- old/batctl-2015.1/debug.h 2015-04-28 20:49:20.000000000 +0200 +++ new/batctl-2016.0/debug.h 2016-01-06 16:45:35.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2015 B.A.T.M.A.N. contributors: + * Copyright (C) 2009-2016 B.A.T.M.A.N. contributors: * * Marek Lindner <[email protected]> * @@ -28,8 +28,10 @@ #define DEBUG_BATIF_PATH_FMT "%s/batman_adv/%s" #define DEBUG_TRANSTABLE_GLOBAL "transtable_global" #define DEBUG_LOG "log" +#define DEBUG_ROUTING_ALGOS "routing_algos" enum batctl_debug_tables { + BATCTL_TABLE_NEIGHBORS, BATCTL_TABLE_ORIGINATORS, BATCTL_TABLE_GATEWAYS, BATCTL_TABLE_TRANSLOCAL, @@ -52,6 +54,7 @@ int handle_debug_table(char *mesh_iface, int debug_table, int argc, char **argv); int log_print(char *mesh_iface, int argc, char **argv); +int print_routing_algos(void); int print_vis_info(char *mesh_iface); #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/batctl-2015.1/debugfs.c new/batctl-2016.0/debugfs.c --- old/batctl-2015.1/debugfs.c 2015-04-28 20:49:20.000000000 +0200 +++ new/batctl-2016.0/debugfs.c 2016-01-06 16:45:35.000000000 +0100 @@ -42,19 +42,12 @@ /* construct a full path to a debugfs element */ int debugfs_make_path(const char *fmt, char *mesh_iface, char *buffer, int size) { - int len; - if (strlen(debugfs_mountpoint) == 0) { buffer[0] = '\0'; return -1; } - len = strlen(debugfs_mountpoint) + strlen(fmt) + 1; - if (len >= size) - return len+1; - - snprintf(buffer, size-1, fmt, debugfs_mountpoint, mesh_iface); - return 0; + return snprintf(buffer, size, fmt, debugfs_mountpoint, mesh_iface); } static int debugfs_found; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/batctl-2015.1/functions.c new/batctl-2016.0/functions.c --- old/batctl-2015.1/functions.c 2015-04-28 20:49:20.000000000 +0200 +++ new/batctl-2016.0/functions.c 2016-01-06 16:45:35.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2015 B.A.T.M.A.N. contributors: + * Copyright (C) 2007-2016 B.A.T.M.A.N. contributors: * * Andreas Langer <[email protected]>, Marek Lindner <[email protected]> * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/batctl-2015.1/functions.h new/batctl-2016.0/functions.h --- old/batctl-2015.1/functions.h 2015-04-28 20:49:20.000000000 +0200 +++ new/batctl-2016.0/functions.h 2016-01-06 16:45:35.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2015 B.A.T.M.A.N. contributors: + * Copyright (C) 2007-2016 B.A.T.M.A.N. contributors: * * Andreas Langer <[email protected]>, Marek Lindner <[email protected]> * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/batctl-2015.1/hash.c new/batctl-2016.0/hash.c --- old/batctl-2015.1/hash.c 2015-04-28 20:49:20.000000000 +0200 +++ new/batctl-2016.0/hash.c 2016-01-06 16:45:35.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006-2015 B.A.T.M.A.N. contributors: + * Copyright (C) 2006-2016 B.A.T.M.A.N. contributors: * * Simon Wunderlich, Marek Lindner * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/batctl-2015.1/hash.h new/batctl-2016.0/hash.h --- old/batctl-2015.1/hash.h 2015-04-28 20:49:20.000000000 +0200 +++ new/batctl-2016.0/hash.h 2016-01-06 16:45:35.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006-2015 B.A.T.M.A.N. contributors: + * Copyright (C) 2006-2016 B.A.T.M.A.N. contributors: * * Simon Wunderlich, Marek Lindner * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/batctl-2015.1/ioctl.c new/batctl-2016.0/ioctl.c --- old/batctl-2015.1/ioctl.c 2015-04-28 20:49:20.000000000 +0200 +++ new/batctl-2016.0/ioctl.c 2016-01-06 16:45:35.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012-2015 B.A.T.M.A.N. contributors: + * Copyright (C) 2012-2016 B.A.T.M.A.N. contributors: * * Marek Lindner <[email protected]> * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/batctl-2015.1/ioctl.h new/batctl-2016.0/ioctl.h --- old/batctl-2015.1/ioctl.h 2015-04-28 20:49:20.000000000 +0200 +++ new/batctl-2016.0/ioctl.h 2016-01-06 16:45:35.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012-2015 B.A.T.M.A.N. contributors: + * Copyright (C) 2012-2016 B.A.T.M.A.N. contributors: * * Marek Lindner <[email protected]> * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/batctl-2015.1/list-batman.c new/batctl-2016.0/list-batman.c --- old/batctl-2015.1/list-batman.c 2015-04-28 20:49:20.000000000 +0200 +++ new/batctl-2016.0/list-batman.c 2016-01-06 16:45:35.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006-2015 B.A.T.M.A.N. contributors: + * Copyright (C) 2006-2016 B.A.T.M.A.N. contributors: * * Marek Lindner * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/batctl-2015.1/list-batman.h new/batctl-2016.0/list-batman.h --- old/batctl-2015.1/list-batman.h 2015-04-28 20:49:20.000000000 +0200 +++ new/batctl-2016.0/list-batman.h 2016-01-06 16:45:35.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006-2015 B.A.T.M.A.N. contributors: + * Copyright (C) 2006-2016 B.A.T.M.A.N. contributors: * * Marek Lindner * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/batctl-2015.1/main.c new/batctl-2016.0/main.c --- old/batctl-2015.1/main.c 2015-04-28 20:49:20.000000000 +0200 +++ new/batctl-2016.0/main.c 2016-01-06 16:45:35.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2015 B.A.T.M.A.N. contributors: + * Copyright (C) 2007-2016 B.A.T.M.A.N. contributors: * * Andreas Langer <[email protected]>, Marek Lindner <[email protected]> * @@ -70,6 +70,7 @@ fprintf(stderr, " \tloglevel|ll [level] \tdisplay or modify the log level\n"); fprintf(stderr, " \tlog|l \tread the log produced by the kernel module\n"); fprintf(stderr, " \tgw_mode|gw [mode] \tdisplay or modify the gateway mode\n"); + fprintf(stderr, " \trouting_algo|ra [mode] \tdisplay or modify the routing algorithm\n"); fprintf(stderr, "\n"); fprintf(stderr, "debug tables: \tdisplay the corresponding debug table\n"); @@ -150,6 +151,10 @@ ret = bisect_iv(argc - 1, argv + 1); #endif + } else if ((strcmp(argv[1], "routing_algo") == 0) || (strcmp(argv[1], "ra") == 0)) { + + ret = handle_ra_setting(argc - 1, argv + 1); + } else if (check_mesh_iface(mesh_iface) < 0) { fprintf(stderr, "Error - interface %s is not present or not a batman-adv interface\n", mesh_iface); exit(EXIT_FAILURE); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/batctl-2015.1/main.h new/batctl-2016.0/main.h --- old/batctl-2015.1/main.h 2015-04-28 20:49:20.000000000 +0200 +++ new/batctl-2016.0/main.h 2016-01-06 16:45:35.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2015 B.A.T.M.A.N. contributors: + * Copyright (C) 2007-2016 B.A.T.M.A.N. contributors: * * Andreas Langer <[email protected]>, Marek Lindner <[email protected]> * @@ -22,8 +22,10 @@ #ifndef _BATCTL_MAIN_H #define _BATCTL_MAIN_H +#include <stdint.h> + #ifndef SOURCE_VERSION -#define SOURCE_VERSION "2015.1" +#define SOURCE_VERSION "2016.0" #endif #define SOCKET_PATH_FMT "%s/batman_adv/%s/socket" @@ -47,6 +49,9 @@ #define __packed __attribute((packed)) /* linux kernel compat */ #define BIT(nr) (1UL << (nr)) /* linux kernel compat */ +typedef uint8_t u8; /* linux kernel compat */ +typedef uint16_t u16; /* linux kernel compat */ + extern char module_ver_path[]; #ifndef VLAN_VID_MASK diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/batctl-2015.1/man/batctl.8 new/batctl-2016.0/man/batctl.8 --- old/batctl-2015.1/man/batctl.8 2015-04-28 20:49:20.000000000 +0200 +++ new/batctl-2016.0/man/batctl.8 2016-01-06 16:45:35.000000000 +0100 @@ -2,7 +2,7 @@ .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) -.TH "BATCTL" "8" "Jan 06, 2013" "Linux" "B.A.T.M.A.N. Advanced Control Tool" +.TH "BATCTL" "8" "July 17, 2015" "Linux" "B.A.T.M.A.N. Advanced Control Tool" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -155,6 +155,12 @@ .RE .RE .br +.IP "\fBrouting_algo\fP|\fBra\fP [\fBalgorithm\fP]\fP" +If no parameter is given the current routing algorithm configuration as well as +supported routing algorithms are displayed. +Otherwise the parameter is used to select the routing algorithm for the following +batX interface to be created. +.br .IP "\fBisolation_mark\fP|\fBmark\fP" If no parameter is given the current isolation mark value is displayed. Otherwise the parameter is used to set or unset the isolation mark used by the @@ -180,7 +186,7 @@ .IP The batman-adv kernel module comes with a variety of debug tables containing various information about the state of the mesh seen by each individual node. These tables are exported via debugfs and easily accessible via batctl. You will need debugfs -support compiled into your kernel and preferrably have mounted the debugfs to a well-known mountpoint. If debugfs is not +support compiled into your kernel and preferably have mounted the debugfs to a well-known mountpoint. If debugfs is not mounted batctl will attempt to do this step for you. All of the debug tables support the following options: @@ -204,6 +210,9 @@ List of debug tables: .RS 10 +\- neighbors|n +.RE +.RS 10 \- originators|o .RE .RS 10 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/batctl-2015.1/packet.h new/batctl-2016.0/packet.h --- old/batctl-2015.1/packet.h 2015-04-28 20:49:20.000000000 +0200 +++ new/batctl-2016.0/packet.h 2016-01-06 16:45:35.000000000 +0100 @@ -1,4 +1,4 @@ -/* Copyright (C) 2007-2015 B.A.T.M.A.N. contributors: +/* Copyright (C) 2007-2016 B.A.T.M.A.N. contributors: * * Marek Lindner, Simon Wunderlich * @@ -72,8 +72,7 @@ * enum batadv_iv_flags - flags used in B.A.T.M.A.N. IV OGM packets * @BATADV_NOT_BEST_NEXT_HOP: flag is set when ogm packet is forwarded and was * previously received from someone else than the best neighbor. - * @BATADV_PRIMARIES_FIRST_HOP: flag is set when the primary interface address - * is used, and the packet travels its first hop. + * @BATADV_PRIMARIES_FIRST_HOP: flag unused. * @BATADV_DIRECTLINK: flag is for the first hop or if rebroadcasted from a * one hop neighbor on the interface where it was originally received. */ @@ -159,7 +158,7 @@ }; /** - * batadv_vlan_flags - flags for the four MSB of any vlan ID field + * enum batadv_vlan_flags - flags for the four MSB of any vlan ID field * @BATADV_VLAN_HAS_TAG: whether the field contains a valid vlan tag or not */ enum batadv_vlan_flags { @@ -197,8 +196,8 @@ * transport the claim type and the group id */ struct batadv_bla_claim_dst { - uint8_t magic[3]; /* FF:43:05 */ - uint8_t type; /* bla_claimframe */ + u8 magic[3]; /* FF:43:05 */ + u8 type; /* bla_claimframe */ __be16 group; /* group id */ }; @@ -210,19 +209,24 @@ * @version: batman-adv protocol version, part of the genereal header * @ttl: time to live for this packet, part of the genereal header * @flags: contains routing relevant flags - see enum batadv_iv_flags + * @seqno: sequence identification + * @orig: address of the source node + * @prev_sender: address of the previous sender + * @reserved: reserved byte for alignment + * @tq: transmission quality * @tvlv_len: length of tvlv data following the ogm header */ struct batadv_ogm_packet { - uint8_t packet_type; - uint8_t version; - uint8_t ttl; - uint8_t flags; - __be32 seqno; - uint8_t orig[ETH_ALEN]; - uint8_t prev_sender[ETH_ALEN]; - uint8_t reserved; - uint8_t tq; - __be16 tvlv_len; + u8 packet_type; + u8 version; + u8 ttl; + u8 flags; + __be32 seqno; + u8 orig[ETH_ALEN]; + u8 prev_sender[ETH_ALEN]; + u8 reserved; + u8 tq; + __be16 tvlv_len; /* __packed is not needed as the struct size is divisible by 4, * and the largest data type in this struct has a size of 4. */ @@ -231,7 +235,7 @@ #define BATADV_OGM_HLEN sizeof(struct batadv_ogm_packet) /** - * batadv_icmp_header - common members among all the ICMP packets + * struct batadv_icmp_header - common members among all the ICMP packets * @packet_type: batman-adv packet type, part of the general header * @version: batman-adv protocol version, part of the genereal header * @ttl: time to live for this packet, part of the genereal header @@ -246,18 +250,18 @@ * members are padded the same way as they are in real packets. */ struct batadv_icmp_header { - uint8_t packet_type; - uint8_t version; - uint8_t ttl; - uint8_t msg_type; /* see ICMP message types above */ - uint8_t dst[ETH_ALEN]; - uint8_t orig[ETH_ALEN]; - uint8_t uid; - uint8_t align[3]; + u8 packet_type; + u8 version; + u8 ttl; + u8 msg_type; /* see ICMP message types above */ + u8 dst[ETH_ALEN]; + u8 orig[ETH_ALEN]; + u8 uid; + u8 align[3]; }; /** - * batadv_icmp_packet - ICMP packet + * struct batadv_icmp_packet - ICMP packet * @packet_type: batman-adv packet type, part of the general header * @version: batman-adv protocol version, part of the genereal header * @ttl: time to live for this packet, part of the genereal header @@ -269,21 +273,21 @@ * @seqno: ICMP sequence number */ struct batadv_icmp_packet { - uint8_t packet_type; - uint8_t version; - uint8_t ttl; - uint8_t msg_type; /* see ICMP message types above */ - uint8_t dst[ETH_ALEN]; - uint8_t orig[ETH_ALEN]; - uint8_t uid; - uint8_t reserved; - __be16 seqno; + u8 packet_type; + u8 version; + u8 ttl; + u8 msg_type; /* see ICMP message types above */ + u8 dst[ETH_ALEN]; + u8 orig[ETH_ALEN]; + u8 uid; + u8 reserved; + __be16 seqno; }; #define BATADV_RR_LEN 16 /** - * batadv_icmp_packet_rr - ICMP RouteRecord packet + * struct batadv_icmp_packet_rr - ICMP RouteRecord packet * @packet_type: batman-adv packet type, part of the general header * @version: batman-adv protocol version, part of the genereal header * @ttl: time to live for this packet, part of the genereal header @@ -296,16 +300,16 @@ * @rr: route record array */ struct batadv_icmp_packet_rr { - uint8_t packet_type; - uint8_t version; - uint8_t ttl; - uint8_t msg_type; /* see ICMP message types above */ - uint8_t dst[ETH_ALEN]; - uint8_t orig[ETH_ALEN]; - uint8_t uid; - uint8_t rr_cur; - __be16 seqno; - uint8_t rr[BATADV_RR_LEN][ETH_ALEN]; + u8 packet_type; + u8 version; + u8 ttl; + u8 msg_type; /* see ICMP message types above */ + u8 dst[ETH_ALEN]; + u8 orig[ETH_ALEN]; + u8 uid; + u8 rr_cur; + __be16 seqno; + u8 rr[BATADV_RR_LEN][ETH_ALEN]; }; #define BATADV_ICMP_MAX_PACKET_SIZE sizeof(struct batadv_icmp_packet_rr) @@ -331,11 +335,11 @@ * @dest: originator destination of the unicast packet */ struct batadv_unicast_packet { - uint8_t packet_type; - uint8_t version; - uint8_t ttl; - uint8_t ttvn; /* destination translation table version number */ - uint8_t dest[ETH_ALEN]; + u8 packet_type; + u8 version; + u8 ttl; + u8 ttvn; /* destination translation table version number */ + u8 dest[ETH_ALEN]; /* "4 bytes boundary + 2 bytes" long to make the payload after the * following ethernet header again 4 bytes boundary aligned */ @@ -346,12 +350,13 @@ * @u: common unicast packet header * @src: address of the source * @subtype: packet subtype + * @reserved: reserved byte for alignment */ struct batadv_unicast_4addr_packet { struct batadv_unicast_packet u; - uint8_t src[ETH_ALEN]; - uint8_t subtype; - uint8_t reserved; + u8 src[ETH_ALEN]; + u8 subtype; + u8 reserved; /* "4 bytes boundary + 2 bytes" long to make the payload after the * following ethernet header again 4 bytes boundary aligned */ @@ -370,22 +375,22 @@ * @total_size: size of the merged packet */ struct batadv_frag_packet { - uint8_t packet_type; - uint8_t version; /* batman version field */ - uint8_t ttl; + u8 packet_type; + u8 version; /* batman version field */ + u8 ttl; #if defined(__BIG_ENDIAN_BITFIELD) - uint8_t no:4; - uint8_t reserved:4; + u8 no:4; + u8 reserved:4; #elif defined(__LITTLE_ENDIAN_BITFIELD) - uint8_t reserved:4; - uint8_t no:4; + u8 reserved:4; + u8 no:4; #else #error "unknown bitfield endianness" #endif - uint8_t dest[ETH_ALEN]; - uint8_t orig[ETH_ALEN]; - __be16 seqno; - __be16 total_size; + u8 dest[ETH_ALEN]; + u8 orig[ETH_ALEN]; + __be16 seqno; + __be16 total_size; }; /** @@ -398,12 +403,12 @@ * @orig: originator of the broadcast packet */ struct batadv_bcast_packet { - uint8_t packet_type; - uint8_t version; /* batman version field */ - uint8_t ttl; - uint8_t reserved; - __be32 seqno; - uint8_t orig[ETH_ALEN]; + u8 packet_type; + u8 version; /* batman version field */ + u8 ttl; + u8 reserved; + __be32 seqno; + u8 orig[ETH_ALEN]; /* "4 bytes boundary + 2 bytes" long to make the payload after the * following ethernet header again 4 bytes boundary aligned */ @@ -414,7 +419,6 @@ * @packet_type: batman-adv packet type, part of the general header * @version: batman-adv protocol version, part of the genereal header * @ttl: time to live for this packet, part of the genereal header - * @reserved: Align following fields to 2-byte boundaries * @first_source: original source of first included packet * @first_orig_dest: original destinal of first included packet * @first_crc: checksum of first included packet @@ -428,21 +432,21 @@ * @coded_len: length of network coded part of the payload */ struct batadv_coded_packet { - uint8_t packet_type; - uint8_t version; /* batman version field */ - uint8_t ttl; - uint8_t first_ttvn; - /* uint8_t first_dest[ETH_ALEN]; - saved in mac header destination */ - uint8_t first_source[ETH_ALEN]; - uint8_t first_orig_dest[ETH_ALEN]; - __be32 first_crc; - uint8_t second_ttl; - uint8_t second_ttvn; - uint8_t second_dest[ETH_ALEN]; - uint8_t second_source[ETH_ALEN]; - uint8_t second_orig_dest[ETH_ALEN]; - __be32 second_crc; - __be16 coded_len; + u8 packet_type; + u8 version; /* batman version field */ + u8 ttl; + u8 first_ttvn; + /* u8 first_dest[ETH_ALEN]; - saved in mac header destination */ + u8 first_source[ETH_ALEN]; + u8 first_orig_dest[ETH_ALEN]; + __be32 first_crc; + u8 second_ttl; + u8 second_ttvn; + u8 second_dest[ETH_ALEN]; + u8 second_source[ETH_ALEN]; + u8 second_orig_dest[ETH_ALEN]; + __be32 second_crc; + __be16 coded_len; }; #pragma pack() @@ -459,14 +463,14 @@ * @align: 2 bytes to align the header to a 4 byte boundary */ struct batadv_unicast_tvlv_packet { - uint8_t packet_type; - uint8_t version; /* batman version field */ - uint8_t ttl; - uint8_t reserved; - uint8_t dst[ETH_ALEN]; - uint8_t src[ETH_ALEN]; - __be16 tvlv_len; - uint16_t align; + u8 packet_type; + u8 version; /* batman version field */ + u8 ttl; + u8 reserved; + u8 dst[ETH_ALEN]; + u8 src[ETH_ALEN]; + __be16 tvlv_len; + u16 align; }; /** @@ -476,9 +480,9 @@ * @len: tvlv container length */ struct batadv_tvlv_hdr { - uint8_t type; - uint8_t version; - __be16 len; + u8 type; + u8 version; + __be16 len; }; /** @@ -496,13 +500,13 @@ * struct batadv_tvlv_tt_data - tt data propagated through the tt tvlv container * @flags: translation table flags (see batadv_tt_data_flags) * @ttvn: translation table version number - * @vlan_num: number of announced VLANs. In the TVLV this struct is followed by + * @num_vlan: number of announced VLANs. In the TVLV this struct is followed by * one batadv_tvlv_tt_vlan_data object per announced vlan */ struct batadv_tvlv_tt_data { - uint8_t flags; - uint8_t ttvn; - __be16 num_vlan; + u8 flags; + u8 ttvn; + __be16 num_vlan; }; /** @@ -513,9 +517,9 @@ * @reserved: unused, useful for alignment purposes */ struct batadv_tvlv_tt_vlan_data { - __be32 crc; - __be16 vid; - uint16_t reserved; + __be32 crc; + __be16 vid; + u16 reserved; }; /** @@ -527,9 +531,9 @@ * @vid: VLAN identifier */ struct batadv_tvlv_tt_change { - uint8_t flags; - uint8_t reserved[3]; - uint8_t addr[ETH_ALEN]; + u8 flags; + u8 reserved[3]; + u8 addr[ETH_ALEN]; __be16 vid; }; @@ -539,7 +543,7 @@ * @vid: VLAN identifier */ struct batadv_tvlv_roam_adv { - uint8_t client[ETH_ALEN]; + u8 client[ETH_ALEN]; __be16 vid; }; @@ -549,8 +553,8 @@ * @reserved: reserved field */ struct batadv_tvlv_mcast_data { - uint8_t flags; - uint8_t reserved[3]; + u8 flags; + u8 reserved[3]; }; #endif /* _NET_BATMAN_ADV_PACKET_H_ */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/batctl-2015.1/ping.c new/batctl-2016.0/ping.c --- old/batctl-2015.1/ping.c 2015-04-28 20:49:20.000000000 +0200 +++ new/batctl-2016.0/ping.c 2016-01-06 16:45:35.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2015 B.A.T.M.A.N. contributors: + * Copyright (C) 2007-2016 B.A.T.M.A.N. contributors: * * Andreas Langer <[email protected]>, Marek Lindner <[email protected]> * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/batctl-2015.1/ping.h new/batctl-2016.0/ping.h --- old/batctl-2015.1/ping.h 2015-04-28 20:49:20.000000000 +0200 +++ new/batctl-2016.0/ping.h 2016-01-06 16:45:35.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2015 B.A.T.M.A.N. contributors: + * Copyright (C) 2009-2016 B.A.T.M.A.N. contributors: * * Marek Lindner <[email protected]> * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/batctl-2015.1/sys.c new/batctl-2016.0/sys.c --- old/batctl-2015.1/sys.c 2015-04-28 20:49:20.000000000 +0200 +++ new/batctl-2016.0/sys.c 2016-01-06 16:45:35.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2015 B.A.T.M.A.N. contributors: + * Copyright (C) 2009-2016 B.A.T.M.A.N. contributors: * * Marek Lindner <[email protected]> * @@ -30,6 +30,7 @@ #include "main.h" #include "sys.h" #include "functions.h" +#include "debug.h" #define PATH_BUFF_LEN 200 @@ -563,6 +564,96 @@ return res; } +static void ra_mode_usage(void) +{ + fprintf(stderr, "Usage: batctl [options] routing_algo [algorithm]\n"); + fprintf(stderr, "options:\n"); + fprintf(stderr, " \t -h print this help\n"); +} + +int handle_ra_setting(int argc, char **argv) +{ + DIR *iface_base_dir; + struct dirent *iface_dir; + int optchar; + char *path_buff; + int res = EXIT_FAILURE; + int first_iface = 1; + + while ((optchar = getopt(argc, argv, "h")) != -1) { + switch (optchar) { + case 'h': + ra_mode_usage(); + return EXIT_SUCCESS; + default: + ra_mode_usage(); + return EXIT_FAILURE; + } + } + + if (argc == 2) { + res = write_file(SYS_SELECTED_RA_PATH, "", argv[1], NULL); + goto out; + } + + path_buff = malloc(PATH_BUFF_LEN); + if (!path_buff) { + fprintf(stderr, "Error - could not allocate path buffer: out of memory ?\n"); + goto out; + } + + iface_base_dir = opendir(SYS_IFACE_PATH); + if (!iface_base_dir) { + fprintf(stderr, "Error - the directory '%s' could not be read: %s\n", + SYS_IFACE_PATH, strerror(errno)); + fprintf(stderr, "Is the batman-adv module loaded and sysfs mounted ?\n"); + goto free_buff; + } + + while ((iface_dir = readdir(iface_base_dir)) != NULL) { + snprintf(path_buff, PATH_BUFF_LEN, SYS_ROUTING_ALGO_FMT, iface_dir->d_name); + res = read_file("", path_buff, USE_READ_BUFF | SILENCE_ERRORS, 0, 0, 0); + if (res != EXIT_SUCCESS) + continue; + + if (line_ptr[strlen(line_ptr) - 1] == '\n') + line_ptr[strlen(line_ptr) - 1] = '\0'; + + if (first_iface) { + first_iface = 0; + printf("Active routing protocol configuration:\n"); + } + + printf(" * %s: %s\n", iface_dir->d_name, line_ptr); + + free(line_ptr); + line_ptr = NULL; + } + + closedir(iface_base_dir); + free(path_buff); + + if (!first_iface) + printf("\n"); + + res = read_file("", SYS_SELECTED_RA_PATH, USE_READ_BUFF, 0, 0, 0); + if (res != EXIT_SUCCESS) + return EXIT_FAILURE; + + printf("Selected routing algorithm (used when next batX interface is created):\n"); + printf(" => %s\n", line_ptr); + free(line_ptr); + line_ptr = NULL; + + print_routing_algos(); + return EXIT_SUCCESS; + +free_buff: + free(path_buff); +out: + return res; +} + int check_mesh_iface(char *mesh_iface) { char *base_dev = NULL; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/batctl-2015.1/sys.h new/batctl-2016.0/sys.h --- old/batctl-2015.1/sys.h 2015-04-28 20:49:20.000000000 +0200 +++ new/batctl-2016.0/sys.h 2016-01-06 16:45:35.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2015 B.A.T.M.A.N. contributors: + * Copyright (C) 2009-2016 B.A.T.M.A.N. contributors: * * Marek Lindner <[email protected]> * @@ -35,6 +35,8 @@ #define SYS_MESH_IFACE_FMT SYS_IFACE_PATH"/%s/batman_adv/mesh_iface" #define SYS_IFACE_STATUS_FMT SYS_IFACE_PATH"/%s/batman_adv/iface_status" #define SYS_VLAN_PATH SYS_IFACE_PATH"/%s/mesh/vlan%d/" +#define SYS_ROUTING_ALGO_FMT SYS_IFACE_PATH"/%s/mesh/routing_algo" +#define SYS_SELECTED_RA_PATH "/sys/module/batman_adv/parameters/routing_algo" #define VLAN_ID_MAX_LEN 4 enum batctl_settings_list { @@ -72,6 +74,7 @@ int handle_loglevel(char *mesh_iface, int argc, char **argv); int handle_sys_setting(char *mesh_iface, int setting, int argc, char **argv); int handle_gw_setting(char *mesh_iface, int argc, char **argv); +int handle_ra_setting(int argc, char **argv); int check_mesh_iface(char *mesh_iface); int check_mesh_iface_ownership(char *mesh_iface, char *hard_iface); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/batctl-2015.1/tcpdump.c new/batctl-2016.0/tcpdump.c --- old/batctl-2015.1/tcpdump.c 2015-04-28 20:49:20.000000000 +0200 +++ new/batctl-2016.0/tcpdump.c 2016-01-06 16:45:35.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2015 B.A.T.M.A.N. contributors: + * Copyright (C) 2007-2016 B.A.T.M.A.N. contributors: * * Andreas Langer <[email protected]> * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/batctl-2015.1/tcpdump.h new/batctl-2016.0/tcpdump.h --- old/batctl-2015.1/tcpdump.h 2015-04-28 20:49:20.000000000 +0200 +++ new/batctl-2016.0/tcpdump.h 2016-01-06 16:45:35.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2015 B.A.T.M.A.N. contributors: + * Copyright (C) 2007-2016 B.A.T.M.A.N. contributors: * * Andreas Langer <[email protected]>, Marek Lindner <[email protected]> * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/batctl-2015.1/traceroute.c new/batctl-2016.0/traceroute.c --- old/batctl-2015.1/traceroute.c 2015-04-28 20:49:20.000000000 +0200 +++ new/batctl-2016.0/traceroute.c 2016-01-06 16:45:35.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2015 B.A.T.M.A.N. contributors: + * Copyright (C) 2007-2016 B.A.T.M.A.N. contributors: * * Andreas Langer <[email protected]>, Marek Lindner <[email protected]> * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/batctl-2015.1/traceroute.h new/batctl-2016.0/traceroute.h --- old/batctl-2015.1/traceroute.h 2015-04-28 20:49:20.000000000 +0200 +++ new/batctl-2016.0/traceroute.h 2016-01-06 16:45:35.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2015 B.A.T.M.A.N. contributors: + * Copyright (C) 2009-2016 B.A.T.M.A.N. contributors: * * Marek Lindner <[email protected]> * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/batctl-2015.1/translate.c new/batctl-2016.0/translate.c --- old/batctl-2015.1/translate.c 2015-04-28 20:49:20.000000000 +0200 +++ new/batctl-2016.0/translate.c 2016-01-06 16:45:35.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2015 B.A.T.M.A.N. contributors: + * Copyright (C) 2007-2016 B.A.T.M.A.N. contributors: * * Andreas Langer <[email protected]>, Marek Lindner <[email protected]> * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/batctl-2015.1/translate.h new/batctl-2016.0/translate.h --- old/batctl-2015.1/translate.h 2015-04-28 20:49:20.000000000 +0200 +++ new/batctl-2016.0/translate.h 2016-01-06 16:45:35.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2015 B.A.T.M.A.N. contributors: + * Copyright (C) 2009-2016 B.A.T.M.A.N. contributors: * * Marek Lindner <[email protected]> *
