Skip to content
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

fix(installer): Added dnsmasq default configuration file #4568

Merged
merged 2 commits into from
Apr 12, 2023

Conversation

pierantoniomerlino
Copy link
Contributor

Note: We are using the Conventional Commits convention for our pull request titles. Please take a look at the PR title format document for the supported types and scopes.

This PR adds the dnsmasq default configuration file. The Kura installer will copy it in the /etc/default/ folder.

@@ -103,6 +103,12 @@ if [ -d /usr/lib/NetworkManager/conf.d/ ]; then
fi
fi

# install dnsmasq default configuration
if [ -f /etc/default/dnsmasq ]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also check that we currently have dnsmasq installed and perform this copy only if needed (we might have installed the alternative isc-dhcp-server).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can decide how to proceed here. This is a lazy approach: copy the file even if the package is not installed on the system. In that case the presence of the config file is harmless. Otherwise, we have to check if dnsmasq is installed (is the package name different according to the OSs?), and copy the file only if needed.
What do you prefer?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the lazy approach is the best

@@ -0,0 +1,3 @@
ENABLED=1
CONFIG_DIR=/etc/dnsmasq.d,.dpkg-dist,.dpkg-old,.dpkg-new
Copy link
Contributor

@marcellorinaldo marcellorinaldo Apr 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we include .old exclusion here? We might risk to have the /etc/default/dnsmasq.old overriding ours.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean dnsmasq.old in the same folder of dnsmasq? I checked on my RPi and it seems to work. We can copy the backup file, but where?

Copy link
Contributor

@marcellorinaldo marcellorinaldo Apr 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait I made some confusion here. This directive tells dnsmasq to accept as config files in /etc/dnsmasq.d that do not end with .dpkg-dist, .dpkg-old, or .dpkg-new? Does it make sense to change it to accept only .conf? I think we can do it with CONFIG_DIR=/etc/dnsmasq.d,*.conf

Copy link
Contributor Author

@pierantoniomerlino pierantoniomerlino Apr 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation is:

By default search this drop directory for configuration options.
Libvirt leaves a file here to make the system dnsmasq play nice.
Comment out this line if you don't want this. The dpkg-* are file
endings which cause dnsmasq to skip that file. This avoids pulling
in backups made by dpkg.
CONFIG_DIR=/etc/dnsmasq.d,.dpkg-dist,.dpkg-old,.dpkg-new

This is the default configuration in my RPi.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-7, --conf-dir=[,......],
Read all the files in the given directory as configuration files. If extension(s) are given, any files which end in those extensions are skipped. Any files whose names end in ~ or start with . or start and end with # are always skipped. If the extension starts with * then only files which have that extension are loaded. So --conf-dir=/path/to/dir,*.conf loads all files with the suffix .conf in /path/to/dir. This flag may be given on the command line or in a configuration file. If giving it on the command line, be sure to escape * characters. Files are loaded in alphabetical order of filename.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • /dir/path,*.conf matches all and only .conf files.
  • /dir/path,.conf matches all except .conf files.

@@ -0,0 +1,3 @@
ENABLED=1
CONFIG_DIR=/etc/dnsmasq.d,.dpkg-dist,.dpkg-old,.dpkg-new
Copy link
Contributor

@marcellorinaldo marcellorinaldo Apr 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait I made some confusion here. This directive tells dnsmasq to accept as config files in /etc/dnsmasq.d that do not end with .dpkg-dist, .dpkg-old, or .dpkg-new? Does it make sense to change it to accept only .conf? I think we can do it with CONFIG_DIR=/etc/dnsmasq.d,*.conf

Signed-off-by: pierantoniomerlino <[email protected]>
Copy link
Contributor

@marcellorinaldo marcellorinaldo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to be working on Raspberry Pi 4, Raspbian 11.

@pierantoniomerlino pierantoniomerlino merged commit 3c27bd8 into develop Apr 12, 2023
@pierantoniomerlino pierantoniomerlino deleted the fix_dnsmasq_resolv branch April 12, 2023 15:51
github-actions bot pushed a commit that referenced this pull request Apr 12, 2023
* Added dnsmasq default configuration file

Signed-off-by: pierantoniomerlino <[email protected]>

* Updated dnsmasq file

Signed-off-by: pierantoniomerlino <[email protected]>

---------

Signed-off-by: pierantoniomerlino <[email protected]>
(cherry picked from commit 3c27bd8)
mattdibi pushed a commit that referenced this pull request Apr 13, 2023
…lease-5.3.0] (#4570)

fix(installer): Added dnsmasq default configuration file (#4568)

* Added dnsmasq default configuration file

Signed-off-by: pierantoniomerlino <[email protected]>

* Updated dnsmasq file

Signed-off-by: pierantoniomerlino <[email protected]>

---------

Signed-off-by: pierantoniomerlino <[email protected]>
(cherry picked from commit 3c27bd8)

Co-authored-by: Pierantonio Merlino <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants