Re: Backup OBSD router at 6.7, anyway to upgrade it to 6.9???

2021-05-24 Thread Stuart Longland
On Mon, 17 May 2021 20:26:25 -0400
"Jay Hart"  wrote:

> Its still at 6.7, it there anyway I can update it to 6.9 without
> doing a full re-install, or has the only train left the station?

I updated my Loongson netbook from OpenBSD 6.6 on the week-end to 6.9… the 
process I followed:

1. download bsd.rd for OpenBSD 6.7 from ftp.openbsd.org
2. boot it, do an "Upgrade"
3. once booted into OpenBSD 6.7, do `sysupgrade` to get to 6.8
4. once booted into OpenBSD 6.8, do `sysupgrade` to get to 6.9

Note that in my case, I had some fiddling inside PMON2000 to switch the
image from /bsd to /bsd.rd and back again at each step as the
installer/`sysupgrade` does not do this for you.  On AMD64, this should not
be a problem. you should be able to a `sysupgrade`

Worst case scenario might be temporarily changing /etc/installurl to
ftp.openbsd.org to obtain the necessary files.
-- 
Stuart Longland (aka Redhatter, VK4MSL)

I haven't lost my mind...
  ...it's backed up on a tape somewhere.



Re: Advice on serial port communication

2021-05-24 Thread Stuart Longland
On Tue, 25 May 2021 09:38:21 +1000
Stuart Longland  wrote:

> Maybe it can't find the boot-loader?

To clarify… (yes, half asleep this morning)… TI boot-loader cannot find
the OS boot-loader… not that it can't find itself.
-- 
Stuart Longland (aka Redhatter, VK4MSL)

I haven't lost my mind...
  ...it's backed up on a tape somewhere.



Re: Advice on serial port communication

2021-05-24 Thread Stuart Longland
On Mon, 24 May 2021 07:54:38 -0700
Joseph Olatt  wrote:

> Any advice on what those "C"s mean. The serial cable I'm using is:
> 

Something in the back of my mind suggests this might be the TI
bootloader complaining, about something.  Maybe it can't find the
boot-loader?
-- 
Stuart Longland (aka Redhatter, VK4MSL)

I haven't lost my mind...
  ...it's backed up on a tape somewhere.



Re: Backup OBSD router at 6.7, anyway to upgrade it to 6.9???

2021-05-24 Thread Jay Hart
> On Mon, 17 May 2021 20:26:25 -0400
> "Jay Hart"  wrote:
>
>> Its still at 6.7, it there anyway I can update it to 6.9 without
>> doing a full re-install, or has the only train left the station?
>
> I updated my Loongson netbook from OpenBSD 6.6 on the week-end to 6.9… the 
> process I followed:
>
> 1. download bsd.rd for OpenBSD 6.7 from ftp.openbsd.org
> 2. boot it, do an "Upgrade"
> 3. once booted into OpenBSD 6.7, do `sysupgrade` to get to 6.8
> 4. once booted into OpenBSD 6.8, do `sysupgrade` to get to 6.9
>
> Note that in my case, I had some fiddling inside PMON2000 to switch the
> image from /bsd to /bsd.rd and back again at each step as the
> installer/`sysupgrade` does not do this for you.  On AMD64, this should not
> be a problem. you should be able to a `sysupgrade`
>
> Worst case scenario might be temporarily changing /etc/installurl to
> ftp.openbsd.org to obtain the necessary files.
> --
> Stuart Longland (aka Redhatter, VK4MSL)
>
> I haven't lost my mind...
>   ...it's backed up on a tape somewhere.
>
>

Stuart,

I'm glad it worked for you as well. I was able to run through sysupgrade and 
get my box updated to 6.9 as well.

Jay



Re: carp backup and disconnecting ssh session

