-
Notifications
You must be signed in to change notification settings - Fork 590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
drouting: allow DB_BIGINT for dr_rules.ruleid column #3203
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -368,9 +368,9 @@ rt_data_t* dr_load_routing_info(struct head_db *part, | |
for(i=0; i < RES_ROW_N(res); i++) { | ||
row = RES_ROWS(res) + i; | ||
/* DB ID column */ | ||
if ( VAL_TYPE( ROW_VALUES(row) ) == DB_INT ) { | ||
/* if INT type, convert it to string */ | ||
check_val( id_drd_col, ROW_VALUES(row), DB_INT, 1, 0); | ||
if ( VAL_TYPE( ROW_VALUES(row) ) == DB_INT || VAL_TYPE( ROW_VALUES(row) ) == DB_BIGINT ) { | ||
/* if INT or BIGINT type, convert it to string */ | ||
check_val2( id_drd_col, ROW_VALUES(row), DB_INT, DB_BIGINT, 1, 0); | ||
/* int2bstr returns a null terminated string */ | ||
str_vals[STR_VALS_ID_DRD_COL] = | ||
int2bstr((unsigned long)VAL_INT(ROW_VALUES(row)), | ||
|
@@ -522,9 +522,9 @@ rt_data_t* dr_load_routing_info(struct head_db *part, | |
for(i=0; i < RES_ROW_N(res); i++) { | ||
row = RES_ROWS(res) + i; | ||
/* DB ID column */ | ||
if ( VAL_TYPE( ROW_VALUES(row) ) == DB_INT ) { | ||
/* if INT type, convert it to string */ | ||
check_val( id_drc_col, ROW_VALUES(row), DB_INT, 1, 0); | ||
if ( VAL_TYPE( ROW_VALUES(row) ) == DB_INT || VAL_TYPE( ROW_VALUES(row) ) == DB_BIGINT ) { | ||
/* if INT or BIGINT type, convert it to string */ | ||
check_val2( id_drc_col, ROW_VALUES(row), DB_INT, DB_BIGINT, 1, 0); | ||
/* int2bstr returns a null terminated string */ | ||
str_vals[STR_VALS_ID_DRC_COL] = | ||
int2bstr((unsigned long)VAL_INT(ROW_VALUES(row)), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. similar, read as VAL_INT or VAL_BIGINT. |
||
|
@@ -641,7 +641,7 @@ rt_data_t* dr_load_routing_info(struct head_db *part, | |
for(i=0; i < RES_ROW_N(res); i++) { | ||
row = RES_ROWS(res) + i; | ||
/* RULE_ID column */ | ||
check_val( rule_id_drr_col, ROW_VALUES(row), DB_INT, 1, 0); | ||
check_val2( rule_id_drr_col, ROW_VALUES(row), DB_INT, DB_BIGINT, 1, 0); | ||
int_vals[INT_VALS_RULE_ID_DRR_COL] = VAL_INT (ROW_VALUES(row)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. similar, read as VAL_INT or VAL_BIGINT. Also, the rule ID is exposed as AVP to script, so as an integer :-/ (for Carriers and GWs we have string ID which is used only for log printing and it is not stored into internal structures), so it may be subject to an overflow (while reading 64b from DB) So, at least, we need to upgrade the rule->id to long long (and also check the implications of that - not sure where this ID is used further in the code). And the |
||
/* GROUP column */ | ||
check_val( group_drr_col, ROW_VALUES(row)+1, DB_STRING, 1, 1); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we need to read as VAL_INT or VAL_BIGINT, to ensure correctness.