ifup: fix <match> generation to reflect <child> relationship correctly

- generate <link-type> when w->device (device exists) is not NULL
- avoid extra <and> node as this is the default behaviour
- <child> is attached for each child
- fix error handling