Compare commits
	
		
			2 Commits
		
	
	
		
			89e7e61e1d
			...
			190c94ded4
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 190c94ded4 | |||
| 4fe2bae7f7 | 
@ -1,35 +0,0 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
					 | 
				
			||||||
<CodeLite_Workspace Name="actube" Database="">
 | 
					 | 
				
			||||||
  <Project Name="ac" Path="ac.project" Active="No"/>
 | 
					 | 
				
			||||||
  <Project Name="wtp" Path="wtp.project" Active="No"/>
 | 
					 | 
				
			||||||
  <Project Name="mod_cipwap" Path="mod_cipwap.project" Active="No"/>
 | 
					 | 
				
			||||||
  <Project Name="mod_capwap" Path="mod_capwap.project" Active="No"/>
 | 
					 | 
				
			||||||
  <Project Name="mod_cisco" Path="mod_cisco.project" Active="Yes"/>
 | 
					 | 
				
			||||||
  <Project Name="libcw" Path="libcw.project" Active="No"/>
 | 
					 | 
				
			||||||
  <Project Name="mod_capwap80211" Path="mod_capwap80211.project" Active="No"/>
 | 
					 | 
				
			||||||
  <Project Name="mod_fortinet" Path="mod_fortinet.project" Active="No"/>
 | 
					 | 
				
			||||||
  <BuildMatrix>
 | 
					 | 
				
			||||||
    <WorkspaceConfiguration Name="Debug" Selected="yes">
 | 
					 | 
				
			||||||
      <Environment/>
 | 
					 | 
				
			||||||
      <Project Name="ac" ConfigName="Debug"/>
 | 
					 | 
				
			||||||
      <Project Name="wtp" ConfigName="Debug"/>
 | 
					 | 
				
			||||||
      <Project Name="mod_cipwap" ConfigName="Debug"/>
 | 
					 | 
				
			||||||
      <Project Name="mod_capwap" ConfigName="Debug"/>
 | 
					 | 
				
			||||||
      <Project Name="mod_cisco" ConfigName="Debug"/>
 | 
					 | 
				
			||||||
      <Project Name="libcw" ConfigName="Debug"/>
 | 
					 | 
				
			||||||
      <Project Name="mod_capwap80211" ConfigName="Debug"/>
 | 
					 | 
				
			||||||
      <Project Name="mod_fortinet" ConfigName="Debug"/>
 | 
					 | 
				
			||||||
    </WorkspaceConfiguration>
 | 
					 | 
				
			||||||
    <WorkspaceConfiguration Name="Release" Selected="yes">
 | 
					 | 
				
			||||||
      <Environment/>
 | 
					 | 
				
			||||||
      <Project Name="ac" ConfigName="Release"/>
 | 
					 | 
				
			||||||
      <Project Name="wtp" ConfigName="Release"/>
 | 
					 | 
				
			||||||
      <Project Name="mod_cipwap" ConfigName="Release"/>
 | 
					 | 
				
			||||||
      <Project Name="mod_capwap" ConfigName="Release"/>
 | 
					 | 
				
			||||||
      <Project Name="mod_cisco" ConfigName="Release"/>
 | 
					 | 
				
			||||||
      <Project Name="libcw" ConfigName="Release"/>
 | 
					 | 
				
			||||||
      <Project Name="mod_capwap80211" ConfigName="Release"/>
 | 
					 | 
				
			||||||
      <Project Name="mod_fortinet" ConfigName="Release"/>
 | 
					 | 
				
			||||||
    </WorkspaceConfiguration>
 | 
					 | 
				
			||||||
  </BuildMatrix>
 | 
					 | 
				
			||||||
