[PATCHv3 4/6] parse untagged/tagged VLANs from config files

Jouni Malinen j
Thu May 9 03:06:34 PDT 2013


On Thu, Apr 11, 2013 at 11:52:42AM +0200, michael-dev at fami-braun.de wrote:
> diff --git a/hostapd/config_file.c b/hostapd/config_file.c
> @@ -33,6 +34,10 @@ static int hostapd_config_read_vlan_file(struct hostapd_bss_config *bss,
>  	char buf[128], *pos, *pos2;
>  	int line = 0, vlan_id;
>  	struct hostapd_vlan *vlan;
> +	struct vlan_info vlan_desc;
> +	#ifdef CONFIG_VLAN_TAGGED
> +	int i;
> +	#endif

#ifdef/#endif without indentation

#endif /* CONFIG_VLAN_TAGGED */

> @@ -60,14 +65,65 @@ static int hostapd_config_read_vlan_file(struct hostapd_bss_config *bss,
...
> +			pos = pos2;
> +			if (vlan_desc.num_tagged > 0) {
> +				vlan_desc.tagged = os_zalloc(sizeof(*vlan_desc.tagged) * vlan_desc.num_tagged);
> +				if (!vlan_desc.tagged) {
> +					wpa_printf(MSG_ERROR, "Out of memory parsing '%s' at "
> +						   "line %d in '%s'", buf, line, fname);
> +					fclose(f);
> +					return -1;
> +				}
> +				for (i=0; i < vlan_desc.num_tagged; i++) {
> +					while (*pos2 != '\0' && *pos2 != ' ' && *pos2 != '\t' && *pos2 != 't')
> +						pos2++;
> +					*pos2 = '\0'; pos2++;

These are getting bit excessive on indentation which is normally a sign
of a helper function being needed to make this readable..

-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the Hostap mailing list