PPP code is missing DNS setting
Posted: Sun Jan 15, 2012 10:48 pm
Hi all,
I am still having issues with trying to get PPP working with my 2 modems. I decided to have a look at the code from RC2.5 and I noticed that this includes my changes except for the setting on DNS. Only the IP gets configured. DNS primary and secondary are never configured and always zero. I used the following code to set these.
I also noticed that the defines for DNS options are in decimal and need to be in hexadecimal to work.
Interestingly, they are not used in the code.
I have them defined as follows:
I am still having issues with trying to get PPP working with my 2 modems. I decided to have a look at the code from RC2.5 and I noticed that this includes my changes except for the setting on DNS. Only the IP gets configured. DNS primary and secondary are never configured and always zero. I used the following code to set these.
Code: Select all
void IPCP_Class::TestOption( PBYTE option_start, DWORD maskv )
{
/* We are very limited */
switch ( option_start[0] )
{
case IPCP_OPT_IPADDR:
{
PDWORD pdw = ( PDWORD )( option_start + 2 );
if ( *pdw == 0 )
{
options_nak_mask |= maskv;
*pdw = m_pPPP->ActualThatInterfaceAddress;
}
else
{
if ( ( m_pPPP->ActualThatInterfaceAddress != 0 ) && ( *pdw != m_pPPP->ActualThatInterfaceAddress ) )
{
*pdw = m_pPPP->ActualThatInterfaceAddress;
options_nak_mask |= maskv;
}
else
{
m_pPPP->ActualThatInterfaceAddress = *pdw;
options_ok_mask |= maskv;
}
}
}
return;
case IPCP_OPT_PRIMARY_DNS:
{
PDWORD pdw = ( PDWORD )( option_start + 2 );
if ( *pdw == 0 )
{
options_nak_mask |= maskv;
}
else
{
m_pPPP->primaryDnsIpAddress = *pdw;
options_ok_mask |= maskv;
}
}
return;
case IPCP_OPT_SECONDARY_DNS:
{
PDWORD pdw = ( PDWORD )( option_start + 2 );
if ( *pdw == 0 )
{
options_nak_mask |= maskv;
}
else
{
m_pPPP->secondaryDnsIpAddress = *pdw;
options_ok_mask |= maskv;
}
}
return;
case IPCP_OPT_COMPRESS:
{
PDWORD pdw = ( PDWORD )( option_start + 2 );
if ( ( *pdw & 0xFFFF00FF ) == 0x002D0000 )
{
if ( ( ( *pdw & 0x0000FF00 ) >> 8 ) == 0x0F )
{
options_ok_mask |= maskv;
}
else if ( ( ( ( *pdw & 0x0000FF00 ) >> 8 ) < 0x0F ) && ( ( ( *pdw & 0x0000FF00 ) >> 8 ) > 0x01 ) )
{
NumStatesTX = ( ( *pdw & 0x0000FF00 ) >> 8 ) + 1;
sl_compress_init( comp );
options_ok_mask |= maskv;
}
else if ( ( ( ( *pdw & 0x0000FF00 ) >> 8 ) < 0x02 ) && ( ( ( *pdw & 0x0000FF00 ) >> 8 ) > 0x0F ) )
{
*pdw = 0x002D0f00;
options_nak_mask |= maskv;
}
}
else
{
*pdw = 0x002D0f00;
options_nak_mask |= maskv;
}
}
return;
default:
/*Unknown or unused option */
{
options_rej_mask |= maskv;
return;
}
}
}
Code: Select all
#define IPCP_OPT_DNS (81)
#define IPCP_OPT_DNS2 (83)
I have them defined as follows:
Code: Select all
#define IPCP_OPT_PRIMARY_DNS (0x81)
#define IPCP_OPT_SECONDARY_DNS (0x83)