</CodeLite_Workspace>
 | 
					 | 
				
			||||||
							
								
								
									
										19
									
								
								src/cw/cfg.c
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								src/cw/cfg.c
									
									
									
									
									
								
							@ -154,7 +154,6 @@ const char *cw_cfg_get_l(cw_Cfg_t ** cfg, const char * key, const char *def)
 | 
				
			|||||||
	int i;
 | 
						int i;
 | 
				
			||||||
	struct cw_Cfg_entry e, *r;
 | 
						struct cw_Cfg_entry e, *r;
 | 
				
			||||||
	for(i=0; cfg[i]!=NULL; i++){
 | 
						for(i=0; cfg[i]!=NULL; i++){
 | 
				
			||||||
//		cw_dbg(DBG_X,"GET_L IN: %p",cfg[i]);
 | 
					 | 
				
			||||||
		e.key = key;
 | 
							e.key = key;
 | 
				
			||||||
		r = mavl_get(cfg[i]->cfg, &e);
 | 
							r = mavl_get(cfg[i]->cfg, &e);
 | 
				
			||||||
		if (r!=NULL)
 | 
							if (r!=NULL)
 | 
				
			||||||
@ -177,11 +176,29 @@ bstr16_t cw_cfg_get_bstr16(cw_Cfg_t * cfg, const char * key, const char *def)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	s = cw_cfg_get(cfg,key,def);
 | 
						s = cw_cfg_get(cfg,key,def);
 | 
				
			||||||
	if(s==NULL)
 | 
						if(s==NULL)
 | 
				
			||||||
 | 
							s=def;
 | 
				
			||||||
 | 
						if (s==NULL)
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return bstr16_create_from_str(s);
 | 
						return bstr16_create_from_str(s);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bstr16_t cw_cfg_get_bstr16_l(cw_Cfg_t **cfgs, const char * key, const char *def)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						bstr16_t s;
 | 
				
			||||||
 | 
						int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for(i=0; cfgs[i]!=NULL; i++){
 | 
				
			||||||
 | 
							s = cw_cfg_get_bstr16(cfgs[i],key,NULL);
 | 
				
			||||||
 | 
							if (s!=NULL)
 | 
				
			||||||
 | 
								return s;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if (def == NULL)
 | 
				
			||||||
 | 
							return NULL;
 | 
				
			||||||
 | 
						return bstr16_create_from_str(def);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int cw_cfg_set_bstr16(cw_Cfg_t * cfg, const char * key, bstr16_t str)
 | 
					int cw_cfg_set_bstr16(cw_Cfg_t * cfg, const char * key, bstr16_t str)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	CW_TYPE_BSTR16->read(cfg,key,bstr16_data(str),bstr16_len(str),NULL);
 | 
						CW_TYPE_BSTR16->read(cfg,key,bstr16_data(str),bstr16_len(str),NULL);
 | 
				
			||||||
 | 
				
			|||||||
@ -93,6 +93,7 @@ int cw_cfg_get_first_index_l(cw_Cfg_t ** cfgs, const char *key, int n);
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int cw_cfg_set_val(cw_Cfg_t * cfg, const char *key, const struct cw_Type *t, const void * valguard, const uint8_t * data, int len);
 | 
					int cw_cfg_set_val(cw_Cfg_t * cfg, const char *key, const struct cw_Type *t, const void * valguard, const uint8_t * data, int len);
 | 
				
			||||||
 | 
					bstr16_t cw_cfg_get_bstr16_l(cw_Cfg_t **cfgs, const char * key, const char *def);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define cw_cfg_get_word2(cfg1,cfg2,key,def) \
 | 
					#define cw_cfg_get_word2(cfg1,cfg2,key,def) \
 | 
				
			||||||
	cw_cfg_get_word(cfg1,key,cw_cfg_get_word(cfg2,key,def))
 | 
						cw_cfg_get_word(cfg1,key,cw_cfg_get_word(cfg2,key,def))
 | 
				
			||||||
 | 
				
			|||||||
@ -8,24 +8,19 @@
 | 
				
			|||||||
int cw_write_descriptor_subelem (uint8_t *dst, cw_Cfg_t ** cfg_list,
 | 
					int cw_write_descriptor_subelem (uint8_t *dst, cw_Cfg_t ** cfg_list,
 | 
				
			||||||
                                 int subelem_id, const char * parent_key )
 | 
					                                 int subelem_id, const char * parent_key )
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	char key[256];
 | 
						char key[CW_CFG_MAX_KEY_LEN];
 | 
				
			||||||
	uint32_t vendor;
 | 
						uint32_t vendor;
 | 
				
			||||||
	//bstr16_t version;
 | 
						bstr16_t version;
 | 
				
			||||||
	const char *vendor_s;
 | 
						const char *vendor_s;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	uint8_t *d;
 | 
						uint8_t *d;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*        d += cw_put_dword(d, bstrv_get_vendor_id(v));
 | 
					 | 
				
			||||||
	d += cw_put_dword(d, (subelem_id << 16) | bstrv_len(v));
 | 
					 | 
				
			||||||
	d += cw_put_data(d, bstrv_data(v), bstrv_len(v));
 | 
					 | 
				
			||||||
	*/
 | 
					 | 
				
			||||||
	sprintf (key, "%s/%s", parent_key, CW_SKEY_VENDOR);
 | 
						sprintf (key, "%s/%s", parent_key, CW_SKEY_VENDOR);
 | 
				
			||||||
	vendor_s = cw_cfg_get_l (cfg_list, key, NULL);
 | 
						vendor_s = cw_cfg_get_l (cfg_list, key, NULL);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	if (vendor_s == NULL) {
 | 
						if (vendor_s == NULL) {
 | 
				
			||||||
		cw_log (LOG_ERR, "Can't put subelem %s, no value of type Dword found.", key);
 | 
							cw_log (LOG_ERR, "Can't put subelem %s, no value of type found.", key);
 | 
				
			||||||
		return 0;
 | 
							vendor_s = "0";
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	vendor = atoi(vendor_s);	
 | 
						vendor = atoi(vendor_s);	
 | 
				
			||||||
@ -33,12 +28,13 @@ int cw_write_descriptor_subelem (uint8_t *dst, cw_Cfg_t ** cfg_list,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	sprintf (key, "%s/%s", parent_key, CW_SKEY_VERSION);
 | 
						sprintf (key, "%s/%s", parent_key, CW_SKEY_VERSION);
 | 
				
			||||||
	cw_Val_t * val = cw_cfg_get_val_l(cfg_list, key, CW_TYPE_BSTR16);
 | 
					//	cw_Val_t * val = cw_cfg_get_val_l(cfg_list, key, CW_TYPE_BSTR16);
 | 
				
			||||||
 | 
						version = cw_cfg_get_bstr16_l(cfg_list,key,NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	//version = cw_cfg_get_bstr16 (cfg, key, NULL);
 | 
						//version = cw_cfg_get_bstr16 (cfg, key, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (val == NULL) {
 | 
						if (version == NULL) {
 | 
				
			||||||
		cw_log (LOG_ERR, "Can't put subelem %s, no value of type Bstr16 found.", key);
 | 
							cw_log (LOG_ERR, "Can't put subelem %s, no value of type Bstr16 found.", key);
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@ -49,14 +45,10 @@ int cw_write_descriptor_subelem (uint8_t *dst, cw_Cfg_t ** cfg_list,
 | 
				
			|||||||
	d += cw_put_dword(d, vendor); //->type->put (vendor, d);
 | 
						d += cw_put_dword(d, vendor); //->type->put (vendor, d);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	/* put version */
 | 
						/* put version */
 | 
				
			||||||
 | 
						d += cw_put_dword (d, (subelem_id << 16) | bstr16_len(version));
 | 
				
			||||||
 | 
						d += cw_put_bstr16(d, version);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	d += cw_put_dword (d, (subelem_id << 16) | val->type->len(val));
 | 
						free(version);
 | 
				
			||||||
//	d += cw_put_bstr16(d, version);
 | 
					 | 
				
			||||||
	d += val->type->put(val,d);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	cw_val_destroy(val);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
//	free(version);
 | 
					 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	return d-dst;
 | 
						return d-dst;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,242 +0,0 @@
 | 
				
			|||||||
 | 
					 | 
				
			||||||
#include <stdlib.h>
 | 
					 | 
				
			||||||
#include <string.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <sys/socket.h>
 | 
					 | 
				
			||||||
#include <sys/types.h>
 | 
					 | 
				
			||||||
#include <arpa/inet.h>
 | 
					 | 
				
			||||||
#include <ifaddrs.h>
 | 
					 | 
				
			||||||
#include <net/if.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <uci.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "cw/capwap.h"
 | 
					 | 
				
			||||||
#include "cw/log.h"
 | 
					 | 
				
			||||||
#include "wtp_conf.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "cw/log.h"
 | 
					 | 
				
			||||||
#include "cw/dbg.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "cw/bstr.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static struct uci_section  * get_anon_section(struct uci_package * pkg, const char *type)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	struct uci_element * e;
 | 
					 | 
				
			||||||
	struct uci_list * l = &pkg->sections;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	uci_foreach_element(l,e){
 | 
					 | 
				
			||||||
		struct uci_section *s = (struct uci_section*)e;
 | 
					 | 
				
			||||||
		if (!s->anonymous)
 | 
					 | 
				
			||||||
			continue;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		if (strcmp(s->type,type)==0){
 | 
					 | 
				
			||||||
			return s;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	return NULL;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void set_dbg_opt(struct uci_context *ctx,struct uci_section * section,int opt,const char * optstr)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	const char *str = uci_lookup_option_string(ctx,section,optstr);
 | 
					 | 
				
			||||||
	if (!str){
 | 
					 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if ((strcmp(str,"1")==0) || (strcmp(str,"true")==0))
 | 
					 | 
				
			||||||
		//conf_dbg_level |= opt;
 | 
					 | 
				
			||||||
		cw_dbg_set_level(opt,1);
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	if ((strcmp(str,"0")==0) || (strcmp(str,"false")==0))
 | 
					 | 
				
			||||||
		cw_dbg_set_level(opt,0);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void read_dbg_options(struct uci_context *ctx, struct uci_section *section)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        int i;
 | 
					 | 
				
			||||||
        for (i=0; cw_dbg_strings[i].id!=CW_STR_STOP; i++) {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		set_dbg_opt(ctx,section,cw_dbg_strings[i].id,cw_dbg_strings[i].str);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void read_timers(struct uci_context *ctx,struct uci_section *section)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
        int i;
 | 
					 | 
				
			||||||
        for (i=0; conf_timer_cfgstrs[i].name; i++) {
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		const char *str = uci_lookup_option_string(ctx,section,conf_timer_cfgstrs[i].name);
 | 
					 | 
				
			||||||
		if ( str ) {
 | 
					 | 
				
			||||||
			*(conf_timer_cfgstrs[i].value)=atol(str);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int read_config(const char * filename){
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	struct uci_context * ctx;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	ctx = uci_alloc_context();
 | 
					 | 
				
			||||||
	if (!ctx){
 | 
					 | 
				
			||||||
		cw_log(LOG_ERR,"Fatal: Can't create uci ctx, can't read config file");
 | 
					 | 
				
			||||||
		return 0;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	struct uci_package * pkg;
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	if (filename == NULL){
 | 
					 | 
				
			||||||
		filename = "wtp_uci.conf";
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	cw_dbg(DBG_INFO,"Reading config file %s",filename);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	int rc = uci_load(ctx, filename, &pkg );
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (rc == UCI_ERR_NOTFOUND){
 | 
					 | 
				
			||||||
		cw_log(LOG_INFO,"Config file '%s' not found, running without config",filename);
 | 
					 | 
				
			||||||
		return 1;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	if (rc) {
 | 
					 | 
				
			||||||
		char * errstr; 
 | 
					 | 
				
			||||||
		uci_get_errorstr(ctx, &errstr, "");
 | 
					 | 
				
			||||||
		cw_log(LOG_ERR,"Fatal: Can't read config file: %s",errstr);
 | 
					 | 
				
			||||||
		return 0;
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	struct uci_section * section;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	section  = get_anon_section(pkg,"dbg");
 | 
					 | 
				
			||||||
	read_dbg_options(ctx,section);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	section = get_anon_section(pkg,"wtp");
 | 
					 | 
				
			||||||
	if (!section) {
 | 
					 | 
				
			||||||
		cw_dbg(DBG_INFO,"No 'wtp' section found, running without config");
 | 
					 | 
				
			||||||
		return 1;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	read_timers(ctx,section);
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	const char  *str;
 | 
					 | 
				
			||||||
	str = uci_lookup_option_string(ctx,section,"name");
 | 
					 | 
				
			||||||
	if (str)
 | 
					 | 
				
			||||||
		conf_wtpname = strdup(str);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	str = uci_lookup_option_string(ctx,section,"mtu");
 | 
					 | 
				
			||||||
	if (str)
 | 
					 | 
				
			||||||
		conf_mtu = atoi(str);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	str = uci_lookup_option_string(ctx,section,"mtu_discovery");
 | 
					 | 
				
			||||||
	if (str)
 | 
					 | 
				
			||||||
		conf_mtu_discovery = atoi(str);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	str = uci_lookup_option_string(ctx,section,"interface");
 | 
					 | 
				
			||||||
	if (str) 
 | 
					 | 
				
			||||||
		conf_primary_if=strdup(str);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	str = uci_lookup_option_string(ctx,section,"ip");
 | 
					 | 
				
			||||||
	if (str) 
 | 
					 | 
				
			||||||
		conf_ip=strdup(str);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	str = uci_lookup_option_string(ctx,section,"ssl_key");
 | 
					 | 
				
			||||||
	if (str) 
 | 
					 | 
				
			||||||
		conf_sslkeyfilename=strdup(str);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	str = uci_lookup_option_string(ctx,section,"ssl_cert");
 | 
					 | 
				
			||||||
	if (str) 
 | 
					 | 
				
			||||||
		conf_sslcertfilename=strdup(str);
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	str = uci_lookup_option_string(ctx,section,"dtls_psk");
 | 
					 | 
				
			||||||
	if (str)
 | 
					 | 
				
			||||||
		conf_dtls_psk=strdup(str);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	str = uci_lookup_option_string(ctx,section,"ssl_cipher");
 | 
					 | 
				
			||||||
	if (str) 
 | 
					 | 
				
			||||||
		conf_dtls_cipher=strdup(str);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	str = uci_lookup_option_string(ctx,section,"vendor_id");
 | 
					 | 
				
			||||||
	if (str) 
 | 
					 | 
				
			||||||
		conf_vendor_id=atoi(str);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	str = uci_lookup_option_string(ctx,section,"echo_interval");
 | 
					 | 
				
			||||||
	if (str) 
 | 
					 | 
				
			||||||
		conf_echo_interval=atoi(str);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	str = uci_lookup_option_string(ctx,section,"software_version");
 | 
					 | 
				
			||||||
	if (str){
 | 
					 | 
				
			||||||
		uint8_t * s = bstr16_create_from_cfgstr(str);
 | 
					 | 
				
			||||||
		bstr16_replace(&conf_software_version,s);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	str = uci_lookup_option_string(ctx,section,"hardware_version");
 | 
					 | 
				
			||||||
	if (str){
 | 
					 | 
				
			||||||
		uint8_t * s = bstr16_create_from_cfgstr(str);
 | 
					 | 
				
			||||||
		bstr16_replace(&conf_hardware_version,s);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	str = uci_lookup_option_string(ctx,section,"bootloader_version");
 | 
					 | 
				
			||||||
	if (str){
 | 
					 | 
				
			||||||
		uint8_t * s = bstr16_create_from_cfgstr(str);
 | 
					 | 
				
			||||||
		bstr16_replace(&conf_bootloader_version,s);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	str = uci_lookup_option_string(ctx,section,"board_id");
 | 
					 | 
				
			||||||
	if (str){
 | 
					 | 
				
			||||||
		uint8_t * s = bstr16_create_from_cfgstr(str);
 | 
					 | 
				
			||||||
		bstr16_replace(&conf_board_id,s);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	str = uci_lookup_option_string(ctx,section,"board_revision");
 | 
					 | 
				
			||||||
	if (str){
 | 
					 | 
				
			||||||
		uint8_t * s = bstr16_create_from_cfgstr(str);
 | 
					 | 
				
			||||||
		bstr16_replace(&conf_board_revision,s);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	str = uci_lookup_option_string(ctx,section,"serial_no");
 | 
					 | 
				
			||||||
	if (str){
 | 
					 | 
				
			||||||
		uint8_t * s = bstr16_create_from_cfgstr(str);
 | 
					 | 
				
			||||||
		bstr16_replace(&conf_serial_no,s);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	str = uci_lookup_option_string(ctx,section,"model_no");
 | 
					 | 
				
			||||||
	if (str){
 | 
					 | 
				
			||||||
		uint8_t * s = bstr16_create_from_cfgstr(str);
 | 
					 | 
				
			||||||
		bstr16_replace(&conf_model_no,s);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	return 1;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@ -1,75 +0,0 @@
 | 
				
			|||||||
#default configuration file for wpt 
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
config 'wtp'
 | 
					 | 
				
			||||||
	# WTP name 
 | 
					 | 
				
			||||||
	# (default is empty, the WTP will
 | 
					 | 
				
			||||||
	# create a random name)
 | 
					 | 
				
			||||||
	option name			
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	# MTU
 | 
					 | 
				
			||||||
	option mtu		1500
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	# Do MTU discovery (means append mtu discovery
 | 
					 | 
				
			||||||
	# padding msg element when sendig discovery requests)
 | 
					 | 
				
			||||||
	option mtu_discovery	1
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	# SSL certificate and key
 | 
					 | 
				
			||||||
	# (default is empty, you have to specify one)
 | 
					 | 
				
			||||||
	option ssl_cert
 | 
					 | 
				
			||||||
	option ssl_key
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	# DTSL pre-shared key
 | 
					 | 
				
			||||||
	option dtls_psk
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	# ciphers
 | 
					 | 
				
			||||||
	# 
 | 
					 | 
				
			||||||
	option ssl_cipher
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	# vendor id
 | 
					 | 
				
			||||||
	# set the vendor id as integer value
 | 
					 | 
				
			||||||
	# default is gnu
 | 
					 | 
				
			||||||
	option vendor_id
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	option max_discovery_interval	30
 | 
					 | 
				
			||||||
	option discovery_interval	5
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	# capwap mode
 | 
					 | 
				
			||||||
	# possible values: capwap, cisco
 | 
					 | 
				
			||||||
	# default is "capwap"
 | 
					 | 
				
			||||||
	option	capwap_mode	"capwap"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	# bindings mode
 | 
					 | 
				
			||||||
	# possible values: capwpa80211, cisco
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	# interface
 | 
					 | 
				
			||||||
	# Interface to use as primary interface
 | 
					 | 
				
			||||||
	# Default: wtp tries to determine the primary interface
 | 
					 | 
				
			||||||
	# by itself.
 | 
					 | 
				
			||||||
	option interface
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	# ip
 | 
					 | 
				
			||||||
	# IP address to use as 
 | 
					 | 
				
			||||||
	option ip
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
config 'dbg'
 | 
					 | 
				
			||||||
	# debug options 
 | 
					 | 
				
			||||||
	option info		0
 | 
					 | 
				
			||||||
	option dtls		0
 | 
					 | 
				
			||||||
	option dtls_detail	0
 | 
					 | 
				
			||||||
	option dtls_bio		0
 | 
					 | 
				
			||||||
	option dtls_bio_dmp	0
 | 
					 | 
				
			||||||
	option pkt_in		0
 | 
					 | 
				
			||||||
	option pkt_out		0
 | 
					 | 
				
			||||||
	option pkt_err		0
 | 
					 | 
				
			||||||
	option msg_in		0
 | 
					 | 
				
			||||||
	option msg_out		0	
 | 
					 | 
				
			||||||
	option msg_err		0
 | 
					 | 
				
			||||||
	option elem		0
 | 
					 | 
				
			||||||
	option elem_err		0
 | 
					 | 
				
			||||||
	option elem_dmp		0
 | 
					 | 
				
			||||||
	option rfc		0
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		Reference in New Issue
	
	Block a user