[BUG] was (re: [PATCH 1/2] main: Accept interface names as a parameter)
Sam Tannous
stannous at cumulusnetworks.com
Fri Nov 4 13:31:17 PDT 2016
Hi Tim, Jouni,
When using -i to specify one or more comma seperated interfaces
(that all use the same config file), I think we also need to change
the loop parameters
(interface.count) so that all the interfaces get initialized:
Around line 806 in hostapd/main.c, with two or more interfaces
defined, we still have interfaces.count = 1 so that every interface
*after* the first one is ignored. (Perhaps just looping over
if_names_size is sufficient if it is non-zero.)
/* Allocate and parse configuration for full interface files */
for (i = 0; i < interfaces.count; i++) {
char *if_name = NULL;
if (i < if_names_size)
if_name = if_names[i];
------------------------
(gdb) b main.c:758
Breakpoint 1 at 0xc73a: file main.c, line 758.
(gdb) run -i swp4,swp54s0,swp33 /etc/hostapd.conf
Starting program: /usr/sbin/hostapd -i swp4,swp54s0,swp33 /etc/hostapd.conf
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Breakpoint 1, main (argc=4, argv=0x7fffffffe668) at main.c:759
759 interfaces.count = argc - optind;
(gdb) l
754 return -1;
755 }
756 }
757 #endif /* CONFIG_DEBUG_LINUX_TRACING */
758
759 interfaces.count = argc - optind;
760 if (interfaces.count || num_bss_configs) {
761 interfaces.iface = os_calloc(interfaces.count + num_bss_configs,
762 sizeof(struct hostapd_iface *));
763 if (interfaces.iface == NULL) {
(gdb) p if_names_size
$1 = 3
(gdb) n
760 if (interfaces.count || num_bss_configs) {
(gdb) p interfaces.count
$2 = 1
(gdb) p num_bss_configs
$3 = 0
(gdb) b 792
Breakpoint 2 at 0x555555560850: file main.c, line 792.
(gdb) cont
Continuing.
Breakpoint 2, main (argc=4, argv=0x7fffffffe668) at main.c:792
792 if (i < if_names_size)
(gdb) p i
$4 = 0
(gdb) p if_names_size
$5 = 3
(gdb) n
793 if_name = if_names[i];
(gdb) n
795 interfaces.iface[i] = hostapd_interface_init(&interfaces,
(gdb) p interfaces.count
$6 = 1
--
Sam Tannous
More information about the Hostap
mailing list