I think I had a similar problem with my WRT54G v5: I did a factory reset (hold reset down for 30 s) as part of reconfiguring my system from cable modem to dsl, but from then on, I kept losing internet even though I could join the wireless network. I looked at the computer connected directly to the router (via ethernet cable) and found that it could no longer renew the IP address either. Clearly the problem was with the router since a direct connection to the modem worked fine.
I updated the firmware, toyed with all sorts of settings, and made no progress. I reconfigured it both manually through the router page (point a browser to 192.168.1.1) and by re-running the linksys setup software. I uninstalled the driver for the ethernet card (right click my computer->properties->hardware tab->device manager then right click the card to uninstall), as per some instructions I found on the web, but this accomplished very little. To prove that the windows box wasn't overloading the router (again some forums suggested this), I turned it off completely and used the wireless with a mac laptop. It still failed.
Based on the information on web forums and other tests, it seemed like there was clearly a software configuration error at the level of the router (firmware). On a whim, I wondered whether some sort of automatic setup type thing was interfering with my configuration. I noticed the "Secure Easy Setup" on the wireless tab of the router page, which I had previously dismissed as something for people who couldn't set things up themselves. I was wrong: I reconfigured the "SES" and NO MORE FAILURES! Wierdest of all, the SES status is still "inactive"!
What worked for me:
-open the router page in a browser (http://192.168.1.1)
-click the "Wireless" tab and then click the circular icon with the lock on it
-a dialog will open asking you to start the reconfiguration on the router
-hold down the "Cisco Systems" button (to the left of the power light) until it starts flickering white
-go back to the dialog box and click OK
after a long configuration, it will bring you back to the wireless page and it will look like nothing changed, but I was then able to run simultaneously P2P-ware, 128bit WEP, QoS protocol, etc.
Hopefully other people will notice an improvement too...