As crda is typically installed in /sbin it might be worth to install
regulatory.bin into /lib/crda instead of /usr/lib/crda. Hence, extend
crda to try both paths for loading the database.
Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
int main(int argc, char **argv)
{
int main(int argc, char **argv)
{
struct stat stat;
__u8 *db;
struct regdb_file_header *header;
struct stat stat;
__u8 *db;
struct regdb_file_header *header;
struct nlattr *nl_reg_rules;
int num_rules;
struct nlattr *nl_reg_rules;
int num_rules;
- const char regdb[] = "/usr/lib/crda/regulatory.bin";
+ const char *regdb_paths[] = {
+ "/usr/lib/crda/regulatory.bin",
+ "/lib/crda/regulatory.bin",
+ NULL
+ };
+ const char **regdb = regdb_paths;
if (argc != 1) {
fprintf(stderr, "Usage: %s\n", argv[0]);
if (argc != 1) {
fprintf(stderr, "Usage: %s\n", argv[0]);
memcpy(alpha2, env_country, 2);
memcpy(alpha2, env_country, 2);
- fd = open(regdb, O_RDONLY);
+ while (*regdb != NULL) {
+ fd = open(*regdb, O_RDONLY);
+ if (fd >= 0)
+ break;
+ regdb++;
+ }
if (fd < 0) {
perror("failed to open db file");
return -ENOENT;
if (fd < 0) {
perror("failed to open db file");
return -ENOENT;