ifupdown resolved script has typo
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ifupdown (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
This error happens when you try to run ifup or ifdown:
```
# ifdown enp3s0
/etc/network/
# ifup enp3s0
/etc/network/
```
Here's the first 12 lines of those scripts:
```
# head -n 12 /etc/network/
#!/bin/sh
#
# Script fragment to make ifupdown supply DNS infromation to resolved
#
case "$ADDRFAM" in
inet|inet6) : ;;
*) exit 0 ;;
esac
if systemctl is-enabled systemd-resolved > /dev/null 2>&1; then
mystatedir statedir ifindex interface
```
I'm thinking that the word `local` used to appear before `mystatedir` on line 12, but that was when it was a function. When it was converted back from being a function, the 'local' keyword was removed, but the variables remained.
Either make it into a function again, or delete line 12.
There's another similar typo in the /etc/network/ if-up.d/ resolved script, on line 71:
```
if ! cmp --silent "$oldstate" "$newstate" 2>/dev/null; then
DNS DNS6 DOMAINS DOMAINS6 DEFAULT_ROUTE
# v4 first
```
Comment it out, as it's not valid code.
Also, on lines 40-45, there's this:
DOMAINS= DOMAINS6 resolve/ netif/3
```
DNS=DNS
DOMAINS=DOMAINS
if [ "$ADDRFAM" = "inet6" ]; then
DNS=DNS6
fi
```
Which ends up writing this on lines 94-95:
```
SERVERS=$(echo $DNS6 $DNS)
DOMAINS=$(echo $DOMAINS6 $DOMAINS)
```
Generating this:
```
# cat /run/systemd/
# This is private data. Do not parse.
LLMNR=yes
MDNS=no
SERVERS=DNS
DOMAINS=DOMAINS
```
And ultimately ending up here:
```
# grep ^search /etc/resolv.conf
search example.org DOMAINS
```