PPP, get_mask() is only used for IPCP, moved to PPP_IPV4_SUPPORT functions group

This commit is contained in:
Sylvain Rochet 2015-04-13 22:58:45 +02:00
parent 6324068d34
commit c865211c2f
2 changed files with 37 additions and 41 deletions

View File

@ -458,6 +458,7 @@ int sifvjcomp(ppp_pcb *pcb, int vjcomp, int cidcomp, int maxcid);
#endif /* VJ_SUPPORT */
int sifup(ppp_pcb *pcb);
int sifdown (ppp_pcb *pcb);
u32_t get_mask(u32_t addr);
#endif /* PPP_IPV4_SUPPORT */
#if PPP_IPV6_SUPPORT
@ -486,8 +487,6 @@ int get_idle_time(ppp_pcb *pcb, struct ppp_idle *ip);
int get_loop_output(void);
#endif /* DEMAND_SUPPORT */
u32_t get_mask(u32_t addr);
/* Optional protocol names list, to make our messages a little more informative. */
#if PPP_PROTOCOLNAME
const char * protocol_name(int proto);

View File

@ -1002,6 +1002,42 @@ int sifdown(ppp_pcb *pcb) {
PPPDEBUG(LOG_DEBUG, ("sifdown: unit %d: err_code=%d\n", pcb->netif->num, pcb->err_code));
return 1;
}
/********************************************************************
*
* Return user specified netmask, modified by any mask we might determine
* for address `addr' (in network byte order).
* Here we scan through the system's list of interfaces, looking for
* any non-point-to-point interfaces which might appear to be on the same
* network as `addr'. If we find any, we OR in their netmask to the
* user-specified netmask.
*/
u32_t get_mask(u32_t addr) {
#if 0
u32_t mask, nmask;
addr = htonl(addr);
if (IP_CLASSA(addr)) { /* determine network mask for address class */
nmask = IP_CLASSA_NET;
} else if (IP_CLASSB(addr)) {
nmask = IP_CLASSB_NET;
} else {
nmask = IP_CLASSC_NET;
}
/* class D nets are disallowed by bad_ip_adrs */
mask = PP_HTONL(0xffffff00UL) | htonl(nmask);
/* XXX
* Scan through the system's network interfaces.
* Get each netmask and OR them into our mask.
*/
/* return mask; */
return mask;
#endif /* 0 */
LWIP_UNUSED_ARG(addr);
return IPADDR_BROADCAST;
}
#endif /* PPP_IPV4_SUPPORT */
#if PPP_IPV6_SUPPORT
@ -1165,45 +1201,6 @@ int get_loop_output(void) {
}
#endif /* DEMAND_SUPPORT */
#if PPP_IPV4_SUPPORT
/********************************************************************
*
* Return user specified netmask, modified by any mask we might determine
* for address `addr' (in network byte order).
* Here we scan through the system's list of interfaces, looking for
* any non-point-to-point interfaces which might appear to be on the same
* network as `addr'. If we find any, we OR in their netmask to the
* user-specified netmask.
*/
u32_t get_mask(u32_t addr) {
#if 0
u32_t mask, nmask;
addr = htonl(addr);
if (IP_CLASSA(addr)) { /* determine network mask for address class */
nmask = IP_CLASSA_NET;
} else if (IP_CLASSB(addr)) {
nmask = IP_CLASSB_NET;
} else {
nmask = IP_CLASSC_NET;
}
/* class D nets are disallowed by bad_ip_adrs */
mask = PP_HTONL(0xffffff00UL) | htonl(nmask);
/* XXX
* Scan through the system's network interfaces.
* Get each netmask and OR them into our mask.
*/
/* return mask; */
return mask;
#endif
LWIP_UNUSED_ARG(addr);
return IPADDR_BROADCAST;
}
#endif /* PPP_IPV4_SUPPORT */
#if PPP_PROTOCOLNAME
/* List of protocol names, to make our messages a little more informative. */
struct protocol_list {