[Help] docsis_server DHCP | docsis.org

You are here

[Help] docsis_server DHCP

12 posts / 0 new
Last post
stickery
[Help] docsis_server DHCP

can anyone help me configuring docsis_server ( https://github.com/bschirrmeister/docsis_server )?
I install it in ubuntu 14 and there is no error at all but it does't give any IP in the CM.
When I loot at the log files in the DHCP ( /home/docsis/docsis_server.DHCP.3838 )
heres what i got:
*************************
load /2 0 high(16) diff 1444958606
LOG docsis_server DHCP version 3.5 activated
tmp[0]
tmp[3]
tmp[6]
tmp[9]
tmp[12]
tmp[15]
tmp[18]
tmp[21]
tmp[24]
tmp[27]
tmp[30]
tmp[33]
tmp[36]
tmp[40]
tmp[44]
tmp[47]
tmp[53]
tmp[56]
*** stack smashing detected ***: /usr/local/sbin/docsis_server terminated
***********************

anyone know what im doing wrong? TIA

zintana
The dhcp-server process might

The dhcp-server process might crash on first dhcp discover

The workaround I discovered was to compile docsis_server without using stack-protector:

export CFLAGS="-fno-stack-protector" make make install

stickery
Thank you

Thank you sir its now working but the error is still there but its working now im stuck at OFFER in dhcp_log and it only saya 'FOUN MAC c8fb26a8b762 CM' in sys_log.

here is the log file in the /home/docsis/
**************
LOG docsis_server DHCP version 3.5 activated
tmp[0]
tmp[3]
tmp[6]
tmp[9]
tmp[12]
tmp[15]
tmp[18]
tmp[21]
tmp[24]
tmp[27]
tmp[30]
tmp[33]
tmp[36]
tmp[40]
tmp[44]
tmp[47]
tmp[53]
tmp[56]
LOG FOUND MAC c8fb26a8b762 CM
load /20 high(16) diff 17
******************

Hope you can help me

stickery
Heres what i put in the database

INSERT INTO `config_nets` (`nettype`, `cmts_ip`, `cmts_vlan`, `network`, `gateway`, `grant_flag`, `dynamic_flag`, `full_flag`, `range_min`, `range_max`, `lease_time`, `config_opt1`, `config_opt2`, `config_opt3`) VALUES
('CM', '10.128.0.1', 1, '10.128.0.0/16', '10.128.0.1', 'NO', 'YES', 'NO', '10.128.1.1', '10.128.255.250', 86400, 1, 0, 0),
('CPE', '192.168.224.1', 1, '192.168.224.0/19', '192.168.224.1', 'YES', 'YES', 'NO', '192.168.225.1', '192.168.255.250', 86400, 100, 0, 0);
************************************
INSERT INTO `config_opts` (`server_id`, `opt_id`, `opt_type`, `opt_dtype`, `opt_value`, `sub_opt`, `comment`) VALUES
(1, 1, 54, 'IP', '172.16.0.1', 0, 'Lease Server IP'),
(1, 1, 6, 'IP', '8.8.8.8', 0, 'DNS Servers'),
(1, 1, 2, 'INT32', '28800', 0, 'Time Offset'),
(1, 1, 4, 'IP', '172.16.0.1', 0, 'Time Server'),
(1, 1, 7, 'IP', '10.128.0.1', 0, 'Log Server'),
(1, 1, 66, 'CHAR', '172.16.0.1', 0, 'TFTP Server'),
(1, 1, 3, 'IP', '10.128.0.1', 0, 'Router'),
(1, 100, 54, 'IP', '172.16.0.1', 0, 'Lease Server IP'),
(1, 100, 6, 'IP', '8.8.8.8', 0, 'DNS Servers'),
(1, 1, 122, 'MTA-IP', '172.16.0.1,172.16.0.1', 0, 'TSP''s primary DHCP-Server');
**************************************
INSERT INTO `docsis_modem` (`modem_macaddr`, `cmts_vlan`, `serialnum`, `subnum`, `config_file`, `dynamic_config_file`, `static_ip`, `dynamic_ip`, `config_opt`) VALUES
('c8fb26a8b762', 1, '002', 0, 'plan1.cm', '0', 0, 0, 0);

lalodj83
assign Dynamic IP

change: ('c8fb26a8b762', 1, '002', 0, 'plan1.cm', '0', 0, 0, 0); to ('c8fb26a8b762', 1, '002', 0, 'plan1.cm', '0', 0, 1, 1);

stickery
Thank you

Thank you for the reply I Change the dynamic_ip and config_opt and it is still giving IP address but the tmp[0] arrays are still there.

lalodj83
is not working for me

My dhcp still crashing, I did the export CFLAGS="-fno-stack-protector" make make install, but i dont know if there is something else to do.

thanks!

stickery
DId you try

Did you try provisioning different modem? because some modem crashing my docsis server too, I think its because what 'jbarbier' said it only allow 50 character on the Vendor Information field, I still don't try to debug the DHCP for that if you successfully make it please share it to us, thank you.

jbarbieri
Do you know if that version

Do you know if that version of docsis_server has the bug fixed for DHCP?

Previously, it would only allow something like 50 characters on the Vendor Information field. To fix it, you had to change the source code and bump the value up.

I haven't done it in a while, but will see what I can find.

stickery
Thank you

Thank you for replying, I don't know if it has bug fix for DHCP cause this project is too old.

What do you think about this?
#############################
>dhcpd-dhcpd.h
/* option 0x2b */
u_int32_t vsi_len;
char vsi[2048];
char vsi_serialno[255];
char vsi_hwver[255];
char vsi_swver[255];
char vsi_bootrom[255];
char vsi_oui[255];
char vsi_model[255];
char vsi_vendor[255]; /* Is this the one I should change? what value should i put? */

/* option 0x3c */
u_int32_t vendor_ident_len;
unsigned char vendor_ident[2048]; /* should i change this one too? */
int docsis_modem;
char version[10];
int mce_concat, mce_ver, mce_frag, mce_phs, mce_igmp, mce_bpi;
int mce_ds_said, mce_us_sid, mce_filt_dot1p, mce_filt_dot1q;
int mce_tetps, mce_ntet, mce_dcc;
#############################
>dhcpd-option.c
/*void Parse_Modem_Caps3( dhcp_message *message ) {*/
void Parse_Modem_Caps( dhcp_message *message ) {
packet_opts *po;
u_int8_t tmp[50];
int c1, c2, i, j = 0;

po = &(message->in_opts);
po->mce_concat = -1;
po->mce_ver = -1;
po->mce_frag = -1;
po->mce_phs = -1;
po->mce_igmp = -1;
po->mce_bpi = -1;
po->mce_ds_said = -1;
po->mce_us_sid = -1;
po->mce_filt_dot1p = -1;
po->mce_filt_dot1q = -1;
po->mce_tetps = -1;
po->mce_ntet = -1;
po->mce_dcc = -1;
memcpy( po->version, (po->vendor_ident + 6), 3 );
if (po->vendor_ident[9] == ':' &&
po->vendor_ident[10] == '0' &&
po->vendor_ident[11] == '5') {
for (i=14; po->vendor_ident[i]; i += 2 ) {
c1 = po->vendor_ident[i] - 48;
if (c1 < 0) c1 = 0;
if (c1 > 9) {
if (c1 >= 17 && c1 <= 22) c1 -= 7;
if (c1 >= 49 && c1 <= 54) c1 -= 39;
if (c1 >= 16) c1 = 0;
}
c2 = po->vendor_ident[i + 1] - 48;
if (c2 < 0) c2 = 0;
if (c2 > 9) {
if (c2 >= 17 && c2 <= 22) c2 -= 7;
if (c2 >= 49 && c2 <= 54) c2 -= 39;
if (c2 >= 16) c2 = 0;
}
tmp[j] = (c1 << 4) + c2;
j++;
}
}

for( i=0; i < j; i++ ) {
fprintf(stderr,"tmp[%d]\n",i);
switch( tmp[i] ) {
case 1: po->mce_concat = tmp[i + 2];
i += 2; break;
case 2: po->mce_ver = tmp[i + 2];
i += 2; break;
case 3: po->mce_frag = tmp[i + 2];
i += 2; break;
case 4: po->mce_phs = tmp[i + 2];
i += 2; break;
case 5: po->mce_igmp = tmp[i + 2];
i += 2; break;
case 6: po->mce_bpi = tmp[i + 2];
i += 2; break;
case 7: po->mce_ds_said = tmp[i + 2];
i += 2; break;
case 8: po->mce_us_sid = tmp[i + 2];
i += 2; break;
case 9: po->mce_filt_dot1p = (tmp[i + 2] & 1);
po->mce_filt_dot1q = (tmp[i + 2] & 2);
i += 2; break;
case 10: po->mce_tetps = tmp[i + 2];
i += 2; break;
case 11: po->mce_ntet = tmp[i + 2];
i += 2; break;
case 12: po->mce_dcc = tmp[i + 2];
i += 2; break;
default:
i += 1 + tmp[i + 1];
break;
}
}
}

void Parse_MTA_Caps( dhcp_message *message ) { /* MB-DOPS */
packet_opts *po;
u_int8_t tmp[50];
int c1, c2, i, j = 0;

po = &(message->in_opts);
memcpy( po->version, (po->vendor_ident + 0), 5 );
if (po->vendor_ident[9] == ':' &&
po->vendor_ident[10] == '0' &&
po->vendor_ident[11] == '5') {
for (i=14; po->vendor_ident[i]; i += 2 ) {
c1 = po->vendor_ident[i] - 48;
if (c1 < 0) c1 = 0;
if (c1 > 9) {
if (c1 >= 17 && c1 <= 22) c1 -= 7;
if (c1 >= 49 && c1 <= 54) c1 -= 39;
if (c1 >= 16) c1 = 0;
}
c2 = po->vendor_ident[i + 1] - 48;
if (c2 < 0) c2 = 0;
if (c2 > 9) {
if (c2 >= 17 && c2 <= 22) c2 -= 7;
if (c2 >= 49 && c2 <= 54) c2 -= 39;
if (c2 >= 16) c2 = 0;
}
tmp[j] = (c1 << 4) + c2;
j++;
}
}

}
#############################

I can barely understand the code but im not sure what should I do, hope you can help me with this. TIA

zintana
u_int8_t tmp[50]; = limit var

u_int8_t tmp[50]; = limit var to 50.... change this, i think....

stickery
How can I use 2 CPE IP?

How can I use 2 CPE IP using this docsis_server?

here is my current config in database:

INSERT INTO `config_nets` (`nettype`, `cmts_ip`, `cmts_vlan`, `network`, `gateway`, `grant_flag`, `dynamic_flag`, `full_flag`, `range_min`, `range_max`, `lease_time`, `config_opt1`, `config_opt2`, `config_opt3`) VALUES
('CM', '10.128.0.1', 1, '10.128.0.0/16', '10.128.0.1', 'NO', 'YES', 'NO', '10.128.1.1', '10.128.255.250', 86400, 1, 0, 0),
('CPE', '192.168.224.1', 1, '192.168.224.0/19', '192.168.224.1', 'YES', 'YES', 'NO', '192.168.225.10', '192.168.255.250', 86400, 100, 0, 0);

************************************

INSERT INTO `config_opts` (`server_id`, `opt_id`, `opt_type`, `opt_dtype`, `opt_value`, `sub_opt`, `comment`) VALUES
(1, 1, 54, 'IP', '172.16.0.1', 0, 'Lease Server IP'),
(1, 1, 6, 'IP', '8.8.8.8', 0, 'DNS Servers'),
(1, 1, 2, 'INT32', '28800', 0, 'Time Offset'),
(1, 1, 4, 'IP', '172.16.0.1', 0, 'Time Server'),
(1, 1, 7, 'IP', '10.128.0.1', 0, 'Log Server'),
(1, 1, 66, 'CHAR', '172.16.0.1', 0, 'TFTP Server'),
(1, 1, 3, 'IP', '10.128.0.1', 0, 'Router'),
(1, 100, 54, 'IP', '172.16.0.1', 0, 'Lease Server IP'),
(1, 100, 6, 'IP', '8.8.8.8', 0, 'DNS Servers'),

**************************************

INSERT INTO `docsis_modem` (`modem_macaddr`, `cmts_vlan`, `serialnum`, `subnum`, `config_file`, `dynamic_config_file`, `static_ip`, `dynamic_ip`, `config_opt`) VALUES
('c8fb26a8b762', 1, '002', 0, 'plan1.cfg', '0', 0, 0, 0);

**************************************

CMTS IP
interface fa0/0 172.16.0.2 255.255.255.192
secondary 10.1.1.2 255.255.255.252

cable 0/1 10.128.0.1 255.255.0.0
secondary 192.168.224.1 255.255.224.0

ip route 0.0.0.0 0.0.0.0 10.1.1.1

**************************************

I want to add a secondary ip interface cable 0/1 192.168.5.1 255.255.255.0 for CPE to direct them to our portal.

What can I add to the database to give this ip block to selected CPE? TIA

Log in or register to post comments