I've had my Pi for over a year now. It's configured as a sound server, so it's always on and always connected via wireless. During holidays, I turned my AP off but forgot to turn the Pi off. It has a script running as a service that will restart the wireless adapter via ifdown/ifup, then reboot if it is unsuccessful in getting a wireless connection. So the Pi went through a series of many reboots.
Now the Pi can't get its usual fixed address anymore. The Wifi dongle is recognised, it manages to scan for APs. I can connect to an open network or to the same network using DHCP, but the usual fixed address configuration fails. My Pi is headless, so I have to diagnose everything via ssh over Ethernet.
I managed to get it sort of working by removing the gateway address from /etc/network/interfaces, but then I have to add a route like
route add -net default gw 192.168.0.1 dev wlan0 to gain access to the internet. When that route is created, the gateway address is ok, but the mask is set to
0.0.0.0 instead of
255.255.255.0. Any idea why my Pi is reacting like this, and how to fix it for good?
Content of various config files, and commands I have tried, are here.