2021-05-24 Thread Sebastian Benoit
MJ J(mikedotjack...@gmail.com) on 2021.05.23 17:58:47 +0300:
> Hi,
> 
> I have a carp master and backup on a pair of one-armed Rapsberry Pi 4B
> devices (router1 and router2) and when I ssh to the backup using the
> carp IP as my gateway, it repeatedly throws me out after a few seconds
> with the message:
> 
> My laptop's network config:
> ---
> IP: 192.168.4.109
> Subnet mask: 255.255.255.0
> Gateway: 192.168.4.1
> 
> Both RPI4s are connected to switchports with packets tagged for VLANs
> 2,3,4,6 and the network devices don't have IP configuration -
> everything is configured on VLAN interfaces with the single parent
> interface bse0. CARP failover actually works as expected, but as
> mentioned I am unable to maintain an ssh session with the backup
> "router2" while using the carp IPs as my network gateway.
> 
> Network switch is a Zyxel GS1200-8 with firmware V2.00(ABME.0)C0. Loop
> prevention is enabled and I have also tested with it disabled to no
> avail.
> 
> What happens:
> ---
> $ ssh 10.0.1.101
> Last login: Sun May 23 17:44:21 2021 from 10.0.1.100
> OpenBSD 6.9 (GENERIC.MP) #1134: Sun Apr 18 01:53:35 MDT 2021
> router2#
> router2# client_loop: send disconnect: Broken pipe

you ssh from 192.168.4.109 to 10.0.1.101?

My best guess is that you have asymetric routing and your carp master
router1 only sees one direction of the traffic: 

laptop -> router1 -> router2
and
router2 -> laptop

because router2 has your laptop network locally on vlan6.

Solution: ssh to 192.168.4.3.

> 
> 
> Router 1 network config:
> ---
> router1# cat hostname.bse0
> up
> 
> router1# cat hostname.vlan2
> 172.16.1.6/24 172.16.1.255 parent bse0 vnetid 2 group PFSYNC
> description "private segment with router2"
> 
> router1# cat hostname.vlan3
> 10.0.1.100/24 10.0.1.255 parent bse0 vnetid 3 group INTERNAL
> description "router1 internal interface"
> 
> router1# cat hostname.vlan4
> 192.168.1.252/24 192.168.1.255 parent bse0 vnetid 4 group OLDSHIT
> description "unmigrated shit"
> 
> router1# cat hostname.vlan6
> 192.168.4.2/24 192.168.4.255 parent bse0 vnetid 6 group TCWIFI
> description "Time-Capsule Wifi"
> 
> router1# cat hostname.carp4
> 192.168.1.1/24 carpdev vlan4 pass fukdissh1t vhid 41 advskew 1
> description "TC-WIFI gateway"
> 
> router1# cat hostname.carp6
> 192.168.4.1/24 carpdev vlan6 pass fukdissh1t vhid 61 advskew 1
> description "TC-WIFI gateway"
> 
> 
> Router2 network config:
> ---
> router2# cat hostname.bse0
> up
> 
> router2# cat hostname.vlan2
> 172.16.1.7/24 172.16.1.255 parent bse0 vnetid 2 group PFSYNC
> description "private segment with router1"
> 
> router2# cat hostname.vlan3
> 10.0.1.101/24 10.0.1.255 parent bse0 vnetid 3 group INTERNAL
> description "router2 internal interface"
> 
> router2# cat hostname.vlan4
> 192.168.1.253/24 192.168.1.255 parent bse0 vnetid 4 group OLDSHIT
> description "unmigrated shit"
> 
> router2# cat hostname.vlan6
> 192.168.4.3/24 192.168.4.255 parent bse0 vnetid 6 group TCWIFI
> description "Time-Capsule Wifi"
> 
> router2# cat hostname.carp4
> 192.168.1.1/24 carpdev vlan4 pass fukdissh1t vhid 41 advskew 128
> description "TC-WIFI gateway"
> 
> router2# cat hostname.carp6
> 192.168.4.1/24 carpdev vlan6 pass fukdissh1t vhid 61 advskew 128
> description "TC-WIFI gateway"
> 
> 
> Any tips much appreciated.
> 
> -mike
> 

-- 



Advice on serial port communication

2021-05-24 Thread Joseph Olatt
Hi,

I am trying to install OpenBSD (6.9) on a Beaglebone (Black, I presume -- it
is a kit from Vilros). I followed the instructions at:

  https://ftp.openbsd.org/pub/OpenBSD/6.9/armv7/INSTALL.armv7

