lldpd / lldpd

implementation of IEEE 802.1ab (LLDP)
https://lldpd.github.io
Other
600 stars 177 forks source link

Windows support? #42

Open rincebrain opened 11 years ago

rincebrain commented 11 years ago

It'd be nice to have a cross-platform tool that plays nice on Windows, as well.

Of course, since your options are terrible NDIS calls or WinPcap, that would be a bit of complexity, but given the interface-$OS.c already extant, what's one more domain-specific file? ;)

(I'll probably give a go to at least getting most of it compiling under Windows before I try to crap out some Win-specific code, I just wanted to file an issue about it as well to track anyone else's progress, including mine!)

vincentbernat commented 11 years ago

Yes, we first need to check if we can compile non-OS specific parts. Should we compile with Cygwin/mingw32 or with Visual Studio?

We can have a look at OpenLLDP support: http://openlldp.cvs.sourceforge.net/viewvc/openlldp/openlldp/src/platform/framehandlers/windows/lldp_windows_framer.c?revision=1.2&view=markup

rincebrain commented 11 years ago

I had meant with VS, but either way, really. I just thought VS would be easier since I think you'd need to use either pcap or NDIS-specific calls to do layer 2 traffic on Windows, and I don't know how playing with WinPcap through Cygwin/MinGW works.

I'm going to stub out the syslog calls with a thing that just spits them to a text file for now, and possibly upgrade that to logging to Event Viewer later, and go from there...

vincentbernat commented 11 years ago

I cannot be sure but everything that can be done with VS should work with MinGW. And because there is no POSIX layer, making lldpd compile with VS will be more difficult: syslog, socket handling, chroot, privilege separation, ...

rincebrain commented 11 years ago

You're right - I looked at doing this in VS versus MinGW, and it's much saner with MinGW, so I'll start banging my head there.

rincebrain commented 11 years ago

Two unfortunate things. 1) The code in OpenLLDP has severely bitrotted - it no longer compiles and runs on Windows (and I'm not certain it ever did? there are some questionable notes in the changelog for those commits), and it looks like it was heavily pillaged from a combination of the Open1X codebase and the example NDIS 5.x driver. 2) MinGW doesn't give you syslog/socket/etc either, which may have been what you were alluding to above.

vincentbernat commented 11 years ago

I thought that MinGW was just Cygwin without the DLL. About VS, lldpd is using some parts of C99. If I remember correctly, VS does not support C99. So it may also raise some problems.

nshopik commented 10 years ago

Also please note that Windows8 and later (2012 and later) include LLDP protocol driver but its not installed by default. http://msdn.microsoft.com/en-us/library/windows/hardware/hh451627(v=vs.85).aspx I never able install it manually only on preview releases it was installed by default, they seems to using it with Data Center Bridging

vincentbernat commented 8 years ago

@nshopik Somehow, I missed your comment. Did you get a chance to test it? What info does it export?

nshopik commented 8 years ago

iirc remember they only shared link configuration only. Maybe it was changed, but quick test on Windows 2012 show that i still can't install it manually (probably only installed as part of DCB). This need to be re-tested on W10

benwa commented 8 years ago

All Windows 8+ boxes I've seen have LLDP installed by default. Unfortunately, it's fairly useless and not configurable.

I'd absolutely love to be able to deploy lldpd as an MSI and configure it via Group Policy.

vincentbernat commented 8 years ago

Unfortunately, that's not an easy task. When I looked two years ago, I tried to sort out the POSIX part (syslog, sockets, etc.) before trying to handle the network part. I think the network part would be "easy" (looking at how this is done in other projects using raw sockets). It's the other part which can be hard.

I just have a branch with the work started a bit (only syslog has been implemented). I don't remember if I stopped because I didn't have more time or if there was some showstopper. It's possible I didn't know how to replace the Unix socket.

vincentbernat commented 8 years ago

Another reason I would have preferred MinGW is that I can compile directly from Linux. Compiling from Windows would be a pain, even after setting up SSH access and stuff like that.

benwa commented 8 years ago

I understand, really I'm just frustrated with Microsoft over the Windows 8 thing.

vincentbernat commented 8 years ago

Soon, a course of action could be to leverage Windows Linux subsystem: http://blog.dustinkirkland.com/2016/03/ubuntu-on-windows.html. I don't expect it to make lldpd work out of the box, but I suppose it would only leave a few gaps to implement.

benwa commented 8 years ago

This just got posted to Reddit: https://github.com/raspi/WinLLDPService

vincentbernat commented 8 years ago

That's great!