PacketFence - BTS - PacketFence | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0001243 | PacketFence | core | public | 2011-08-11 02:49 | 2011-10-24 20:24 |
Reporter | psnizek | ||||
Assigned To | obilodeau | ||||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | OS | OS Version | |||
Product Version | 2.2.1 | ||||
Target Version | 3.0.0 | Fixed in Version | 3.0.0 | ||
fixed in git revision | |||||
fixed in mtn revision | |||||
Summary | 0001243: duplicate entries errors in pf::os::read_dhcp_fingerprints_conf at pfcmd service ... start or pfcmd update oui|fingerprints | ||||
Description | Hello pfcmd is the only one to call dhcp_fingerprints_conf. On my box it produces this output in packetfence log: pfcmd(0) WARN: database query failed with: Duplicate entry '3,1,6,15,121' for key 'PRIMARY'. (errno: 1062), will try again (pf::db::db_query_execute) The SQL statements run at pfcmd service httpd start are DELETE FROM os_type DELETE FROM os_class that are found in os::pf::os_db_prepare. However, a DELETE FROM dhcp_fingerprint is not found anywhere although the full flat file seems to be inserted into the database every time the pfcmd service someservice start or pfcmd update oui|fingerprints commands are run. This causes here duplicate entry errors logged in packetfence.log. Apart from that, I am not really sure about the exact function of pf::trigger qw(trigger_in_range). In particular this code fragment taken from the function seems to be always true: # what exactly is the sense of this code? } elsif ( $element =~ /^\d+\s*\-\s*\d+$/ ) { my ( $begin, $end ) = split( /\s*\-\s*/, $element ); if ( $trigger >= $begin && $trigger <= $end ) { return (1); } Commenting the trigger_in_range function seems to do no harm as it is only used in os.pm in read_dhcp_fingerprints_conf and is imported but unused in freeradius.pm. If the fingerprints table in mysql is not completely deleted, this code also generates a lot of duplicate entry errors. Best wishes, Philipp | ||||
Steps To Reproduce | |||||
Additional Information | Not well tested at all but this patch reduced the errors to zero: --- os.pm.orig 2011-07-14 13:50:17.990982129 +0200 +++ os.pm 2011-08-11 08:26:31.739588886 +0200 @@ -54,6 +54,8 @@ sub os_db_prepare { $os_statements->{'os_delete_all_sql'} = get_db_handle()->prepare(qq[ DELETE FROM os_type ]); $os_statements->{'os_class_delete_all_sql'} = get_db_handle()->prepare(qq[ DELETE FROM os_class ]); + + $os_statements->{'dhcp_fingerprint_delete_all_sql'} = get_db_handle()->prepare(qq[ DELETE FROM dhcp_fingerprint ]); $os_statements->{'dhcp_fingerprint_add_sql'} = get_db_handle()->prepare( qq [ INSERT INTO dhcp_fingerprint(fingerprint,os_id) VALUES(?,?) ]); @@ -105,6 +107,7 @@ sub read_dhcp_fingerprints_conf { my $fp_total; my %dhcp_fingerprints; + db_query_execute(OS, $os_statements, 'dhcp_fingerprint_delete_all_sql'); db_query_execute(OS, $os_statements, 'os_delete_all_sql'); db_query_execute(OS, $os_statements, 'os_class_delete_all_sql'); tie %dhcp_fingerprints, 'Config::IniFiles', | ||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | |||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2011-08-11 02:49 | psnizek | New Issue | |||
2011-08-11 11:44 | obilodeau | Note Added: 0002120 | |||
2011-08-11 11:44 | obilodeau | Status | new => acknowledged | ||
2011-08-11 11:44 | obilodeau | Category | dhcp => core | ||
2011-08-11 11:44 | obilodeau | Target Version | => +1 | ||
2011-08-11 11:44 | obilodeau | Status | acknowledged => assigned | ||
2011-08-11 11:44 | obilodeau | Assigned To | => obilodeau | ||
2011-08-11 11:55 | obilodeau | Note Added: 0002121 | |||
2011-08-11 11:57 | obilodeau | Note Added: 0002122 | |||
2011-08-11 12:23 | obilodeau | Note Added: 0002123 | |||
2011-08-11 12:36 | obilodeau | Note Edited: 0002123 | |||
2011-08-11 15:29 | psnizek | Note Added: 0002124 | |||
2011-08-11 15:44 | psnizek | Note Added: 0002125 | |||
2011-08-11 16:04 | psnizek | Note Added: 0002126 | |||
2011-08-12 09:44 | obilodeau | Note Added: 0002127 | |||
2011-08-12 09:44 | obilodeau | Status | assigned => feedback | ||
2011-08-12 10:46 | psnizek | Note Added: 0002128 | |||
2011-08-12 11:47 | obilodeau | Note Added: 0002129 | |||
2011-08-12 11:47 | obilodeau | Status | feedback => resolved | ||
2011-08-12 11:47 | obilodeau | Fixed in Version | => trunk | ||
2011-08-12 11:47 | obilodeau | Resolution | open => fixed | ||
2011-09-21 22:07 | obilodeau | Fixed in Version | trunk => 3.0.0 | ||
2011-09-21 22:15 | obilodeau | Note Added: 0002248 | |||
2011-09-21 22:16 | obilodeau | Status | resolved => closed | ||
2011-10-24 20:24 | obilodeau | Target Version | +1 => 3.0.0 |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|