When I try to connect to the console via the serial port using cu, as
described in the instructions, I get lines of "C"s. This happens at only
115200 baud rate. At all other baud rates, I get nothing.

Any advice on what those "C"s mean. The serial cable I'm using is:

  
https://www.amazon.com/GearMo%C2%AE-3-3v-Header-like-TTL-232R-3V3/dp/B004LBXO2A/

Thank you.



Re: iwm0: fatal firmware error

2021-05-24 Thread Stefan Sperling
On Mon, May 24, 2021 at 02:35:02PM +0200, Marco Scholz wrote:
> Hello.
> My laptop (Lenovo Thinkpad T495s AMD Ryzen) reports an iwm0 fatal
> firmware error. I'm running 6.9 #29.
> System gets quite hot, systat shows 40-50% interrupt while idling.
> Networking works fine.
> 
> Anybody else has this issue?

This looks like a known issue. I hope to get it fixed eventually but for
now there other changes we need to make with higher priority (i.e. we
need fimware updates for fragattack security fixes).



iwm0: fatal firmware error

2021-05-24 Thread Marco Scholz
Hello.
My laptop (Lenovo Thinkpad T495s AMD Ryzen) reports an iwm0 fatal
firmware error. I'm running 6.9 #29.
System gets quite hot, systat shows 40-50% interrupt while idling.
Networking works fine.

Anybody else has this issue?

Regards, Marco.

