/etc/network/if-up.d/resolved: 1: /run/network/ifupdown-inet-enp2s0: DNS=1.1.1.1: not found
/etc/network/if-up.d/resolved: 2: /run/network/ifupdown-inet-enp2s0: DOMAINS=example.org: not found
Failed to parse DNS server address: DNS
Failed to set DNS configuration: Invalid argument
# cat /run/network/ifupdown-inet-enp2s0
"DNS"="1.1.1.1"
"DOMAINS"="example.org"
```
And that comes from lines 47-51 of /etc/network/if-up.d/resolved:
```
if [ -n "$NEW_DNS" ]; then
cat <<EOF >"$mystatedir/ifupdown-${ADDRFAM}-$interface"
"$DNS"="$NEW_DNS"
EOF
if [ -n "$NEW_DOMAINS" ]; then
cat <<EOF >>"$mystatedir/ifupdown-${ADDRFAM}-$interface"
"$DOMAINS"="$NEW_DOMAINS"
EOF
```
Basically, the double-quotes around "$DNS" and "$DOMAINS" shouldn't be there, because it's a here-doc.
But this reveals another bug: the variable $DOMAINS is used to hold either "DOMAINS" or "DOMAINS6" in lines 41 or 44, but the actual search domains in line 95.
Whoops, found another bug:
```
# ifup enp2s0
/etc/network/ if-up.d/ resolved: 1: /run/network/ ifupdown- inet-enp2s0: DNS=1.1.1.1: not found if-up.d/ resolved: 2: /run/network/ ifupdown- inet-enp2s0: DOMAINS= example. org: not found
/etc/network/
Failed to parse DNS server address: DNS
Failed to set DNS configuration: Invalid argument
# cat /run/network/ ifupdown- inet-enp2s0
"DNS"="1.1.1.1" ="example. org"
"DOMAINS"
```
And that comes from lines 47-51 of /etc/network/ if-up.d/ resolved: ifupdown- ${ADDRFAM} -$interface" ifupdown- ${ADDRFAM} -$interface" ="$NEW_ DOMAINS"
```
if [ -n "$NEW_DNS" ]; then
cat <<EOF >"$mystatedir/
"$DNS"="$NEW_DNS"
EOF
if [ -n "$NEW_DOMAINS" ]; then
cat <<EOF >>"$mystatedir/
"$DOMAINS"
EOF
```
Basically, the double-quotes around "$DNS" and "$DOMAINS" shouldn't be there, because it's a here-doc.
But this reveals another bug: the variable $DOMAINS is used to hold either "DOMAINS" or "DOMAINS6" in lines 41 or 44, but the actual search domains in line 95.
Has this code ever worked?