arch/sim: Change the return type of netdriver_setmacaddr to void

This commit is contained in:
Xiang Xiao 2020-02-10 15:10:38 +08:00 committed by Gregory Nutt
parent 582b2af912
commit 6b1187b402
4 changed files with 13 additions and 22 deletions

View File

@ -354,7 +354,7 @@ void wpcap_send(unsigned char *buf, unsigned int buflen);
#ifdef CONFIG_NET_ETHERNET
int netdriver_init(void);
int netdriver_setmacaddr(unsigned char *macaddr);
void netdriver_setmacaddr(unsigned char *macaddr);
void netdriver_loop(void);
#endif

View File

@ -370,8 +370,7 @@ int netdriver_init(void)
return OK;
}
int netdriver_setmacaddr(unsigned char *macaddr)
void netdriver_setmacaddr(unsigned char *macaddr)
{
memcpy(g_sim_dev.d_mac.ether.ether_addr_octet, macaddr, IFHWADDRLEN);
return 0;
}

View File

@ -88,10 +88,10 @@ struct sel_arg_struct
};
/****************************************************************************
* NuttX Domain Public Function Prototypes
* Public Function Prototypes
****************************************************************************/
int netdriver_setmacaddr(unsigned char *macaddr);
void netdriver_setmacaddr(unsigned char *macaddr);
/****************************************************************************
* Private Data
@ -131,10 +131,9 @@ static inline void dump_ethhdr(const char *msg, unsigned char *buf,
# define dump_ethhdr(m,b,l)
#endif
static int up_setmacaddr(void)
static void set_macaddr(void)
{
unsigned char mac[7];
int ret = -1;
/* Assign a random locally-created MAC address.
*
@ -158,8 +157,7 @@ static int up_setmacaddr(void)
mac[5] = rand() % 256;
mac[6] = 0;
ret = netdriver_setmacaddr(mac);
return ret;
netdriver_setmacaddr(mac);
}
/****************************************************************************
@ -230,7 +228,7 @@ void tapdev_init(void)
/* Set the MAC address */
up_setmacaddr();
set_macaddr();
}
unsigned int tapdev_read(unsigned char *buf, unsigned int buflen)

View File

@ -69,8 +69,6 @@
* Private Types
****************************************************************************/
__attribute__ ((dllimport)) extern char **__argv[];
struct pcap;
struct pcap_if
@ -111,21 +109,17 @@ typedef int (*pcap_sendpacket_t)(struct pcap *, unsigned char *, int);
HMODULE wpcap;
static struct pcap *pcap;
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
extern int netdriver_setmacaddr(unsigned char *macaddr);
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
static pcap_findalldevs_t pcap_findalldevs;
static pcap_open_live_t pcap_open_live;
static pcap_next_ex_t pcap_next_ex;
static pcap_sendpacket_t pcap_sendpacket;
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
void netdriver_setmacaddr(unsigned char *macaddr);
/****************************************************************************
* Private Functions
****************************************************************************/