OpenBSD 6.9-current (GENERIC.MP) #29: Fri May 21 13:20:08 MDT 2021
dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 6334730240 (6041MB)
avail mem = 6127292416 (5843MB)
random: good seed from bootblocks
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 3.1 @ 0xbc025000 (63 entries)
bios0: vendor LENOVO version "R13ET27W(1.01 )" date 04/18/2019
bios0: LENOVO 20QJ000AUS
acpi0 at bios0: ACPI 5.0
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP SSDT SSDT SSDT MSDM SLIC BATB HPET APIC MCFG
SBST WSMT VFCT IVRS SSDT CRAT CDIT FPDT SSDT SSDT SSDT UEFI
acpi0: wakeup devices GPP0(S3) GPP1(S3) GPP2(S3) GPP3(S3) GPP4(S3)
L850(S3) GPP5(S3) GPP6(S3) GP17(S3) XHC0(S3) XHC1(S3) GP18(S3) LID_(S3)
SLPB(S3)
acpitimer0 at acpi0: 3579545 Hz, 32 bits
acpihpet0 at acpi0: 14318180 Hz
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: AMD Ryzen 5 PRO 3500U w/ Radeon Vega Mobile Gfx, 2096.35 MHz,
17-18-01
cpu0:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,PCLMUL,MWAIT,SSSE3,FMA3,CX16,SSE4.1,SSE4.2,MOVBE,POPCNT,AES,XSAVE,AVX,F16C,RDRAND,NXE,MMXX,FFXSR,PAGE1GB,RDTSCP,LONG,LAHF,CMPLEG,SVM,EAPICSP,AMCR8,ABM,SSE4A,MASSE,3DNOWP,OSVW,SKINIT,TCE,TOPEXT,CPCTR,DBKP,PCTRL3,MWAITX,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,RDSEED,ADX,SMAP,CLFLUSHOPT,SHA,IBPB,XSAVEOPT,XSAVEC,XGETBV1,XSAVES
cpu0: 64KB 64b/line 4-way I-cache, 32KB 64b/line 8-way D-cache, 512KB
64b/line 8-way L2 cache
cpu0: ITLB 64 4KB entries fully associative, 64 4MB entries fully
associative
cpu0: DTLB 64 4KB entries fully associative, 64 4MB entries fully
associative
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
cpu0: apic clock running at 24MHz
cpu0: mwait min=64, max=64, C-substates=1.1, IBE
cpu1 at mainbus0: apid 1 (application processor)
cpu1: AMD Ryzen 5 PRO 3500U w/ Radeon Vega Mobile Gfx, 2096.08 MHz,
17-18-01
cpu1:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,PCLMUL,MWAIT,SSSE3,FMA3,CX16,SSE4.1,SSE4.2,MOVBE,POPCNT,AES,XSAVE,AVX,F16C,RDRAND,NXE,MMXX,FFXSR,PAGE1GB,RDTSCP,LONG,LAHF,CMPLEG,SVM,EAPICSP,AMCR8,ABM,SSE4A,MASSE,3DNOWP,OSVW,SKINIT,TCE,TOPEXT,CPCTR,DBKP,PCTRL3,MWAITX,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,RDSEED,ADX,SMAP,CLFLUSHOPT,SHA,IBPB,XSAVEOPT,XSAVEC,XGETBV1,XSAVES
cpu1: 64KB 64b/line 4-way I-cache, 32KB 64b/line 8-way D-cache, 512KB
64b/line 8-way L2 cache
cpu1: ITLB 64 4KB entries fully associative, 64 4MB entries fully
associative
cpu1: DTLB 64 4KB entries fully associative, 64 4MB entries fully
associative
cpu1: disabling user TSC (skew=-2613216764)
cpu1: smt 1, core 0, package 0
cpu2 at mainbus0: apid 2 (application processor)
cpu2: AMD Ryzen 5 PRO 3500U w/ Radeon Vega Mobile Gfx, 2096.08 MHz,
17-18-01
cpu2:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,PCLMUL,MWAIT,SSSE3,FMA3,CX16,SSE4.1,SSE4.2,MOVBE,POPCNT,AES,XSAVE,AVX,F16C,RDRAND,NXE,MMXX,FFXSR,PAGE1GB,RDTSCP,LONG,LAHF,CMPLEG,SVM,EAPICSP,AMCR8,ABM,SSE4A,MASSE,3DNOWP,OSVW,SKINIT,TCE,TOPEXT,CPCTR,DBKP,PCTRL3,MWAITX,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,RDSEED,ADX,SMAP,CLFLUSHOPT,SHA,IBPB,XSAVEOPT,XSAVEC,XGETBV1,XSAVES
cpu2: 64KB 64b/line 4-way I-cache, 32KB 64b/line 8-way D-cache, 512KB
64b/line 8-way L2 cache
cpu2: ITLB 64 4KB entries fully associative, 64 4MB entries fully
associative
cpu2: DTLB 64 4KB entries fully associative, 64 4MB entries fully
associative
cpu2: disabling user TSC (skew=-2613216711)
cpu2: smt 0, core 1, package 0
cpu3 at mainbus0: apid 3 (application processor)
cpu3: AMD Ryzen 5 PRO 3500U w/ Radeon Vega Mobile Gfx, 2096.08 MHz,
17-18-01
cpu3:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,PCLMUL,MWAIT,SSSE3,FMA3,CX16,SSE4.1,SSE4.2,MOVBE,POPCNT,AES,XSAVE,AVX,F16C,RDRAND,NXE,MMXX,FFXSR,PAGE1GB,RDTSCP,LONG,LAHF,CMPLEG,SVM,EAPICSP,AMCR8,ABM,SSE4A,MASSE,3DNOWP,OSVW,SKINIT,TCE,TOPEXT,CPCTR,DBKP,PCTRL3,MWAITX,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,RDSEED,ADX,SMAP,CLFLUSHOPT,SHA,IBPB,XSAVEOPT,XSAVEC,XGETBV1,XSAVES
cpu3: 64KB 64b/line 4-way I-cache, 32KB 64b/line 8-way D-cache, 512KB
64b/line 8-way L2 cache
cpu3: ITLB 64 4KB entries fully associative, 64 4MB entries fully
associative
cpu3: DTLB 64 4KB entries fully associative, 64 4MB entries fully
associative
cpu3: disabling user TSC (skew=-2613216774)
cpu3: smt 1, core 1, package 0
cpu4 at mainbus0: apid 4 (application processor)
cpu4: AMD Ryzen 5 PRO 3500U w/ Radeon Vega Mobile Gfx, 2096.08 MHz,
17-18-01
cpu4:

Re: argv from bogus argc

