mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 15:14:43 +00:00
net: move random_port() to dns
The random_port() routine is not used anywhere else. Make it local to dns.c to reduce code clutter, and shrink generated code a little. Signed-off-by: Baruch Siach <baruch@tkos.co.il>
This commit is contained in:
parent
0813921042
commit
f1d925d9c3
3 changed files with 10 additions and 17 deletions
|
@ -897,9 +897,6 @@ int is_serverip_in_cmd(void);
|
|||
*/
|
||||
int net_parse_bootfile(struct in_addr *ipaddr, char *filename, int max_len);
|
||||
|
||||
/* get a random source port */
|
||||
unsigned int random_port(void);
|
||||
|
||||
/**
|
||||
* update_tftp - Update firmware over TFTP (via DFU)
|
||||
*
|
||||
|
|
10
net/dns.c
10
net/dns.c
|
@ -36,6 +36,16 @@ char *net_dns_env_var; /* The envvar to store the answer in */
|
|||
|
||||
static int dns_our_port;
|
||||
|
||||
/*
|
||||
* make port a little random (1024-17407)
|
||||
* This keeps the math somewhat trivial to compute, and seems to work with
|
||||
* all supported protocols/clients/servers
|
||||
*/
|
||||
static unsigned int random_port(void)
|
||||
{
|
||||
return 1024 + (get_timer(0) % 0x4000);
|
||||
}
|
||||
|
||||
static void dns_send(void)
|
||||
{
|
||||
struct header *header;
|
||||
|
|
14
net/net.c
14
net/net.c
|
@ -1564,20 +1564,6 @@ int net_parse_bootfile(struct in_addr *ipaddr, char *filename, int max_len)
|
|||
return 1;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_CMD_NFS) || \
|
||||
defined(CONFIG_CMD_SNTP) || \
|
||||
defined(CONFIG_CMD_DNS)
|
||||
/*
|
||||
* make port a little random (1024-17407)
|
||||
* This keeps the math somewhat trivial to compute, and seems to work with
|
||||
* all supported protocols/clients/servers
|
||||
*/
|
||||
unsigned int random_port(void)
|
||||
{
|
||||
return 1024 + (get_timer(0) % 0x4000);
|
||||
}
|
||||
#endif
|
||||
|
||||
void ip_to_string(struct in_addr x, char *s)
|
||||
{
|
||||
x.s_addr = ntohl(x.s_addr);
|
||||
|
|
Loading…
Reference in a new issue