Static Route via Windows

So lately I’ve been working on the Isilon quite a bit and we have a couple PAC servers that travel through the Netscalers here in our environment.
These netscalers are used as the Server’s default gateway for routing traffic. However using them as a source to route all data isn’t a great thing to do from a performance perspective, So some static routes are created to help make it’s backend NAS connections a bit faster.

First execute “Route Print” and note the Interface number, in this case 12,11,13,14,1

C:>route print

Interface List
12…02 00 4c 4f 4f 50 ……Npcap Loopback Adapter
11…ec b1 d7 3d 7d 8e ……Intel(R) Ethernet Connection I217-LM
13…00 50 56 c0 00 01 ……VMware Virtual Ethernet Adapter for VMnet1
14…00 50 56 c0 00 08 ……VMware Virtual Ethernet Adapter for VMnet8
1………………………Software Loopback Interface 1
===========================================================================

We would like to target 11 in this case.
Also note we need the word “MASK” in the middle or the command will not be parsed correctly
Giving -p for a persistent change, All connections to 10.246.x.240 will not route through 10.246.x.1

route -p add 10.246.x.240 MASK 255.255.255.255 10.246.x.1 METRIC 1 IF 11
route -p add 10.246.x.241 MASK 255.255.255.255 10.246.x.1 METRIC 1 IF 11
route -p add 10.246.x.242 MASK 255.255.255.255 10.246.x.1 METRIC 1 IF 11
route -p add 10.246.x.243 MASK 255.255.255.255 10.246.x.1 METRIC 1 IF 11

ESP8266 NONOS Using SpiFlash in place of Heap Memory

UPDATE: Latest Src: http://controllingtheinter.net/2018/03/05/esp8266-nonos-sdk-sprintf-stright-from-flash/
So, One of my ESP projects requires a Large HTML file being massaged and sent out with Data to display to the client. What I currently do now is use SpiRead and read it into a Malloc that is the size of the HTML. Then after I use OS_SprintF on the string and add the coordinating information into the HTML. That works great, However minor issue. After the HTML grows in development the HTML gets into the size of around 6-8k, Allocating 16k of Memory just to send out an HTML file can become a challenge for the ESP due to the lack of heap memory. This is just a prototype but I’m developing on the idea of reading the Spi 4 bytes at a time and calling SprintF accordingly whenever I see %s. %d. %c etc etc. I am not done at the moment but I am working on idea’s on simple ways to accomplish this.
#include <stdarg.h> //Required for VAList
void flashsprintf(char *s, uint32_t address, int n, …)
{
int ret;
int val;
va_list ap;
va_start(ap, n);
int numberOfVars = 0;
int i, ii = 0;
char * ss = s; //Backup Ptr
for (numberOfVars=0; s[i]; s[i]==’%’ ? numberOfVars++ : *s++);
s = ss; //RestorePtr
os_printf(“start\r\n”);
for (i=0; i<=(os_strlen(s)-1); i++)
{
//os_printf(“%d-%c\r\n”, i, s[i]);
if (s[i] == ‘%’)
{
switch(s[i+1])
{
case ‘s’  :
val=va_arg(ap,char *);
break; /* optional */
case ‘d’  :
os_printf(“Dec “);
val=va_arg(ap,int);
break; /* optional */
/* you can have any number of case statements */
default : /* Optional */
os_printf(“Unknown “);
}
}
}
os_printf(“%d”, i);
for (ii=0;ii<i;ii++)
{
val=va_arg(ap,int);
os_printf (” %d”,val);
}
//ret = vsprintf(s, fmt, ap);
va_end(ap);
return ret;
}
 
 
As additional step I tried to rewrite this code using Visual Studio the Mike’s operating system kind had to expand my knowledge on how SprintF reports are neat the hood. One things I found kind of interesting is that when you pass an argument to a C function that does have a set amount of parameters SprintF uses an internal function called VA_list that is used to parse through each corner and then clean up the stack afterwards allowing the function to return back to the callee properly. I would assume I would have to do is do an SPI read and mimic the same type of logic to accomplish what I’m looking for. In the end I believe I can redo some heap memory usage by approximately 40% which is a huge deal when you only have 32K of heap to work with. I’m not done with this code yet. This is more brainstorming pseudocode for me. I’ll come back and update this code when i come up with more of a polished solution.
 