2021-05-24 Thread Kihaguru Gathura
Yes, I did !

Thank you.

On Mon, May 24, 2021 at 4:51 PM Omar Polo  wrote:

>
> Kihaguru Gathura  writes:
>
> > While testing to determine command line arguments passed to a cgi file
> > using the *function 1*, I receive the  message *output 1.*
> > one argument is passed and that is the name of the file.
> >
> > However, testing with a bogus number 30 for argc in *function 2*,
> discloses
> > multiple arguments beyond the last null argument argv[1] see *output 2.*
> > There is also a null value at bogus argc number 29.
> >
> > Why are these additional argv values generated?
>
> haven't you gone out-of-bound and started printing the envp?
>
> >
> >
> >
> > *Function 1:*
> >
> >
> >
> > /**/
> >
> > void TestCommandLineArguments(int argc, char *argv[])
> > {
> >   unsigned short int i = 0;
> >
> >   if (argc == 1)  /* if one command line argument is passed
> */
> >   {
> >   PrintPageUpper();
> >
> >   while(i < argc)
> >   {
> >   printf("\t\t(i = %2$d) argc: %1$d, \
> >argv[%2$d]: \"%3$s\"\n", argc, \
> >i, argv[i]);
> >   i++;
> >   }
> >
> >   PrintPageLower();
> >   exit(EXIT_SUCCESS);
> >
> >}
> >
> > if (argc != 1)
> > {
> > PrintPageUpper();
> > puts("\t\t(Multiple Arguments)");
> > PrintPageLower();
> > exit(EXIT_SUCCESS);
> > }
> > }
> >
> >
> > /**/
> >
> >
> > *Output 1:   *
> >
> > (i = 0) argc: 1, argv[0]: "//xyz/xyz.html"
> >
> >
> >
> >
> >
> >
> > *Function 2:*
> >
> >
> > /**/
> >
> > void TestCommandLineArguments(int argc, char *argv[])
> > {
> >   unsigned short int i = 0;
> >   #define BOGUS_ARGC 30
> >
> >   if (argc == 1)
> >   {
> >   PrintPageUpper();
> >
> >   while(i < BOGUS_ARGC)
> >   {
> >   printf("\t\t(i = %2$d) argc: %1$d, \
> >argv[%2$d]: \"%3$s\"\n", BOGUS_ARGC, \
> >i, argv[i]);
> >   i++;
> >   }
> >
> >   PrintPageLower();
> >   exit(EXIT_SUCCESS);
> >
> >}
> >
> > if (argc == 1)
> > {
> > PrintPageUpper();
> > puts("\t\t(Single Argument)");
> > PrintPageLower();
> > exit(EXIT_SUCCESS);
> > }
> > }
> >
> >
> > /**/
> >
> > *Output 2:*
> >
> >   (i = 0) argc: 30,
> argv[0]:
> > "//xyz/xyz.html"
> >   (i = 1) argc: 30,
> argv[1]: "(null)"
> >   (i = 2) argc: 30,
> argv[2]:
> > "SERVER_SOFTWARE=OpenBSD httpd"
> >   (i = 3) argc: 30,
> argv[3]:
> > "SERVER_PROTOCOL=HTTP/1.1"
> >   (i = 4) argc: 30,
> argv[4]:
> > "SERVER_NAME=xyz.com"
> >   (i = 5) argc: 30,
> argv[5]:
> > "SERVER_PORT=443"
> >   (i = 6) argc: 30,
> argv[6]:
> > "SERVER_ADDR=xyz.xyz.xy.xyz"
> >   (i = 7) argc: 30,
> argv[7]:
> > "REQUEST_URI=/xyz/xyz.html"
> >   (i = 8) argc: 30,
> argv[8]:
> > "REQUEST_METHOD=GET"
> >   (i = 9) argc: 30,
> argv[9]:
> > "REMOTE_PORT=36818"
> >   (i = 10) argc: 30,
> argv[10]:
> > "REMOTE_ADDR=xyz.xyz.xy.xyz"
> >   (i = 11) argc: 30,
> argv[11]: "HTTPS=on"
> >   (i = 12) argc: 30,
> argv[12]:
> > "HTTP_X_FORWARDED_FOR=xyz.xyz.xy.xyz"
> >   (i = 13) argc: 30,
> argv[13]:
> > "HTTP_X_FORWARDED_BY=xyz.xyz.xy.xyz:8443"
> >   (i = 14) argc: 30,
> argv[14]:
> > "HTTP_USER_AGENT=Mozilla/5.0 (X11; OpenBSD amd64; rv:62.0)
> > Gecko/20100101 Firefox/62.0"
> >   (i = 15) argc: 30,
> argv[15]:
> > "HTTP_UPGRADE_INSECURE_REQUESTS=1"
> >   (i = 16) argc: 30,
> argv[16]:
> > "HTTP_HOST=xyz.com"
> >   (i = 17) argc: 30,
> argv[17]:
> > "HTTP_CONNECTION=keep-alive"
> >   (i = 18) argc: 30,
> argv[18]:
> > "HTTP_CACHE_CONTROL=max-age=0"
> >   (i = 19) argc: 30,
> argv[19]:
> > "HTTP_ACCEPT_LANGUAGE=en-US,en;q=0.5"
> >   (i = 20) argc: 30,
> argv[20]:
> > "HTTP_ACCEPT_ENCODING=gzip, deflate, br"
> >   (i = 21) argc: 30,
> argv[21]:
> >
> "HTTP_ACCEPT=text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
> >   (i = 22) argc: 30,
> argv[22]:
> > "GATEWAY_INTERFACE=CGI/1.1"
> >   (i = 

Re: argv from bogus argc

2021-05-24 Thread Omar Polo


Kihaguru Gathura  writes:

> While testing to determine command line arguments passed to a cgi file
> using the *function 1*, I receive the  message *output 1.*
> one argument is passed and that is the name of the file.
>
> However, testing with a bogus number 30 for argc in *function 2*, discloses
> multiple arguments beyond the last null argument argv[1] see *output 2.*
> There is also a null value at bogus argc number 29.
>
> Why are these additional argv values generated?

haven't you gone out-of-bound and started printing the envp?

>
>
>
> *Function 1:*
>
>   
>
> /**/
>
> void TestCommandLineArguments(int argc, char *argv[])
> {
>   unsigned short int i = 0;
>
>   if (argc == 1)  /* if one command line argument is passed */
>   {
>   PrintPageUpper();
>
>   while(i < argc)
>   {
>   printf("\t\t(i = %2$d) argc: %1$d, \
>argv[%2$d]: \"%3$s\"\n", argc, \
>i, argv[i]);
>   i++;
>   }
>
>   PrintPageLower();
>   exit(EXIT_SUCCESS);
>
>}
>
> if (argc != 1)
> {
> PrintPageUpper();
> puts("\t\t(Multiple Arguments)");
> PrintPageLower();
> exit(EXIT_SUCCESS);
> }
> }
>
>
> /**/
>
>
> *Output 1:   *
>
> (i = 0) argc: 1, argv[0]: "//xyz/xyz.html"
>
>
>
>
>
>
> *Function 2:*
>
>
> /**/
>
> void TestCommandLineArguments(int argc, char *argv[])
> {
>   unsigned short int i = 0;
>   #define BOGUS_ARGC 30
>
>   if (argc == 1)
>   {
>   PrintPageUpper();
>
>   while(i < BOGUS_ARGC)
>   {
>   printf("\t\t(i = %2$d) argc: %1$d, \
>argv[%2$d]: \"%3$s\"\n", BOGUS_ARGC, \
>i, argv[i]);
>   i++;
>   }
>
>   PrintPageLower();
>   exit(EXIT_SUCCESS);
>
>}
>
> if (argc == 1)
> {
> PrintPageUpper();
> puts("\t\t(Single Argument)");
> PrintPageLower();
> exit(EXIT_SUCCESS);
> }
> }
>
>
> /**/
>
> *Output 2:*
>
>   (i = 0) argc: 30,argv[0]:
> "//xyz/xyz.html"
>   (i = 1) argc: 30,argv[1]: 
> "(null)"
>   (i = 2) argc: 30,argv[2]:
> "SERVER_SOFTWARE=OpenBSD httpd"
>   (i = 3) argc: 30,argv[3]:
> "SERVER_PROTOCOL=HTTP/1.1"
>   (i = 4) argc: 30,argv[4]:
> "SERVER_NAME=xyz.com"
>   (i = 5) argc: 30,argv[5]:
> "SERVER_PORT=443"
>   (i = 6) argc: 30,argv[6]:
> "SERVER_ADDR=xyz.xyz.xy.xyz"
>   (i = 7) argc: 30,argv[7]:
> "REQUEST_URI=/xyz/xyz.html"
>   (i = 8) argc: 30,argv[8]:
> "REQUEST_METHOD=GET"
>   (i = 9) argc: 30,argv[9]:
> "REMOTE_PORT=36818"
>   (i = 10) argc: 30,argv[10]:
> "REMOTE_ADDR=xyz.xyz.xy.xyz"
>   (i = 11) argc: 30,argv[11]: 
> "HTTPS=on"
>   (i = 12) argc: 30,argv[12]:
> "HTTP_X_FORWARDED_FOR=xyz.xyz.xy.xyz"
>   (i = 13) argc: 30,argv[13]:
> "HTTP_X_FORWARDED_BY=xyz.xyz.xy.xyz:8443"
>   (i = 14) argc: 30,argv[14]:
> "HTTP_USER_AGENT=Mozilla/5.0 (X11; OpenBSD amd64; rv:62.0)
> Gecko/20100101 Firefox/62.0"
>   (i = 15) argc: 30,argv[15]:
> "HTTP_UPGRADE_INSECURE_REQUESTS=1"
>   (i = 16) argc: 30,argv[16]:
> "HTTP_HOST=xyz.com"
>   (i = 17) argc: 30,argv[17]:
> "HTTP_CONNECTION=keep-alive"
>   (i = 18) argc: 30,argv[18]:
> "HTTP_CACHE_CONTROL=max-age=0"
>   (i = 19) argc: 30,argv[19]:
> "HTTP_ACCEPT_LANGUAGE=en-US,en;q=0.5"
>   (i = 20) argc: 30,argv[20]:
> "HTTP_ACCEPT_ENCODING=gzip, 

argv from bogus argc

2021-05-24 Thread Kihaguru Gathura
While testing to determine command line arguments passed to a cgi file
using the *function 1*, I receive the  message *output 1.*
one argument is passed and that is the name of the file.

However, testing with a bogus number 30 for argc in *function 2*, discloses
multiple arguments beyond the last null argument argv[1] see *output 2.*
There is also a null value at bogus argc number 29.

Why are these additional argv values generated?




*Function 1:*



/**/

void TestCommandLineArguments(int argc, char *argv[])
{
  unsigned short int i = 0;

  if (argc == 1)  /* if one command line argument is passed */
  {
  PrintPageUpper();

  while(i < argc)
  {
  printf("\t\t(i = %2$d) argc: %1$d, \
   argv[%2$d]: \"%3$s\"\n", argc, \
   i, argv[i]);
  i++;
  }

  PrintPageLower();
  exit(EXIT_SUCCESS);

   }

if (argc != 1)
{
PrintPageUpper();
puts("\t\t(Multiple Arguments)");
PrintPageLower();
exit(EXIT_SUCCESS);
}
}


/**/


*Output 1:   *

(i = 0) argc: 1, argv[0]: "//xyz/xyz.html"






*Function 2:*


/**/

void TestCommandLineArguments(int argc, char *argv[])
{
  unsigned short int i = 0;
  #define BOGUS_ARGC 30

  if (argc == 1)
  {
  PrintPageUpper();

  while(i < BOGUS_ARGC)
  {
  printf("\t\t(i = %2$d) argc: %1$d, \
   argv[%2$d]: \"%3$s\"\n", BOGUS_ARGC, \
   i, argv[i]);
  i++;
  }

  PrintPageLower();
  exit(EXIT_SUCCESS);

   }

if (argc == 1)
{
PrintPageUpper();
puts("\t\t(Single Argument)");
PrintPageLower();
exit(EXIT_SUCCESS);
}
}


/**/

*Output 2:*

(i = 0) argc: 30,argv[0]:
"//xyz/xyz.html"
(i = 1) argc: 30,argv[1]: 
"(null)"
(i = 2) argc: 30,argv[2]:
"SERVER_SOFTWARE=OpenBSD httpd"
(i = 3) argc: 30,argv[3]:
"SERVER_PROTOCOL=HTTP/1.1"
(i = 4) argc: 30,argv[4]:
"SERVER_NAME=xyz.com"
(i = 5) argc: 30,argv[5]:
"SERVER_PORT=443"
(i = 6) argc: 30,argv[6]:
"SERVER_ADDR=xyz.xyz.xy.xyz"
(i = 7) argc: 30,argv[7]:
"REQUEST_URI=/xyz/xyz.html"
(i = 8) argc: 30,argv[8]:
"REQUEST_METHOD=GET"
(i = 9) argc: 30,argv[9]:
"REMOTE_PORT=36818"
(i = 10) argc: 30,argv[10]:
"REMOTE_ADDR=xyz.xyz.xy.xyz"
(i = 11) argc: 30,argv[11]: 
"HTTPS=on"
(i = 12) argc: 30,argv[12]:
"HTTP_X_FORWARDED_FOR=xyz.xyz.xy.xyz"
(i = 13) argc: 30,argv[13]:
"HTTP_X_FORWARDED_BY=xyz.xyz.xy.xyz:8443"
(i = 14) argc: 30,argv[14]:
"HTTP_USER_AGENT=Mozilla/5.0 (X11; OpenBSD amd64; rv:62.0)
Gecko/20100101 Firefox/62.0"
(i = 15) argc: 30,argv[15]:
"HTTP_UPGRADE_INSECURE_REQUESTS=1"
(i = 16) argc: 30,argv[16]:
"HTTP_HOST=xyz.com"
(i = 17) argc: 30,argv[17]:
"HTTP_CONNECTION=keep-alive"
(i = 18) argc: 30,argv[18]:
"HTTP_CACHE_CONTROL=max-age=0"
(i = 19) argc: 30,argv[19]:
"HTTP_ACCEPT_LANGUAGE=en-US,en;q=0.5"
(i = 20) argc: 30,argv[20]:
"HTTP_ACCEPT_ENCODING=gzip, deflate, br"
(i = 21) argc: 30,argv[21]:
"HTTP_ACCEPT=text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
(i = 22) argc: 30,argv[22]:
"GATEWAY_INTERFACE=CGI/1.1"
(i = 23) argc: 

EVP_DIGESTINIT(3) vs. MD5(3) and my CPU

2021-05-24 Thread Peter J. Philipp
Hi,

I did a search on marc.info on this but didn't come to a conclusion.  So the
subject already says it, the MD5(3) manpage says that the EVP functions should
be used, ok.  I'm hoping that using the EVP functions will give me hardware
support at these hashing functions much like AESNI, however, how do I know that
my CPU supports hardware accelleration of MD5, SHA1, or SHA256?  What flags
must I know on the cpu?

I'm about to do a conversion on my main program which uses all these hash
mechanisms to EVP, I'd love to get cpu support.  If I don't get MD5 support
I would replace it with a SHA1 or SHA2 function in my code.

Here is a sample CPU on one of my vps's:

cpu0: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,PCLMUL,SSSE3,FMA3,CX16,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,AES,XSAVE,AVX,F16C,RDRAND,HV,NXE,MMXX,FFXSR,PAGE1GB,RDTSCP,LONG,LAHF,CMPLEG,AMCR8,ABM,SSE4A,MASSE,3DNOWP,OSVW,TOPEXT,FSGSBASE,BMI1,AVX2,SMEP,BMI2,RDSEED,ADX,SMAP,CLFLUSHOPT,SHA,IBPB,SSBD,XSAVEOPT,XSAVEC,XGETBV1

I see AES (AESNI?), SHA (does this offload SHA hashing?).

Best Regards,
-peter