Author: marek Date: 2010-01-09 15:43:58 +0100 (Sat, 09 Jan 2010) New Revision: 1541
Modified: trunk/batctl/main.c trunk/batctl/man/batctl.8 trunk/batctl/proc.c trunk/batctl/proc.h Log: batctl: add support for gateway mode
Modified: trunk/batctl/main.c =================================================================== --- trunk/batctl/main.c 2010-01-09 14:43:53 UTC (rev 1540) +++ trunk/batctl/main.c 2010-01-09 14:43:58 UTC (rev 1541) @@ -46,6 +46,8 @@ printf(" \tinterval|it [orig_interval] \tdisplay or modify the originator interval in ms\n"); printf(" \tloglevel|ll [level] \tdisplay or modify the log level\n"); printf(" \tlog|l \tread the log produced by the kernel module\n"); + printf(" \tgw_mode|gw [mode] \tdisplay or modify the gateway mode\n"); + printf(" \tgw_srv_list|gwl \tdisplay the gateway server list\n"); printf(" \ttranslocal|tl \tdisplay the local translation table\n"); printf(" \ttransglobal|tg \tdisplay the global translation table\n"); printf(" \tvis_server|vs [enable|disable] \tdisplay or modify the status of the VIS server\n"); @@ -130,6 +132,14 @@
ret = vis_data(argc - 1, argv + 1);
+ } else if ((strcmp(argv[1], "gw_mode") == 0) || (strcmp(argv[1], "gw") == 0)) { + + ret = handle_proc_setting(argc - 1, argv + 1, PROC_GW_MODE, gw_mode_usage); + + } else if ((strcmp(argv[1], "gw_srv_list") == 0) || (strcmp(argv[1], "gwl") == 0)) { + + ret = handle_table(argc - 1, argv + 1, PROC_GW_SRV_LIST, gw_srv_list_usage); + } else if ((strcmp(argv[1], "aggregation") == 0) || (strcmp(argv[1], "ag") == 0)) {
ret = handle_proc_setting(argc - 1, argv + 1, PROC_AGGR, aggregation_usage);
Modified: trunk/batctl/man/batctl.8 =================================================================== --- trunk/batctl/man/batctl.8 2010-01-09 14:43:53 UTC (rev 1540) +++ trunk/batctl/man/batctl.8 2010-01-09 14:43:58 UTC (rev 1541) @@ -115,6 +115,12 @@ "--no-2nd" or "-2" a dot cluster is not formed around primary and secondary addresses from the same device. .br +.IP "\fBgw_mode|gw [off|client|server]\fP" +If no parameter is given the current gateway mode is displayed otherwise the parameter is used to set the gateway mode. +.br +.IP "\fBgw_srv_list|gwl\fP" +Once started batctl will refresh the displayed gateway server list every second. Use the "-b" option to let batctl display the list only once (useful for scripts). If "-n" was given batctl will not replace the mac addresses with bat-host names in the output. +.br .IP "\fBaggregation\fP|\fBag\fP [\fB1\fP|\fB0\fP]" If no parameter is given the current aggregation setting is displayed. Otherwise the parameter is used to enable or disable packet
Modified: trunk/batctl/proc.c =================================================================== --- trunk/batctl/proc.c 2010-01-09 14:43:53 UTC (rev 1540) +++ trunk/batctl/proc.c 2010-01-09 14:43:58 UTC (rev 1541) @@ -95,6 +95,15 @@ printf(" \t -n don't replace mac addresses with bat-host names\n"); }
+void gw_srv_list_usage(void) +{ + printf("Usage: batctl [options] gw_srv_list \n"); + printf("options:\n"); + printf(" \t -b batch mode - read the gateway server list once and quit\n"); + printf(" \t -h print this help\n"); + printf(" \t -n don't replace mac addresses with bat-host names\n"); +} + void orig_interval_usage(void) { printf("Usage: batctl [options] interval \n"); @@ -116,6 +125,13 @@ printf(" \t -h print this help\n"); }
+void gw_mode_usage(void) +{ + printf("Usage: batctl [options] gw_mode [mode]\n"); + printf("options:\n"); + printf(" \t -h print this help\n"); +} + int handle_table(int argc, char **argv, char *file_path, void table_usage(void)) { int optchar, read_opt = CLR_CONT_READ | USE_BAT_HOSTS;
Modified: trunk/batctl/proc.h =================================================================== --- trunk/batctl/proc.h 2010-01-09 14:43:53 UTC (rev 1540) +++ trunk/batctl/proc.h 2010-01-09 14:43:58 UTC (rev 1541) @@ -19,20 +19,18 @@ * */
- - #define PROC_ROOT_PATH "/proc/net/batman-adv/" #define PROC_INTERFACES "interfaces" #define PROC_ORIGINATORS "originators" #define PROC_ORIG_INTERVAL "orig_interval" -#define PROC_GATEWAYS "gateways" #define PROC_TRANSTABLE_LOCAL "transtable_local" #define PROC_TRANSTABLE_GLOBAL "transtable_global" #define PROC_VIS_SERVER "vis_server" #define PROC_VIS_DATA "vis_data" #define PROC_AGGR "aggregate_ogm" +#define PROC_GW_MODE "gateway_mode" +#define PROC_GW_SRV_LIST "gateway_srv_list"
- int interface(int argc, char **argv);
void originators_usage(void); @@ -41,5 +39,7 @@ void orig_interval_usage(void); void vis_server_usage(void); void aggregation_usage(void); +void gw_mode_usage(void); +void gw_srv_list_usage(void); int handle_table(int argc, char **argv, char *file_path, void table_usage(void)); int handle_proc_setting(int argc, char **argv, char *file_path, void setting_usage(void));