News:

Rule #1 - Be Patient - Rule #2 - Don't ask when, if you don't contribute - Rule #3 - You have coding skills - LinuxMCE's small brother is available: http://www.agocontrol.com

Main Menu

PNP without DHCP

Started by hari, October 11, 2007, 10:17:03 AM

Previous topic - Next topic

hari

Hi Folks,

i investigated the DHCP PNP process and had the idea of using arpwatch for pnp detection. It produces log entries like this:
Oct 11 13:38:18 dcerouter arpwatch: new station 10.1.1.17 de:ad:be:ef:0:4 eth0

derive from Dhcpd-Plugin-Parser.sh:

dcerouter_37298:~# diff -u  /usr/pluto/bin/Dhcpd-Plugin-Parser.sh /usr/pluto/bin/Arpwatch-Plugin-Parser.sh
--- /usr/pluto/bin/Dhcpd-Plugin-Parser.sh       2007-03-01 04:15:34.000000000 +0100
+++ /usr/pluto/bin/Arpwatch-Plugin-Parser.sh    2007-10-11 13:40:04.000000000 +0200
@@ -23,7 +23,7 @@
                log) Type="00" ;;
        esac

-       printf "%s\n" "$Type $(date -R) $Data" >>/var/log/pluto/dhcp_pnp.log
+       printf "%s\n" "$Type $(date -R) $Data" >>/var/log/pluto/arpwatch_pnp.log
}

parse()
@@ -57,16 +57,16 @@
        line=$(parse "$inline")
        tag=$(extract_field 5 "$line")
        op=$(extract_field 6 "$line")
-       mac_found=$(extract_field 10 "$line")
+       mac_found=$(extract_field 9 "$line")
        ip_sent=$(extract_field 8 "$line")

-       if [[ "$tag" != "dhcpd:" || -z "$mac_found" ]]; then
+       if [[ "$tag" != "arpwatch:" || -z "$mac_found" ]]; then
                continue
        fi

        case "$op" in
-               "DHCPACK")
-                       log_plugin log "DHCP : MAC '$mac_found' IP '$ip_sent'"
+               "new")
+                       log_plugin log "ARPWATCH : MAC '$mac_found' IP '$ip_sent'"

                        Q="SELECT PK_Device FROM Device WHERE MACaddress='$mac_found' AND IPaddress='$ip_sent'"
                        R=$(RunSQL "$Q")

seems to work:

+ read mac ip garbage
+ RetrySend de:ad:be:ef:0:4 10.1.1.17
+ local MAC=de:ad:be:ef:0:4 IP=10.1.1.17
+ /usr/pluto/bin/MessageSend localhost 1 -1001 2 65 52 3 53 2 5 de:ad:be:ef:0:4 28 10.1.1.17

Caveats: boot options for media directors and stuff have to be specified in the standalone DHCP server.

I think this would be a nice fallback for PNP when the internal dhcp server is deactivated. What do you think about it?

regards,
Hari
rock your home - [url="http://www.agocontrol.com"]http://www.agocontrol.com[/url] home automation

orionsune

I like it, but hari, can you tell me what that function detects other than MDs?  Network share detection seems to be independent of this.

A pinging for loop for the current subnet would work, maybe a little on the slow side without the right tools.

As long as the device can serve netbios names, the StorageDevices_SambaRadar.sh method seems alright, granted that is for network shares not misc ip based devices.

This is such an old topic with no replies, but a freaking EXCELLENT idea... how come this was never implemented?
entia non sunt multiplicanda praeter necessitatem

hari

maybe you want to look at the DHCPDevice table..

what comes into my mind:
IP Phones
IP Cameras
Squeezeboxes/Roku Soundbridges
HDHomerun receiver
...
?

I did not follow that approach because I started to loose seeing the point in running another dhcp server in my home network.. (and I am a hardliner when it comes to my services ;) )
I wanted to extend the DHCP configuration script if i needed something special but that event has not come up yet..

best regards,
Hari
rock your home - [url="http://www.agocontrol.com"]http://www.agocontrol.com[/url] home automation

orionsune

Ah, I see... I can understand that, since you no longer had a need for it why bother following through, I have a crapload of projects that have died for that very reason. I think I may pickup where you left off if thats ok with you?  I am very interested in coming up with an alternative to detecting those devices without dhcp.

Thanks, i'll look at that table just for shitzandgigglez, but I just wanted an idea of what devices depend on that function.  I figured it out a while ago, but thx again.
entia non sunt multiplicanda praeter necessitatem

hari

Quote from: orionsune on March 18, 2008, 09:00:09 PM
Ah, I see... I can understand that, since you no longer had a need for it why bother following through, I have a crapload of projects that have died for that very reason. I think I may pickup where you left off if thats ok with you?  I am very interested in coming up with an alternative to detecting those devices without dhcp.
it's not off my list but waaaaay down..
Supporting newer ZWave devices, Supporting Java phones, figuring out sqlCVS and adding 4 GSD's kept me busy the last weeks ;)

it would be great if you could add such functionality and trigger that by the dhcp option..
So somebody only out for the media functions of lmce could install with a single nic and just deactivate dhcp..

best regards,
Hari

ps: i even had some other strange idea.. you can include dhcp zones based on csv with http on a Cisco ISR. The DHCP conf generation script could spit out the needed pieces..
rock your home - [url="http://www.agocontrol.com"]http://www.agocontrol.com[/url] home automation

orionsune

your "ps" is very interesting, if I run into anything interesting, since it's not off your list yet, i'll just relay it to you...
entia non sunt multiplicanda praeter necessitatem

hari

some thoughts from irc:
Quote
<atomic_1> brb
what services do you mean by PNP ? like the auto media discovery?
<hari> device discovery
HDHomerun receivers
Squeezeboxes from Logitech
Soundbridges from Roku
Webcams from Panasonic/Axis/D-Link
AV Receivers like the Denon 4603
ZWave/Insteon controllers like EZBridge
Sensors for movement, temperature whatever
IP Phones
Ethernet Rs232 adapters
but hey, those devices are only used by geeks that don't need pnp as they are skilled enough to configure them manually? i don't get that logic..
<atomic_1> well, as far as i understand the dhcp issue
dhcp passes an argument (ip/mac address) to the relevant service, which then uses it to locate/identify the device and have its way with it
so the only problem lies there
<hari> thats why i came up with that arpwatch patch
but thats no solution for configuring that other dhcp server
ideally it should serve the ip's held in lmces device data
but as there are plenty of different dhcp servers/configuration interfaces out there.. i see no common way for doing that
rock your home - [url="http://www.agocontrol.com"]http://www.agocontrol.com[/url] home automation

danielk

Quote from: orionsune on March 18, 2008, 09:00:09 PM
Ah, I see... I can understand that, since you no longer had a need for it why bother following through, I have a crapload of projects that have died for that very reason. I think I may pickup where you left off if thats ok with you?  I am very interested in coming up with an alternative to detecting those devices without dhcp.

Orionsume, this would be a valuable addition to LinuxMCE even if Hari doesn't need it anymore. The DHCP server one of the things that scares people casually testing LMCE and makes a Knoppix type try-it-before-you-install-it DVD a tough thing to do. This would also help familiarize you with the PNP process, which Dan Damron has been investigating as well (for Insteon auto-detection.)

Of course, there are other obstacles, but this is one of the major things that needs to be addressed before a LiveDVD effort becomes very appealing (a LiveDVD which needs to run bind and DHCP to work well is frankly a scary idea.)