ALIX 2c3 and pfsense (LEDs)
-
jimp,
Thats great!!!!
Lets see how it works out!
Thanks!
-
Just grabbed a new image and loaded it on an Alix. The /dev/led devices are there and working- thank you Jim. I couldn't find blinkled, but that may not be in the build yet. Anyway, here are my two cents as to some handy options for the LEDs.
- Use an LED as a 'ready' or 'armed' light. Helpful when you are working with a remote end user. I did something like this by putting a script to light LED2 in /usr/local/etc/rc.d/ and appending a command to turn it off in /etc/rc.shutdown (kind of a hack).
- Activity for an interface. RSW's blinkled works well for this eg- blinkled -i ath0 -l /dev/led/led3
- VPN linkup. I'd like to be able to do this with IPSec (like on a PIX or something), but I'm not sure how to go about it. Just putting it out there.
- Blink an LED on active alert. I believe this was done with WRAPs at some point, but I never had a WRAP to test with.
- A simple gui would be cool, enumerate the led devices and provide a menu with some stock options or a custom script.
These are only suggestions, I'm happy just to have the led devices now. I can do more testing on this if you need it.
-
dotdash,
Good to hear it's working for you, too. I have locally compiled blinkled and have it working, though it will take a little time before I can get any kind of gui going. blinkled is not currently in pfSense anywhere, but if I can get it working with a UI I'm sure it will find its way in.
I doubt it would be a good candidate for a change that would make it into 1.2.3, but 2.0 may only be a couple months away at this point, depending on progress.
I think LED2 already does blink on an active alert, but a slow blink. I'd like something more like you see with: echo 'm…---...' > /dev/led/led3
As long as I know blinkled works for people and doesn't cause any undue load issues, I'll carry on. It seems to work fine on my ALIX and I have yet to see top say it uses more than 0.00% cpu :)
-
I think LED2 already does blink on an active alert, but a slow blink. I'd like something more like you see with: echo 'm…---...' > /dev/led/led3
Ah, yes it does. I probably should have tested that first. Enabling ssh is an easy way to trigger an alert.
This appears to be defined in /etc/inc/notices.inc:
function close_notice($id) {
global $notice_path;
require_once("util.inc");
/* soekris /
if(file_exists("/dev/led/error"))
exec("/bin/echo 0 > /dev/led/error");
/ wrap */
if(file_exists("/dev/led/led2"))
exec("/bin/echo 0 > /dev/led/led2");
$ids = array();
if(!$notices = get_notices()) return;
if($id == "all") {
unlink_if_exists($notice_path);
return;
}
foreach(array_keys($notices) as $time) {(Oops, that's the off stanza. The on is sending /bin/echo f5 > /dev/led/led2)
Just verified /dev/led/error on a net5501 blinks the same as the Alix on an echo f5, so I'm not sure why the Soekris just gets a solid light and the Alix gets a blink.
-
I try to compile it my self in my pfsense box and it error out with a bunch of errors….
# gcc blinkled.c -lkvm -o blinkled blinkled.c:9:23: error: no include path in which to search for sys/types.h blinkled.c:10:24: error: no include path in which to search for sys/socket.h blinkled.c:11:20: error: no include path in which to search for net/if.h blinkled.c:12:23: error: no include path in which to search for arpa/inet.h blinkled.c:13:24: error: no include path in which to search for netinet/in.h blinkled.c:15:24: error: no include path in which to search for net/if_var.h blinkled.c:17:23: error: no include path in which to search for net/pfvar.h blinkled.c:18:17: error: no include path in which to search for kvm.h blinkled.c:19:19: error: no include path in which to search for fcntl.h blinkled.c:20:19: error: no include path in which to search for nlist.h blinkled.c:21:23: error: no include path in which to search for sys/queue.h blinkled.c:22:19: error: no include path in which to search for stdio.h blinkled.c:23:20: error: no include path in which to search for string.h blinkled.c:24:20: error: no include path in which to search for limits.h blinkled.c:25:20: error: no include path in which to search for unistd.h blinkled.c:27: error: array type has incomplete element type blinkled.c:29: error: 'NULL' undeclared here (not in a function) blinkled.c: In function 'main': blinkled.c:52: error: storage size of 'sa' isn't known blinkled.c:58: warning: incompatible implicit declaration of built-in function 'fprintf' blinkled.c:58: error: 'stderr' undeclared (first use in this function) blinkled.c:58: error: (Each undeclared identifier is reported only once blinkled.c:58: error: for each function it appears in.) blinkled.c:72: warning: incompatible implicit declaration of built-in function 'fprintf' blinkled.c:78: warning: incompatible implicit declaration of built-in function 'fprintf' blinkled.c:82: error: 'F_OK' undeclared (first use in this function) blinkled.c:84: warning: incompatible implicit declaration of built-in function 'fprintf' blinkled.c:93: error: 'O_WRONLY' undeclared (first use in this function) blinkled.c:95: warning: incompatible implicit declaration of built-in function 'fprintf' blinkled.c:98: error: 'STDIN_FILENO' undeclared (first use in this function) blinkled.c:99: error: 'STDOUT_FILENO' undeclared (first use in this function) blinkled.c:100: error: 'STDERR_FILENO' undeclared (first use in this function) blinkled.c:110: warning: incompatible implicit declaration of built-in function 'memset' blinkled.c:110: error: invalid application of 'sizeof' to incomplete type 'struct sigaction' blinkled.c:113: error: 'SIGTERM' undeclared (first use in this function) blinkled.c:115: warning: incompatible implicit declaration of built-in function 'fprintf' blinkled.c:118: error: 'SIGINT' undeclared (first use in this function) blinkled.c:120: warning: incompatible implicit declaration of built-in function 'fprintf' blinkled.c:126: warning: incompatible implicit declaration of built-in function 'fprintf' blinkled.c:136: warning: incompatible implicit declaration of built-in function 'fprintf' blinkled.c:142: warning: incompatible implicit declaration of built-in function 'sprintf' blinkled.c:147: warning: incompatible implicit declaration of built-in function 'sprintf' blinkled.c:155: warning: incompatible implicit declaration of built-in function 'sprintf' blinkled.c:160: warning: incompatible implicit declaration of built-in function 'printf' blinkled.c: In function 'sigterm': blinkled.c:167: error: 'SIG_IGN' undeclared (first use in this function) blinkled.c: In function 'getifstats': blinkled.c:174: error: storage size of 'ifh' isn't known blinkled.c:180: error: storage size of 'ifc' isn't known blinkled.c:182: error: 'kvm_t' undeclared (first use in this function) blinkled.c:182: error: 'kd' undeclared (first use in this function) blinkled.c:183: error: 'ssize_t' undeclared (first use in this function) blinkled.c:183: error: expected ';' before 'n' blinkled.c:184: error: '_POSIX2_LINE_MAX' undeclared (first use in this function) blinkled.c:186: error: 'O_RDONLY' undeclared (first use in this function) blinkled.c:189: warning: incompatible implicit declaration of built-in function 'fprintf' blinkled.c:189: error: 'stderr' undeclared (first use in this function) blinkled.c:194: warning: incompatible implicit declaration of built-in function 'fprintf' blinkled.c:200: warning: incompatible implicit declaration of built-in function 'fprintf' blinkled.c:204: error: 'n' undeclared (first use in this function) blinkled.c:207: warning: incompatible implicit declaration of built-in function 'fprintf' blinkled.c:211: warning: assignment makes pointer from integer without a cast blinkled.c:211: error: 'if_list' undeclared (first use in this function) blinkled.c:211: warning: assignment makes pointer from integer without a cast blinkled.c:213: error: 'u_long' undeclared (first use in this function) blinkled.c:213: error: expected ')' before 'ifp' blinkled.c:216: warning: incompatible implicit declaration of built-in function 'fprintf'
Any pointers will be greatly appreciated!
Thank You.
-
Does that FreeBSD box have all of the FreeBSD sources and includes present?
Seems weird that it wouldn't work. I compiled it from my pfSense builder box (RELENG_7_2) and it worked fine.
-
ooo mhhhh I dont think so… This is a production pfsense box... Is there a VMware image of the builders image?
Thank you!
-
This is easier:
/etc/rc.conf_mount_rw fetch -o /usr/local/bin/blinkled http://the-ori.org/pfs/blinkled chmod a+x /usr/local/bin/blinkled /etc/rc.conf_mount_ro rehash
I'll see about getting a package or something built, but it will be a couple days unless things clear up. Things are have been a little busy at work/home.
-
jimp,
Thank you very much!
-
I know it's been a while but I do have some updates:
#1: I'm going to be adding some LED stuff to 2.0. Stuff that won't/can't make it into 1.2.3 because it will have to be in system files and not in a package.
#2: I did just add a blinkled package that will work on the 1.2.3-RC nanobsd images. It works for me, so give it a try. After installing the package, go to Interfaces -> Assign LEDs. Should be self-explanatory from there.
-
Hmm, just installed and not working here.
Nothing blinks and service remains stopped after I attempt to start it.
I have 1.2.3RC2 build from Jun 16.
The configuration is : enable both leds and assign led2 to wan and led3 to wifi.
Where should I look for logs? -
Hmm, just installed and not working here.
Nothing blinks and service remains stopped after I attempt to start it.
I have 1.2.3RC2 build from Jun 16.
The configuration is : enable both leds and assign led2 to wan and led3 to wifi.
Where should I look for logs?There are no logs, not yet. It's only the first attempt at getting the package working. I'll polish it up some more over the next few days as I get time.
I only tested it on a nanobsd 2.0 snapshot from this past week.
So you checked the main enable box, the box for each led, and assigned them both?
I'm not sure if the service status works yet, it errors out for me so far. Try going to Diagnostics > Command, and type:
ps xa | grep blinkled
It works for me, and even starts back up after a reboot.
-
Yes, I have enabled both leds and checked the main enable box.
The process doesn't seem to be running when I try using ps aux | grep blink
Is there a way to run it manually from ssh shell?
Also I don't have led device in the dev folder.
Maybe 1.2.3RC2 from jun16 doesn't have the drivers for that?Just one more thing I forgot to mention :
I am running a regular full version (not nanobsd or embedded).Ok one more update :)
I was able to run the blinkled from the ssh and here is an error message that I got :
Error: Unable to access led -
You may not have a new enough build. I added the patch on about June 22nd to add support for ALIX LEDs.
-
Yeah looks like it,
Can you recommend a specific build known not to cause too many problem but is recent enough?
I am kinda hestitant to install a new snapshot with all those horror stories about the latest build breaking everything etc :)Ok nevermind I went ahead and installed the latest snapshot and the led package works now:)
One thing I don't understand though.
When I do pinging say my wireless client from the pfsense nothing blinks.
When I start browsing from the wireless client it does blink.
Is pinging not enough for the light to start blinking? -
I haven't really looked at the source code for the blinkled program itself. It may ignore traffic until it passes a certain threshold.
-
Very nice, thanks Jimp. It's working fine on my test rig. One thought- maybe move the alert to LED1 and return the state to on, instead of using LED2, then turning it off when the alert is cleared? This would leave LED2 and LED3 free for blinkled.
-
Very nice, thanks Jimp. It's working fine on my test rig. One thought- maybe move the alert to LED1 and return the state to on, instead of using LED2, then turning it off when the alert is cleared? This would leave LED2 and LED3 free for blinkled.
That's my intent after the code settles for a bit.
-
i was waiting for this since the day i bought the alix, is it possible to configure the led to blink even faster or lets say a way to configure the on and off period, i want it to blick link the leds on a switch or a router, which is faster.
-
i was waiting for this since the day i bought the alix, is it possible to configure the led to blink even faster or lets say a way to configure the on and off period, i want it to blick link the leds on a switch or a router, which is faster.
You would have to look at the source of the blinkled program for that, which I didn't write. I don't think it can be used as a realtime indicator like a real switch port. It only polls periodically and flashes if it sees activity within a specific timeframe, if I recall correctly.