#include “stdafx.h”
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h> //Required for VAList
#define _CRT_SECURE_NO_WARNINGS
int flashsprintf(char *buffer, char *s, int n, …)
{
int ret;
void * val;
void * args[4];
va_list ap;
va_start(ap, n);
int numberOfVars = 0;
int i, ii, index = 0;
char * ss = s; //Backup Ptr
for (numberOfVars = 0; s[numberOfVars]; s[numberOfVars] == ‘%’ ? numberOfVars++ : *s++);
s = ss; //RestorePtr
printf(“start\r\n“);
for (i = 0; i <= (strlen(s) – 1); i++)
{
//os_printf(“%d-%c\r\n“, i, s[i]);
if (s[i] == ‘%’)
{
switch (s[i + 1])
{
case ‘s’:
args[index] = va_arg(ap, char *);
index++;
break; /* optional */
case ‘d’:
//int *p1 = (int *)malloc(sizeof(int));
//p1 = &va_arg(ap, int);
//args[index] = p1;
args[index] = (void *)va_arg(ap, int);
index++;
break; /* optional */
   /* you can have any number of case statements */
//default: /* Optional */
//printf(“Unknown “);
}
}
}
switch (index – 1)
{
case 0:
sprintf(buffer, s, args[0]);
case 1:
sprintf(buffer, s, args[0], args[1]);
case 2:
sprintf(buffer, s, args[0], args[1], args[2]);
default:
printf(“default”);
}
printf(“%d”, i);
/*
for (ii = 0; ii<i; ii++)
{
val = va_arg(ap, int);
printf(” %d”, val);
}
*/
//ret = vsprintf(s, fmt, ap);
va_end(ap);
return 0;
}
int main()
{
char buffer[512];
flashsprintf(buffer, “%s%d%s”, 3, “test”, 5, “tester”);
    return 0;
}

 

ATtiny84 Software UART

So back a few years ago since before I moved over working on the ESP family, I was an Atmel junkie. One of the thing’s that came in real handy was working with Software UART and the ATTiny84. It was a real great learning experience and I got really really burned with the DIV8 fuse being enabled on chip’s by default. I wanted to post my work here because I’m sure someone else may need it for the AT84 or 4313 2313 etc etc. Now the code below can be improved but the main thing to really take home is the caluclating the baud sleep while in the function. #define SleepRX9600 104 //= (1/ 9600) #define SleepRX4800 180 //= (1/ 4800) #define sleepTransmitString4800 208 #define sleepTransmitString9600 104   Now one thing to take home is if you want to transfer at 9600 baud over a second just take 1 / baud to get your uS sleep time. After you get it rocking you adjust the numbers to match the clock cycles of your added code. Sending data is almost mirrored logic. In this case I was working with a GPS, Once the string is received you can parse it just as if it is any other string in C.  

Traffic Court CVC 22350 Basic Speed Law – Continued Appellant's Opening Brief

Prepost: Trial http://controllingtheinter.net/2018/02/12/cvc22350-traffic-trial-unsafe-speed/

Update: Appellee’s Opening Brief Response http://controllingtheinter.net/2018/03/07/appellees-opening-brief-response-from-district-attorneys-office/

Well the big day just passed for my opening brief. I sat on this for about a good three months contemplating on the format and doing research on the best way to tackle this issue. The problem with legal docs is that they’re not very abundant when it comes to seeing the actual paperwork being filed by others. There’s a bunch of case laws that you can easily look up but you can never see what the defense and prosecution explicitly stated and how they said it which is kind of important. So from gathering what I could I threw this together and submitted to the appellate court I don’t expect a response for at least a good month and 1/2 to 2 months so fingers crossed.    

Quieting down the Cisco SG200 POE Switch

So this weekend someone asked me about an issue they had with the Cisco POE switch being very noisy. He sent me this link he found where a SysAdmin went and found replacement fan’s for his switch to quiet them down. http://wahlnetwork.com/2014/12/21/diy-project-replacing-stock-cisco-sg300-52-fans-silence/
The fan’s currently in the switch are: https://www.digikey.com/product-detail/en/delta-electronics/EFB0412MD-R00/603-1581-ND/2560704
He suggested if this fan would work as a replacement: https://www.digikey.com/product-detail/en/ebm-papst-inc/412-2/381-2459-ND/592230
After a brief look into the datasheet, I found that the current fan vs. the new fan did not have a “Tach” to read PWM to get a return value on how fast the fan is moving, it did, however, have a Stop Rotation Detection method through the third wire. In this case, the replacement fan he suggested would spur a large number of false positives for error’s as the line should only go HIGH when the fan is jammed verses every 1/10000 of a second for its speed. So I instead dug through my box to locate an L7808CV Positive 8V voltage regulator. I found 8V make’s the fan extremely quiet and kicks the speed down. I ended up testing it with my bench variable power supply before concluding the 8V was the value I wanted. I quickly threw together a board and hot-snotted the unit to the back of the SG200 and what do you know, quiet as a ninja and no fan alerts.