Find the answer to your Linux question:
Results 1 to 2 of 2
I have FC3 running on a computer that is connected to a cable modem. I am using dhclient (3.0.1-40) to get my ip. Most of the time it works but ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2005
    Location
    Toronto
    Posts
    9

    I can't figure out what is causing this... (DHCP related)


    I have FC3 running on a computer that is connected to a cable modem.
    I am using dhclient (3.0.1-40) to get my ip. Most of the time it works but every so often it corrupts the leases file and throws off my firewall script that parses it to create the iptables rules.

    It writes several leases correctly into dhclient-eth0.leases but every so often it creates a lease that begins like this:

    ^@^@^@^@^@^@^@^@^@^@^@^@^@^@lease {
    15 lines here that are the parameters passed to it.
    This part is written correctly.
    }

    The bold part is the problem. There are many more ^@ than shown above but you get the picture... corrupt.

    Anybody have this happen before?

  2. #2
    Just Joined!
    Join Date
    May 2005
    Location
    Toronto
    Posts
    9

    UPDATE: workaround found

    Ok... I still haven't figured out what is causing corrupt lease files but...

    my firewall was finding addresses by parsing the whole file. This would get tripped up when the binary data was there.

    The command I was using was this:
    NAMESERVER=$(tac lease-file | grep '-m' '1' 'domain-name-servers' | awk '{print $3}' | sed -e 's/,.*//')

    I replaced that command with:
    NAMESERVER=$(tail -n 16 lease-file | grep '-m' '1' 'domain-name-servers' | awk '{print $3}' | sed -e 's/,.*//')

    Where the tac command would give output like: Binary file (standard input) matches
    The tail command does not.

    While I haven't found a remedy for the corrupt lease file, at least the server will keep working.

    If anyone has seen this before, let me know.
    Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •