Usage of '@cwd' and '@srcdir' in a package list

2012-02-07 Thread Patrick Mahan
All,

Need a little direction on package creation.  This issue
is hitting me on both 8.0, 8.2 and 9.0 FreeBSD (amd64)
releases.

I'm trying to create a package using pkg_create with
the intention of installing under /usr/local.  However,
my build environment is private (not under /usr/ports
or /usr/src) and I *do not* install before creating
the package file.

My problem is that if I have the following in my
package list file -

@cwd /usr/local
@srcdir .
...
relative filepaths
...

The the pkg_create fails with tar complaining about
not being able to source the files, even though I
invoke pkg_create at the top of the subtree and the
files are relative to my current working directory.

I have also tried the '-s `pwd`' option to pkg_create
as well, with no success.

Removing the @cwd line allows the package to be built.

Reading the man page it states

@srcdir directory
 Set the internal directory pointer for _creation only_ to
 directory.  That is to say that it overrides @cwd for
 package creation but not extraction.

Which seems to be what I want but why is it not overriding?

Any pointers are welcomed.

Thanks,

Patrick
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


RE: Problems building world with 9.0 RC3 [SOLVED]

2012-01-10 Thread Patrick Mahan
-Original Message-
From: owner-freebsd-questi...@freebsd.org [mailto:owner-freebsd-
questi...@freebsd.org] On Behalf Of Patrick Mahan
Sent: Monday, January 09, 2012 4:28 PM
To: freebsd-questions@freebsd.org
Subject: Problems building world with 9.0 RC3

All,

I am having an issue with getting buildworld to work for me.  It is failing
while building zfs -

cc -DADARA_OS  -
I/data/pmahan/devel/pm_ipr9.0/ipr9.0/src/cddl/sbin/zfs/../../../cddl/contrib
/opensolaris/lib/libzpool/common -
I/data/pmahan/devel/pm_ipr9.0/ipr9.0/src/cddl/sbin/zfs/../../../cddl/compat/
opensolaris/include -
I/data/pmahan/devel/pm_ipr9.0/ipr9.0/src/cddl/sbin/zfs/../../../cddl/compat/
opensolaris/lib/libumem -
I/data/pmahan/devel/pm_ipr9.0/ipr9.0/src/cddl/sbin/zfs/../../../sys/cddl/com
pat/opensolaris -
I/data/pmahan/devel/pm_ipr9.0/ipr9.0/src/cddl/sbin/zfs/../../../cddl/contrib
/opensolaris/head -
I/data/pmahan/devel/pm_ipr9.0/ipr9.0/src/cddl/sbin/zfs/../../../cddl/contrib
/opensolaris/lib/libuutil/common -
I/data/pmahan/devel/pm_ipr9.0/ipr9.0/src/cddl/sbin/zfs/../../../cddl/contrib
/opensolaris/lib/libzfs/common -
I/data/pmahan/devel/pm_ipr9.0/ipr9.0/src/cddl/sbin/zfs/../../../cddl/contrib
/opensolaris/lib/libumem/common -
I/data/pmahan/devel/pm_ipr9.0/ipr9.0/src/cddl/sbin/zfs/../../../cddl/contrib
/opensolaris/lib/libnvpair -
I/data/pmahan/devel/pm_ipr9.0/ipr9.0/src/cddl/sbin/zfs/../../../sys/cddl/con
trib/opensolaris/uts/common -
I/data/pmahan/devel/pm_ipr9.0/ipr9.0/src/cddl/sbin/zfs/../../../sys/cddl/con
trib/opensolaris/uts/common/fs/zfs -
I/data/pmahan/devel/pm_ipr9.0/ipr9.0/src/cddl/sbin/zfs/../../../sys/cddl/con
trib/opensolaris/uts/common/sys -
I/data/pmahan/devel/pm_ipr9.0/ipr9.0/src/cddl/sbin/zfs/../../../sys/cddl/con
trib/opensolaris/common/zfs -DNEED_SOLARIS_BOOLEAN -std=gnu89 -fstack-
protector -Wno-pointer-sign -Wno-unknown-pragmas  -o zfs zfs_main.o
zfs_iter.o -lbsdxml -lgeom -lm -lnvpair -lsbuf -lumem -lutil -luutil -lzfs
/lib/libthr.so.3: undefined reference to `__pselect@FBSDprivate_1.0'
/data/pmahan/devel/pm_ipr9.0/ipr9.0/amd64/obj/data/pmahan/devel/pm_ipr9.0/ip
r9.0/src/tmp/usr/lib/libzfs.so: undefined reference to `openat@FBSD_1.2'

Now, when I take a look at libpthr.so.3 I for '__pselect' I find -

pmahan@libthr 90  readelf --symbols libthr.so.3 | grep __pselect
   455: c000   120 FUNCGLOBAL DEFAULT   11
___pselect@@FBSDprivate_1.0
   624: c000   120 FUNCGLOBAL DEFAULT   11 ___pselect

So I see the symbol there but with a double @ not a single.  I don't see
any errors generated
when libthr.so.3 is being built so I'm a bit of a loss to understand this.
I saw in my googling that
the wacky symbol naming was introduced sometime in 8.x, but I I couldn't
find anything explaining
the symbol generation.

So I am looking for pointers on how to track this one down.  Is this a
compiler issue?


I figured this out today, thanks to a colleague who was building just fine.
It turns out that I had LD_LIBRARY_PATH set in my environment (no particular
reason, just left over environmental stuff from years of abuse).

It pointed to '/lib:/usr/lib:/usr/local/lib'

So I'm guessing the it was picking up a library outside of the buildworld
sandbox.  Looking at the failed command I notice that there are no -L
directives.  Wouldn't this have over-ridden my LD_LIBRARY_PATH?  In any case
I have removed that from my shell environment and everything is now building.

Thanks,

Patrick

Patrick Mahan
Lead Technical Kernel Engineer
Adara Networks
Disclaimer: The opinions expressed here are solely the responsibility of the 
author and are not to be
construed as an official opinion of Adara Networks.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Problems building world with 9.0 RC3

2012-01-09 Thread Patrick Mahan
All,

I am having an issue with getting buildworld to work for me.  It is failing
while building zfs -

cc -DADARA_OS  
-I/data/pmahan/devel/pm_ipr9.0/ipr9.0/src/cddl/sbin/zfs/../../../cddl/contrib/opensolaris/lib/libzpool/common
 
-I/data/pmahan/devel/pm_ipr9.0/ipr9.0/src/cddl/sbin/zfs/../../../cddl/compat/opensolaris/include
 
-I/data/pmahan/devel/pm_ipr9.0/ipr9.0/src/cddl/sbin/zfs/../../../cddl/compat/opensolaris/lib/libumem
 
-I/data/pmahan/devel/pm_ipr9.0/ipr9.0/src/cddl/sbin/zfs/../../../sys/cddl/compat/opensolaris
 
-I/data/pmahan/devel/pm_ipr9.0/ipr9.0/src/cddl/sbin/zfs/../../../cddl/contrib/opensolaris/head
 
-I/data/pmahan/devel/pm_ipr9.0/ipr9.0/src/cddl/sbin/zfs/../../../cddl/contrib/opensolaris/lib/libuutil/common
 
-I/data/pmahan/devel/pm_ipr9.0/ipr9.0/src/cddl/sbin/zfs/../../../cddl/contrib/opensolaris/lib/libzfs/common
 
-I/data/pmahan/devel/pm_ipr9.0/ipr9.0/src/cddl/sbin/zfs/../../../cddl/contrib/opensolaris/lib/libumem/common
 
-I/data/pmahan/devel/pm_ipr9.0/ipr9.0/src/cddl/sbin/zfs/../../../cddl/contrib/opensolaris/lib/libnvpair
 
-I/data/pmahan/devel/pm_ipr9.0/ipr9.0/src/cddl/sbin/zfs/../../../sys/cddl/contrib/opensolaris/uts/common
 
-I/data/pmahan/devel/pm_ipr9.0/ipr9.0/src/cddl/sbin/zfs/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs
 
-I/data/pmahan/devel/pm_ipr9.0/ipr9.0/src/cddl/sbin/zfs/../../../sys/cddl/contrib/opensolaris/uts/common/sys
 
-I/data/pmahan/devel/pm_ipr9.0/ipr9.0/src/cddl/sbin/zfs/../../../sys/cddl/contrib/opensolaris/common/zfs
 -DNEED_SOLARIS_BOOLEAN -std=gnu89 -fstack-protector -Wno-pointer-sign 
-Wno-unknown-pragmas  -o zfs zfs_main.o zfs_iter.o -lbsdxml -lgeom -lm -lnvpair 
-lsbuf -lumem -lutil -luutil -lzfs
/lib/libthr.so.3: undefined reference to `__pselect@FBSDprivate_1.0'
/data/pmahan/devel/pm_ipr9.0/ipr9.0/amd64/obj/data/pmahan/devel/pm_ipr9.0/ipr9.0/src/tmp/usr/lib/libzfs.so:
 undefined reference to `openat@FBSD_1.2'

Now, when I take a look at libpthr.so.3 I for '__pselect' I find -

pmahan@libthr 90  readelf --symbols libthr.so.3 | grep __pselect 
   
   455: c000   120 FUNCGLOBAL DEFAULT   11 
___pselect@@FBSDprivate_1.0
   624: c000   120 FUNCGLOBAL DEFAULT   11 ___pselect

So I see the symbol there but with a double @ not a single.  I don't see any 
errors generated
when libthr.so.3 is being built so I'm a bit of a loss to understand this.  I 
saw in my googling that
the wacky symbol naming was introduced sometime in 8.x, but I I couldn't find 
anything explaining
the symbol generation.

So I am looking for pointers on how to track this one down.  Is this a compiler 
issue?

Thanks,

Patrick___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


BIOS configuration for a Gigabyte GA-X58A-UD3R and i7 Intel processor

2012-01-02 Thread Patrick Mahan
All,

I am putting together a DIY system using a Gigabyte motherboard
and the Intel i7.  I plan on running FreeBSD 9.0 as the based OS.
I have a Seagate 1 TB Barracuda for the hard drive connected to
one of the sata controllers.

I've got a couple of questions regarding the SATA setup.

The motherboard has an Intel ICH10R South Bridge controlling
6 SATA2 (3.0 Gbs/s) devices, Gigabyte controlling 2 GSATA2 devices
(3.0 Gb/s) and a Marvell 9128 SATA3 (6.0 Gb/s) devices.

I currently have the HDD connected to the ICH10R.  My first question
is simply confirmation of what my googling seems to have turned up -
that this controller is supported by FreeBSD.

2nd question, the BIOS setup lists this controller mode as IDE
and the other possible values are -

  IDE = Disables RAID for this SATA controller, configures the
  controller in IDE mode

  RAID = Enables RAID for this SATA controller

  AHCI = Configures the SATA controller to Advanced Host Controller
   Interface mode to support enabled advanced Serial ATA
   commands such as Native Command Queuing and Hot plug.

Which mode is the best for FreeBSD?  The BIOS default is IDE.  I am
currently only using 1 HDD so I am not currently interested in RAID.
Is AHCI supported?

NOTE: these modes are listed for all three SATA controllers.

Thanks,

Patrick
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: BIOS configuration for a Gigabyte GA-X58A-UD3R and i7 Intel processor

2012-01-02 Thread Patrick Mahan


On 1/2/12 12:31 PM, Patrick Mahan wrote:
 All,
 
 I am putting together a DIY system using a Gigabyte motherboard
 and the Intel i7.  I plan on running FreeBSD 9.0 as the based OS.
 I have a Seagate 1 TB Barracuda for the hard drive connected to
 one of the sata controllers.
 
 I've got a couple of questions regarding the SATA setup.
 
 The motherboard has an Intel ICH10R South Bridge controlling
 6 SATA2 (3.0 Gbs/s) devices, Gigabyte controlling 2 GSATA2 devices
 (3.0 Gb/s) and a Marvell 9128 SATA3 (6.0 Gb/s) devices.
 
 I currently have the HDD connected to the ICH10R.  My first question
 is simply confirmation of what my googling seems to have turned up -
 that this controller is supported by FreeBSD.
 
 2nd question, the BIOS setup lists this controller mode as IDE
 and the other possible values are -
 
   IDE = Disables RAID for this SATA controller, configures the
   controller in IDE mode
 
   RAID = Enables RAID for this SATA controller
 
   AHCI = Configures the SATA controller to Advanced Host Controller
Interface mode to support enabled advanced Serial ATA
commands such as Native Command Queuing and Hot plug.
 
 Which mode is the best for FreeBSD?  The BIOS default is IDE.  I am
 currently only using 1 HDD so I am not currently interested in RAID.
 Is AHCI supported?
 
 NOTE: these modes are listed for all three SATA controllers.
 

All,

Slight addendum, I have found a link to Warren Block's instructions on
enabling AHCI support and others have pointed out that they are using
AHCI on GB motherboards.

Again, thanks,

Patrick
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


RE: Problems with keyboard on the loader menu

2011-12-08 Thread Patrick Mahan
-Original Message-
From: owner-freebsd-questi...@freebsd.org [mailto:owner-freebsd-
questi...@freebsd.org] On Behalf Of Airton Arantes
Sent: Wednesday, December 07, 2011 5:46 PM
To: freebsd-questions@freebsd.org
Subject: Problems with keyboard on the loader menu

I'm having troubles with my keyboard when the bootstrapping reach the
loader menu. My Keyboard simply doesn't works, but before and after the
loader menu my keyboard works very well. I have seen BIOS settings like USB
keyboard and nothing is helping. I didn't no one kernel tuning, I'm using
GENERIC. The Server is a HP Proliant DL120 G6. Does anyone here can help me?

--
Airton Arantes Coelho Filho


I have found that I have to do the following on some of our Proliant G5's -

  # cd /
  # echo -P  boot.conf

Also, are you using the VGA or the serial console?  We enable both (our serial
consoles are connected to terminal servers for remote access and VGA is used
for the physical access).  Our keyboards are USB.

This is with FreeBSD 8.0 AMD64

Patrick

Patrick Mahan
Lead Technical Kernel Engineer
Adara Networks
Disclaimer: The opinions expressed here are solely the responsibility of the 
author and are not to be
construed as an official opinion of Adara Networks.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


RE: CUPS and IPP/JD/LPD

2011-12-08 Thread Patrick Mahan
-Original Message-
From: Ryan Coleman [mailto:edi...@d3photography.com]
Sent: Thursday, December 08, 2011 9:24 AM
To: Patrick Mahan
Cc: FreeBSD Questions
Subject: Re: CUPS and IPP/JD/LPD

Definitely Postscript.


With CUPS, I'm don't remember off the top of my head, but I believe there is a 
way
to create a text only queue.  You might want to setup a box with CUPS and use 
that
to act as an intermediary for the iOS devices.

Patrick

Patrick Mahan
Lead Technical Kernel Engineer
Adara Networks
Disclaimer: The opinions expressed here are solely the responsibility of the 
author and are not to be
construed as an official opinion of Adara Networks.

On Dec 8, 2011, at 10:59 AM, Patrick Mahan wrote:

 -Original Message-
 From: owner-freebsd-questi...@freebsd.org [mailto:owner-freebsd-
 questi...@freebsd.org] On Behalf Of Ryan Coleman
 Sent: Thursday, December 08, 2011 8:41 AM
 To: FreeBSD Questions
 Subject: CUPS and IPP/JD/LPD

 I have a printer that doesn't support IPP. The leasing agency wants to
 charge me $1400 to install the Postcript driver on it but I'm looking
at
 another solution, if possible: CUPS.

 I have a MacBook and we have a number of iOS devices around the office
here
 that people would love to be able to print from... but AirPrint requires
an
 IPP-compatible printer.

 Is there a way to convert or translate IPP to either LPD or JetDirect?

 --
 Ryan


 Ryan,

 I use JetDirect with my Apple devices.  I print to a HP OfficeJet 7310
all-in-one
 with no problems.

 I had and older HP Color inkjet (930?) that was hooked up for a while to a
Fedora
 Core box that was using LPD that worked as well.

 Patrick
 
 Patrick Mahan
 Lead Technical Kernel Engineer
 Adara Networks
 Disclaimer: The opinions expressed here are solely the responsibility of
the author and are not to be
 construed as an official opinion of Adara Networks.
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to freebsd-questions-
unsubscr...@freebsd.org

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: kernel Panic not dumping to swap

2011-08-12 Thread Patrick Mahan


On 8/9/11 10:33 PM, Daryl Sayers wrote:
 I have a FreeBSD 8.2-STABLE (64bit) system with 4G mem installed. I have
 had a few kernel panics over the last few weeks and would like to capture
 a core dump. I have added the following to /etc/rc.conf
 
 dumpdev=AUTO
 dumpdir=/var/crash
 
 The /var/crash is a 5G filesystem (with 4.8G free).
 When the machine panics the last 2 lines on the console are something like:
 
 
 Physical memory: 3057 MB
 Dumping 204 MB: 189 173 157 141 125
 
 
 The system then completely hangs and a hardware rest is required. As the dump
 does not seem to finish I dont get my core dump in /var/cache when the machine
 reboots.
 
 Any ideas??
 

Daryl,

A couple of questions:

1) How big is your swap partition?  Is it large enough to hold the crash dump?
2) What type of hardware is this? I know that HP Proliants using the CISS raid
   control fail to produce a crashdump and just hangup these boxes.  Perhaps
   this occurs for other types of hardware?

Patrick
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Long Day's Journey into Bleep

2011-06-09 Thread Patrick Mahan


On 6/8/11 5:56 PM, Gary Kline wrote:
 
 Well, people, 
 
 It's been a long, long century.  I've been down for 5 days.
 Couldn't understand _why_ I couldn't ping anywhere [expect the
 Server itself].  Finally, tho, it became more and more likely that
 my FreeBSD was fine ... even tho I kept stripping the most likely
 problem points.  My large 16-port LinkSys router was either *it* or
 it was some kind of bug unknown to geekdom.  After a friend bought
 me a new (and tiny) 8-port switch, yes!  I could ping everywhere.  
 
 I'm still bringing back the dozens of things I removed from ethic.
 And testing new ideas.  But I have a general question: have any of
 you wizards who run your own domains or otherwise use a switch [or
 hub] *ever* had it just-quit?!  It is solid-state.  Yes, the box is
 within my feet/foot reach.  I have accidently kicked it i suppose,
 but still.  
 
 After wandering in the wilderness for 5 days, mmph, dunno.  
 
 gary
 
 PS: yes, this is a serious question.  1) I like things-Cisco, and 
 LinkSys.  I just bought this switch about 2.5 years ago, so I really
 am looking for feedback.
 
 PPS:  Another question to ask about upgrading is next.
 
 

Gary,

I have had to replace my linksys 8 port switch twice in the past 10
years I have been maintaining my own domain.  In fact, when I
have a lost network connection error, after verifying that it's not
the computer, not the Wireless AP, then I look at this box.  Most
of the time a simple power cycle restores functionality.  Yes it's
more or less solid state, but it is busy 24/7 between my kids surfing,
my job, my wife's research, the dvr updating, the iTouch's downloading
apps, my smart phone receiving email, etc.  Sometimes it just
fails...

And sometimes it just keeps chugging on, my Cisco 800 DSL modem is
as old and aside from the initial setup and arguging with the DSL
provider, it has been working for the same 10 years, no failures,
just the occasional dslam drop that requires a reboot and I'm back
online.

Patrick
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


RE: serial config handbook: /boot.conf or /boot.config

2011-02-01 Thread Patrick Mahan


 -Original Message-
 From: owner-freebsd-questi...@freebsd.org [mailto:owner-freebsd-
 questi...@freebsd.org] On Behalf Of Paul Macdonald
 Sent: Tuesday, February 01, 2011 7:24 AM
 To: freebsd-questions@freebsd.org
 Subject: serial config handbook: /boot.conf or /boot.config


 I'm trying to get the dell bmc +sol serial thing working, kin dof
 getting there, but noticed this inconsistency in the handbook:

 Is it boot.conf or boot.config?

 Create boot.config in the root directory of the a partition on the boot
 drive.
 http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/serialconsole-
 setup.html#SERIALCONSOLE-HOWTO

 7.2 Create the /boot.conf file
 http://www.freebsd.org/doc/en_US.ISO8859-1/articles/console-
 server/freebsd.html


Here on my HP Proliant 350's I use -

  /boot.conf

This is with FreeBSD 8.0.

Patrick

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


RE: same function name in multiple archives - bad idea?

2011-02-01 Thread Patrick Mahan


 -Original Message-
 From: owner-freebsd-questi...@freebsd.org [mailto:owner-freebsd-
 questi...@freebsd.org] On Behalf Of Anton Shterenlikht
 Sent: Tuesday, February 01, 2011 9:08 AM
 To: freebsd-questions@freebsd.org
 Subject: same function name in multiple archives - bad idea?

 Is it wrong to have functions with the same name
 in multiple archives? E.g:

 % ar -t /usr/local/lib/libslatec.a | grep fdump.o
 fdump.o
 % ar -t /usr/local/lib/libcmlib.a | grep fdump.o
 fdump.o

 Which fdump function will be used if I then link
 against -larchive1.a -larchive2.a?

 And is there an easy way to find functions belonging
 in multiple archives?


Anton,

I believe for ELF images the linker will stop looking after finding it, so the
order of -llibrary controls which one will be used.  If you want to see which
one was used during linking, use the ld options '-M -Map mapfile --cref' which
will create a map file with cross references.

Patrick

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


RE: serial config handbook: /boot.conf or /boot.config

2011-02-01 Thread Patrick Mahan
It's at the root -

  # echo /boot.conf
  -P

Patrick


Patrick Mahan
Lead Technical Kernel Engineer
Adara Networks
Disclaimer: The opinions expressed here are solely the responsibility of the 
author and are not to be
construed as an official opinion of Adara Networks.


 -Original Message-
 From: Dan Nelson [mailto:dnel...@allantgroup.com]
 Sent: Tuesday, February 01, 2011 11:52 AM
 To: Patrick Mahan
 Cc: Paul Macdonald; freebsd-questions@freebsd.org
 Subject: Re: serial config handbook: /boot.conf or /boot.config

 In the last episode (Feb 01), Patrick Mahan said:
  From: owner-freebsd-questi...@freebsd.org [mailto:owner-freebsd-
  questi...@freebsd.org] On Behalf Of Paul Macdonald
   I'm trying to get the dell bmc +sol serial thing working, kin dof
   getting there, but noticed this inconsistency in the handbook:
  
   Is it boot.conf or boot.config?
  
   Create boot.config in the root directory of the a partition on the boot
   drive.
   http://www.freebsd.org/doc/en_US.ISO8859-
 1/books/handbook/serialconsole-setup.html#SERIALCONSOLE-HOWTO
  
   7.2 Create the /boot.conf file
   http://www.freebsd.org/doc/en_US.ISO8859-1/articles/console-
 server/freebsd.html
 
  Here on my HP Proliant 350's I use -
 
/boot.conf
 
  This is with FreeBSD 8.0.

 I don't see anything in /usr/src/sys/boot that reads a /boot.conf.  boot2
 reads /boot.config, and the loader will read /boot/boot.conf but that
 path is deprecated.

 I have -D in /boot.config on my SOL-enabled Dell 1950, which allows for
 both
 serial and keyboard input during the boot process.

 --
 Dan Nelson
 dnel...@allantgroup.com
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Attempting to use the kernel debugger over the serial port not working (well)

2010-09-24 Thread Patrick Mahan
All,

Cannot seem to find anything on the net to collaborate my experience
with remote KGDB over a serial port.

Here is my setup -

+--+-+---
|  | |
   bce0  eth1   bce0
|  | |
+---+--+   +---++
+---+---+
|   HP Proliant GL360 G5   |   | Cyclades ACS32 || HP Proliant GL360 G5 
 |
+---+--+   ++---+
+---+
|   |
  ttyu0(uart0)port 28
|   |
+---+

The Cyclades is a 32 port terminal server that has serial port 28 connected
to the DB9 locate on the back of the HP server.  I am running KGDB inside
of an emacs session on the Sony Vaio.

The HP's are running in 64-bit (amd64) FreeBSD 8.0.

The uart0 on the target is configured as (from dmesg.boot):

uart0: 16550 or compatible port 0x3f8-0x3ff irq 4 flags 0x90 on acpi0
uart0: [FILTER]
uart0: console (9600,n,8,1)

The Cyclades port is configured the same.

My kernel is built with the following options:

options KDB
options DDB
options GDB

The kernel is built with -O2 -g

In /boot/loader.conf I have the following lines:

console=comconsole vidconsole
comconsole_speed=9600
hint.uart.0.flags=0x90

I invoke the kernel debugger on the target using:

  'sysctl debug.kdb.enter=1'

Which gets me to the DB prompt where I enter the following:

DBgdb
Step to enter the gdb debugger
DBs

I am invoking KGDB inside of emacs on the build server in the 'obj' tree
where the kernel build is located.

kgdb -fullname kernel.debug

Once I have the gdb prompt, I enter the following target command:

   target remote 10.10.29.111:7028

Where 10.10.29.111 is the address of the Cyclades and port 7028 connects
me to serial port 28 on the Cyclades.

This brings up the kernel with the break point.  I then set my break
point(s) and enter 'c' to continue.

Sometimes the break points fire, sometimes they don't.  However, in some
indeterminant time (seconds) I start seeing the following on the
Video console (not the serial one).

Fatal double fault
rip = 0x8055bdc4
rsp = 0xff8078405000
rbp = 0xff8078405000
cpuid = 1; apic id = 01
panic: double fault
cpuid = 1
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2a
kdb_backtrace() at kdb_backtrace+0x32
mi_switch() at mi_switch+0x70
sched_bind() at sched_bind+0x60
boot() at boot+0x45
panic() at panic+0x1f2
dblfault_handler() at dblfault_handler+0xab
Xdblfault() at Xdblfault+0xac
--- trap 0x17, rip = 0x8055bdc4, rsp = 0xff817ff0, rbp = 
0xff8078405000 ---
_thread_lock_flags() at _thread_lock_flags+0x4
critical_exit() at critical_exit+0x5d
spinlock_exit() at spinlock_exit+0x17
mi_switch() at mi_switch+0x6b

Then it repeats over and over again, the box becomes unresponsive and I am 
unable
to proceed.

My googling turned up this issue only in relation to lock order reversals, but 
I am not
seeing that issue here and I don't have the kernel compiled with 'options 
WITNESS'.

Any pointers would be appreciated.

Thanks,

Patrick
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org



Burning a the 8.1 release DVD iso

2010-09-08 Thread Patrick Mahan


I am wanting to burn the 8.1 DVD iso image onto a DVD-R disc.  Previously,
I did this on my Macbook Pro using OSX, but alas, my HD died on the Macbook
so I am trying to do this on my Sony Vaio desktop system.

Platform:

   Intel Pentium 4 @ 2.80 GHz w/512 MB memory
   HD: IBM DTLA-307075 (74 G)
   DVD writer: SONY DVD RW DW-U12A/2.0d

OS:

FreeBSD mycroft.adaranet.com 8.0-RELEASE FreeBSD 8.0-RELEASE #0: Sat Nov 21 15:48:17 UTC 2009 
r...@almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386


I have the following modules loaded:

Id Refs AddressSize Name
 1   17 0xc040 b6dfe0   kernel
 21 0xc396b000 26000linux.ko
 31 0xc3adc000 5e000radeon.ko
 41 0xc3b3d000 14000drm.ko
 51 0xc59dd000 4000 atapicam.ko

The 'camcontrol devlist' command reports:

SONY DVD RW DW-U12A 2.0d at scbus1 target 0 lun 0 (pass1,cd1)
SAMSUNG CD-ROM SC-140C A101  at scbus1 target 1 lun 0 (pass0,cd0)


I have built and installed dvd+rw-tools 7.1 along with cdrtools-2.01.

If I try to use 'growisofs' :

mycroft# growisofs -dvd-compat -Z /dev/cd1=FreeBSD-8.1-RELEASE-amd64-dvd1.iso
:-( /dev/cd1: media is not recognized as recordable DVD: 0

So then I try to use 'cdrecord' and get the following:

mycroft# cdrecord dev=1,0,0 speed=16 -v -eject -tao -data 
FreeBSD-8.1-RELEASE-amd64-dvd1.iso
Cdrecord-Clone 2.01 (i386-unknown-freebsd8.0) Copyright (C) 1995-2004 Jörg 
Schilling
TOC Type: 1 = CD-ROM
scsidev: '1,0,0'
scsibus: 1 target: 0 lun: 0
Using libscg version 'schily-0.8'.
SCSI buffer size: 64512
atapi: 0
Device type: Removable CD-ROM
Version: 0
Response Format: 2
Capabilities   :
Vendor_info: 'SONY'
Identifikation : 'DVD RW DW-U12A  '
Revision   : '2.0d'
Device seems to be: Generic mmc2 DVD-R/DVD-RW.
Current: 0x
Profile: 0x001B
Profile: 0x001A
Profile: 0x0014
Profile: 0x0013
Profile: 0x0011
Profile: 0x0010
Profile: 0x000A
Profile: 0x0009
Profile: 0x0008
cdrecord: This version of cdrecord does not include DVD-R/DVD-RW support code.
cdrecord: If you need DVD-R/DVD-RW support, ask the Author for cdrecord-ProDVD.
cdrecord: Free test versions and free keys for personal use are at 
ftp://ftp.berlios.de/pub/cdrecord/ProDVD/
Using generic SCSI-3/mmc   CD-R/CD-RW driver (mmc_cdr).
Driver flags   : MMC-3 SWABAUDIO BURNFREE
Supported modes: TAO PACKET SAO SAO/R96R RAW/R96R
Drive buf size : 8112896 = 7922 KB
Drive DMA Speed: 5744 kB/s 32x CD 4x DVD
FIFO size  : 4194304 = 4096 KB
Track 01: data  2199 MB
Total size: 2525 MB (250:12.89) = 1125967 sectors
Lout start: 2525 MB (250:14/67) = 1125967 sectors
cdrecord: Input/output error. test unit ready: scsi sendcmd: retryable error
CDB:  00 00 00 00 00 00
status: 0x2 (CHECK CONDITION)
Sense Bytes: 70 00 02 00 00 00 00 12 00 00 00 00 30 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00
Sense Key: 0x2 Not Ready, Segment 0
Sense Code: 0x30 Qual 0x00 (incompatible medium installed) Fru 0x0
Sense flags: Blk 0 (not valid)
cmd finished after 0.010s timeout 40s
cdrecord: No disk / Wrong disk!

However, I went to the ftp ftp.berlios.de and there I find a message that 
ProDVD has been released
as of cdrtools-2.01.01a09.

So obviously I am missing something.  The handbook is not quite clear on this 
issue.  And my googling has
only located the issues regarding needing to load atapicam.ko module.

Any help or educational experience is appreciated.

Thanks,

Patrick Mahan
Adara Networks
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Burning a the 8.1 release DVD iso

2010-09-08 Thread Patrick Mahan



Manolis Kiagias wrote:

 On 08/09/2010 9:44 μ.μ., Patrick Mahan wrote:

I am wanting to burn the 8.1 DVD iso image onto a DVD-R disc. Previously,
I did this on my Macbook Pro using OSX, but alas, my HD died on the
Macbook
so I am trying to do this on my Sony Vaio desktop system.

Platform:

Intel Pentium 4 @ 2.80 GHz w/512 MB memory
HD: IBM DTLA-307075 (74 G)
DVD writer: SONY DVD RW DW-U12A/2.0d

OS:

FreeBSD mycroft.adaranet.com 8.0-RELEASE FreeBSD 8.0-RELEASE #0: Sat
Nov 21 15:48:17 UTC 2009
r...@almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386

I have the following modules loaded:

Id Refs Address Size Name
1 17 0xc040 b6dfe0 kernel
2 1 0xc396b000 26000 linux.ko
3 1 0xc3adc000 5e000 radeon.ko
4 1 0xc3b3d000 14000 drm.ko
5 1 0xc59dd000 4000 atapicam.ko

The 'camcontrol devlist' command reports:

SONY DVD RW DW-U12A 2.0d at scbus1 target 0 lun 0 (pass1,cd1)
SAMSUNG CD-ROM SC-140C A101 at scbus1 target 1 lun 0 (pass0,cd0)


I have built and installed dvd+rw-tools 7.1 along with cdrtools-2.01.

If I try to use 'growisofs' :

mycroft# growisofs -dvd-compat -Z
/dev/cd1=FreeBSD-8.1-RELEASE-amd64-dvd1.iso
:-( /dev/cd1: media is not recognized as recordable DVD: 0

So then I try to use 'cdrecord' and get the following:

mycroft# cdrecord dev=1,0,0 speed=16 -v -eject -tao -data
FreeBSD-8.1-RELEASE-amd64-dvd1.iso
Cdrecord-Clone 2.01 (i386-unknown-freebsd8.0) Copyright (C) 1995-2004
Jörg Schilling
TOC Type: 1 = CD-ROM
scsidev: '1,0,0'
scsibus: 1 target: 0 lun: 0
Using libscg version 'schily-0.8'.
SCSI buffer size: 64512
atapi: 0
Device type : Removable CD-ROM
Version : 0
Response Format: 2
Capabilities :
Vendor_info : 'SONY '
Identifikation : 'DVD RW DW-U12A '
Revision : '2.0d'
Device seems to be: Generic mmc2 DVD-R/DVD-RW.
Current: 0x
Profile: 0x001B
Profile: 0x001A
Profile: 0x0014
Profile: 0x0013
Profile: 0x0011
Profile: 0x0010
Profile: 0x000A
Profile: 0x0009
Profile: 0x0008
cdrecord: This version of cdrecord does not include DVD-R/DVD-RW
support code.
cdrecord: If you need DVD-R/DVD-RW support, ask the Author for
cdrecord-ProDVD.
cdrecord: Free test versions and free keys for personal use are at
ftp://ftp.berlios.de/pub/cdrecord/ProDVD/
Using generic SCSI-3/mmc CD-R/CD-RW driver (mmc_cdr).
Driver flags : MMC-3 SWABAUDIO BURNFREE
Supported modes: TAO PACKET SAO SAO/R96R RAW/R96R
Drive buf size : 8112896 = 7922 KB
Drive DMA Speed: 5744 kB/s 32x CD 4x DVD
FIFO size : 4194304 = 4096 KB
Track 01: data 2199 MB
Total size: 2525 MB (250:12.89) = 1125967 sectors
Lout start: 2525 MB (250:14/67) = 1125967 sectors
cdrecord: Input/output error. test unit ready: scsi sendcmd: retryable
error
CDB: 00 00 00 00 00 00
status: 0x2 (CHECK CONDITION)
Sense Bytes: 70 00 02 00 00 00 00 12 00 00 00 00 30 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00
Sense Key: 0x2 Not Ready, Segment 0
Sense Code: 0x30 Qual 0x00 (incompatible medium installed) Fru 0x0
Sense flags: Blk 0 (not valid)
cmd finished after 0.010s timeout 40s
cdrecord: No disk / Wrong disk!

However, I went to the ftp ftp.berlios.de and there I find a message
that ProDVD has been released
as of cdrtools-2.01.01a09.

So obviously I am missing something. The handbook is not quite clear
on this issue. And my googling has
only located the issues regarding needing to load atapicam.ko module.

Any help or educational experience is appreciated.

Thanks,

Patrick Mahan
Adara Networks


Nothing wrong with your growisofs line. That's what I use all the time
to write DVD isos, including FreeBSD install media.
It seems the drive is unable to recognize the media as a recordable one
(look at the cdrecord message: incompatible medium found and growisofs:
media not recognized as recordable dvd). Could you try with a different
brand/type disk?
Try both DVD+R and DVD-R. I've had this before: specific drives refusing
to work with specific media.



*sigh*  not on FreeBSD as well :-(

I have run across this writing DVD's using Fedora Cora and Ubuntu.  Especially,
when the drive is a DVD+/-RW drive.  I've had it writing with -R and come back
the next day and it would only take +R.  Should have guessed since these are
basically the same tools I have tried to use under linux.

This was one of the reasons I used my Mac.

I've gone and gotten some DVD+R and it seems to be doing something (lights are
flashing and growisofs is outputing a lot of info.

Thanks,

Patrick
 ___

freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Problems dumping to a SCSI device.

2010-05-17 Thread Patrick Mahan


Platform: HP 350DL
FreeBSD version: FreeBSD 8.0 (amd64)

Beginning of /var/run/dmesg.boot

Copyright (c) 1992-2009 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 8.0-RELEASE-p2 #0: Fri May  7 03:52:28 PDT 2010

bu...@build8064:/users/build/p4build/FBSD80REL/amd64/obj/users/build/p4build/FBSD80REL/src/sys/MPATH
Timecounter i8254 frequency 1193182 Hz quality 0
CPU: Intel(R) Xeon(R) CPU   E5440  @ 2.83GHz (2833.45-MHz K8-class CPU)
  Origin = GenuineIntel  Id = 0x10676  Stepping = 6

Features=0xbfebfbffFPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE

Features2=0xce3bdSSE3,DTES64,MON,DS_CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,DCA,SSE4.1
  AMD Features=0x2800SYSCALL,LM
  AMD Features2=0x1LAHF
  TSC: P-state invariant

Disk info from /var/run/dmesg.boot

ciss0: HP Smart Array P400i port 0x4000-0x40ff mem 
0xfd60-0xfd6f,0xfd5f-0xfd5f0fff irq 16 at device 0.0 on pci6

ciss0: PERFORMANT Transport
ciss0: [ITHREAD]

...

da0 at ciss0 bus 0 target 0 lun 0
da0: COMPAQ RAID 0  VOLUME OK Fixed Direct Access SCSI-5 device
da0: 135.168MB/s transfers
da0: Command Queueing enabled
da0: 69973MB (143305920 512 byte sectors: 255H 32S/T 17562C)

My /etc/fstab contains:

# DeviceMountpoint  FStype  Options DumpPass#
/dev/da0s1b noneswapsw  0   0
/dev/da0s1a /   ufs rw  1   1
/dev/da0s1e /usrufs rw  2   2
/dev/da0s1d /varufs rw  2   2
/dev/acd0   /cdrom  cd9660  ro,noauto   0   0
proc/proc   procfs  rw  0   0

Swap is 8 Gbytes and we are running with 4 Gbytes of memory.

My issue is we are trying to track down an intermitten crash in the kernel,
but cannot obtain a crash dumpfile.  When a crash occurs I am seeing the
following on the console:

Fatal trap 12: page fault while in kernel mode
cpuid = 5; apic id = 05
fault virtual address   = 0x1a0
fault code  = supervisor write, page not present
instruction pointer = 0x20:0x80527396
stack pointer   = 0x28:0xff80789d1ab0
frame pointer   = 0x28:0xff80789d1af0
code segment= base 0x0, limit 0xf, type 0x1b
= DPL 0, pres 1, def32 1, gran 1
processor eflags= interrupt enabled, resume, IOPL = 0
current process = 87253(ls)
trap number = 12

uptime:2d3h44m24s
Dumping 2020MB:Aborting dump due to I/O Error
Status==0xb, SCSI status=bx0

Dump Failed (ERROR 5)

This seems to be a failure in cam/scsi/scsi_da.c in dadump().  This was
working for us under FreeBSD 6.2 (we just recently switched to using 8.0).

Googling only turned up some issues way back in 4.x with different SCSI
controllers, nothing for 8.0.

Any pointers are appreciated.  I get the same behavior when I force a
panic using 'debug.kdb.panic=1' as well.

Thanks,

Patrick
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: need C help, passing char buffer[] by-value....

2009-10-19 Thread Patrick Mahan

See comments interspaced below -

Gary Kline wrote:

On Mon, Oct 19, 2009 at 01:48:42AM -0400, Brad Mettee wrote:

Gary Kline wrote:

Guys,

maybe this can't be done reading in a file with fgets(buffer[128], fp),
then calling skiptags(), conditionally, to while () past ',' and ''.


[snipped]


It didn't core dump, but neither work.  Basically, I'm doing a read via 
fgets:

while(fgets(buf, sizeof buf, fp_in)) {

an HTML or other file with TAGS.  Optionally, say, given the switch 
-N,
the program would NOT progress any of the HTML tags; It would only 
touch other
stuff in the file.  Simply put, I have a fixed buffer, buf[1024], that 
I want to
	change --i think by-reference-not certain-by calling 


skiptags(*buf); and skiptags() would read past the WHATEVER=7 FOO=6 
BAR=Times
and return the buffer to the place after fgets() where skiptags(buf) 
is called
missing all markup TAGS.

I'm better at by-refernce with ints that chars, so I don't know how far 
off I am
here.  That's why I;'m asking you guys.



Gary,

Let me restate your problem: You want to read through a file containing tags
delimited by  and to skip these tags if the user has run your command with
the -N flag.

In C any thing passed by address is by reference.  For a your static buffer
of 1024 characters: you can pass it by reference as:

   skiptags(buf); /* passes in the starting address of the buffer */
   skiptags(buf[0]); /* passes in the starting address of the buffer */
   skiptags(buf[10]); /* passes int the starting address of the buffer
  at the 11th character position. */

Arrays and pointers are always by reference.  Individual data types int,
char, etc are by value unless passed in as a pointer.  I think this is where
your confusion is around.

A couple of things to keep in mind:

   1. Remember how fgets() works.  It is entirely possible that you might have
  tags that span multiple lines.  You will need to take that into account.

   2. You can manipulate the fixed buffer two different ways:

  A. You can use pointer arithemtic, eg.

 char buf[1024];
 char *cp;

 while ((cp = fgets(buf, sizeof(buf), fp_in))) {

   if (skiptags) cp = skiptag(buf);

   /* If NULL, end of line reached */
   if (!cp) continue;

 }

 char *skiptags(char *buf)
 {
  char *tp = buf;

  /* find the start of a tag */
  while (*tp != '\0'  *tp++ != '');

  /* if no tag is found return start of buffer */
  if (*tp == '\0')
 return buf;

  /* Start of tag, find the end of tag */
  while (*tp != '\0'  *tp != '\n'  *tp++ != '');

  /* if end of line reached return NULL */
  if (*tp == '\0' || *tp == '\n')
 return NULL;

  /* return the next character start after the end tag */
  return ++tp;
 }

   B. Using indexing, eg.

 char buf[1024];
 int  i, bsize;

 while (fgets(buf, sizeof(buf), fp_in)) {
   i = 0;
   bsize = strlen(buf);

   if (skiptags) i = skiptag(buf);

   /* If NULL, end of line reached */
   if (i = bsize) continue;

 }

 int skiptags(char *buf)
 {
  int c = 0;

  /* find the start of a tag */
  while (buf[c] != '\0'  buf[c] != '')
 c++;

  /* if no tag is found return start of buffer */
  if (buf[c] == '\0')
 return 0;

  /* Start of tag, find the end of tag */
  while (buf[c] != '\0'  buf[c] != '\n'  buf[c] != '')
 c++;

  /* if end of line reached return NULL */
  if (buf[c] == '\0' || buf[c] == '\n')
 return strlen(buf);

  /* return the next character start after the end tag */
  return ++c;
 }

Both methods should allow you to skip past any tags found in the file (provided
you handle the case of a tag spanning more than one line).


Hope this clears up your confusion and gets you on your way.

Patrick
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: need C help, passing char buffer[] by-value....

2009-10-19 Thread Patrick Mahan



Gary Kline wrote:

On Mon, Oct 19, 2009 at 11:09:19AM -0700, Patrick Mahan wrote:

See comments interspaced below -

Gary,

Let me restate your problem: You want to read through a file containing tags
delimited by  and to skip these tags if the user has run your command 
with

the -N flag.

In C any thing passed by address is by reference.  For a your static 
buffer

of 1024 characters: you can pass it by reference as:

   skiptags(buf); /* passes in the starting address of the buffer */
   skiptags(buf[0]); /* passes in the starting address of the 
   buffer */
   skiptags(buf[10]); /* passes int the starting address of the 
   buffer

  at the 11th character position. */

Arrays and pointers are always by reference.  Individual data types int,
char, etc are by value unless passed in as a pointer.  I think this is 
where

your confusion is around.



	You've got it exactly right, Patrick.  There were no C classes in 1978--I 
	taught myself.  Obviously, not that well because I have already dreaded 
	pointers.  ---Well, usually.


You are welcome, glad to help.

[examples snipped]




	Your examples help a lot!   Everything works except when there are two or more 
	tags on one line such as:


BODY BGCOLOR=#FF LINK=#00 VLINK=#006633FONT SIZE=4


I think I see where is your skiptags--pointer arithematic 
function--this can be
caught.  Thanks much!



If I might make a suggestion.  Make use of a case (switch) statement:

switch(buf[c]) {
case '': /* start of tag, skip it if requested */
 if (skiptags) c = skiptag(buf[c]);
 ...

default: /* handle normal stuff */
  ...
}

Inside your while() statement.

Good luck,

Patrick

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: su'ing not sourcing .bash_profile

2009-04-24 Thread Patrick Mahan

Because .bash_profile is only seen on login, not on 'su'.  Put
it in .bashrc which is read when the shell is invoked.

See 'man bash'

Patrick

Daniel Underwood presented these words - circa 4/24/09 12:43 PM-

When I am logged in as a non-root user and I try to become root by
entering su and typing the root password, the resulting bash prompt
does not reflect the contents of /root/.bash_profile

My /root/.bash_profile contains (among other things):

export PS1=[\e[1;31m\]$(tput bold)\u$(tput sgr0)\[\e[0...@\h \w]\$ 

The point is to make the username (root) display in BOLD and RED
text.  After su'ing, the text is not bold nor red.  If I then enter
source ~/.bash_profile, however, the prompt displays correctly,
showing root in bold and red text.

How come su'ing doesn't seem to effect everything in the
/root/.bash_profile file?

Thanks,
Daniel
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org



___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: mail server DNS configuration questions

2008-09-09 Thread Patrick Mahan



Andrew Falanga presented these words - circa 9/6/08 6:28 PM-

Hi,

Well, my clients at church are still having issues and after working with 
George, a respondant to my original questions, I think that most, if not all, 
of my problems are related to DNS and how we've got it improperly configured.


First, a crude drawing of how our mail server exists in the world:

192.168.2.x/24   72.24.23.252  lot's of networks
Private Network -- CableOne -- Internet

Now, our mail server's IP is 192.168.2.23.  On the router, he (the person at 
whose house the mail server is) has IP forwarding setup so that mail get's 
sent to our FreeBSD machine.  Using dig, here's the responses:


(from my FBSD machine at home, not the server)
[/usr/home/andy]
- dig +short -t MX whitneybaptist.org
10 mail.whitneybaptist.org.
[/usr/home/andy]
- dig +short -t A whitneybaptist.org
72.24.34.252
[/usr/home/andy]
- dig +short -x 72.24.34.252
34-252.72-24-cpe.cableone.net.

(from the church FBSD machine)
[/home/afalanga]
- hostname
whitbap
[/home/afalanga]
- ifconfig fxp0
fxp0: flags=8843UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST mtu 1500
options=8VLAN_MTU
inet 192.168.2.23 netmask 0xff00 broadcast 255.255.255.255
ether 00:d0:b7:74:87:48
media: Ethernet autoselect (100baseTX full-duplex)
status: active
[/home/afalanga]
- cat /etc/resolv.conf
search McCutchanLAN
nameserver 192.168.2.1


It doesn't take a rocket scientist, or a computer scientist, to figure out 
we've got DNS issues.  I'm thinking that I should setup a domain within the 
192.168.2.0/24 network on this box.  I've done this before, at work.  The 
question I've got is I've never actually integrated a domain like this to a 
domain on the Internet.  I'm thinking that we'll setup something like: 
internal.whitneybaptist.org with hosts in that sub-domain.





First, what are you trying to accomplish with the internal DNS?  Make it easier 
to
resolve machines in the 192.168.2.0 network?  Allow lookups external of the
192.168.2.0 network?  What machine is 'mail.whitneybaptist.com'?  Is it on the
192.168.2.0 network?  Is it reachable from the Internet?

Who is the owner of whitneybaptist.org DNS zone?  I show the following NS 
servers:

[EMAIL PROTECTED]/src/MPS/DocDownload 140  dig +short -t NS whitneybaptist.org
ns1.domaindirect.com.
ns2.domaindirect.com.
ns3.domaindirect.com.

Which is administered by tucows.com (Tucows, Inc) a seller of DNS services.

So, what would my DNS tables need to look like to make this happen.  Also, to 
any knowledgable souls here, what RFCs address these issues?




You can read the RFC's if you want, but you would be better served to purchase
DNS and BIND, Fourth Edition, by Paul Albitz  Cricket Liu to learn how to
administer DNS.

Patrick
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: How to view TCP advertised window by using tcpdump?

2008-09-05 Thread Patrick Mahan


EdwardKing presented these words - circa 9/3/08 10:15 PM-
 I use TCP client to connect daytimesesrver which port is 13,I want to know 
 how to use tcpdump to view TCP advertised window? Where is the TCP advertised 
 window in the tcpdump result?
 
 Thanks


When you run tcpdump, for tcp packets, look for the 'win' string.  For example, 
looking at a pop3 stream
I see -

tcpdump -i rl0 -s 1500 tcp and port pop3
[...]
23:00:38.371059 IP 10.0.0.10.pop3  10.0.0.1.33656: P 13468:14292(824) ack 96 
win 33304 nop,nop,timestamp 246782562 2080639302
23:00:38.373003 IP 10.0.0.1.33656  10.0.0.10.pop3: . ack 14292 win 65535 
nop,nop,timestamp 2080639302 246782562
23:00:38.629916 IP 10.0.0.1.33656  10.0.0.10.pop3: P 96:104(8) ack 14292 win 
65535 nop,nop,timestamp 2080639302 246782562
23:00:38.630021 IP 10.0.0.10.pop3  10.0.0.1.33656: P 14292:14325(33) ack 104 
win 33304 nop,nop,timestamp 246782588 2080639302

The win indicates the advertised window.  So 10.0.0.10 is advertising a 
window of 33304 bytes
and 10.0.0.1 is advertising a window of 65535 bytes.

Try 'man tcpdump'.

Patrick

 
 --
 Confidentiality Notice: The information contained in this e-mail and any
 accompanying attachment(s) is intended only for the use of the intended
 recipient and may be confidential and/or privileged of Neusoft Corporation, 
 its subsidiaries and/or its affiliates. If any reader of this communication 
 is not the intended recipient, unauthorized use, forwarding, printing, 
 storing, disclosure or copying is strictly prohibited, and may be unlawful. 
 If you have received this communication in error, please immediately notify 
 the sender by return e-mail, and delete the original message and all copies 
 from your system. Thank you. 
 ---
 
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to [EMAIL PROTECTED]
 
 
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: How to set TCP parameter?

2008-08-20 Thread Patrick Mahan


EdwardKing presented these words - circa 8/19/08 9:39 PM-
 $sysctl net.inet.tcp.msl
 net.inet.tcp.msl 3
 
 It is 3ms or 3s?
 

It's ms, basically it is 30*hz (see tcp_timer.h).  So it is by default,
30 secs.

 I want to modify it,because I met with following question:
 
 There is a server and a client,when client send a message to server,server 
 can send a reply to client. 

The status of server and client is ESTABLISHED.Then I halt the client by press 
ctrl+c,I find the server status is CLOSE_WAIT

and the client status is FIN_WAIT_2. Many minutes passed,I find the the server 
status still is CLOSE_WAIT and the client

status still is FIN_WAIT_2. At last,the client status is disappeared,but the 
server status still is CLOSE_WAIT.Why the status of

server isn't CLOSED? I am puzzled with it for a very long time. Would you tell 
the reason?

This is going to require you digging into the TCP protocol (you can start with 
RFC-793 but I would also recommend
some books on the subject, I prefer the Stevens book TCP/IP Illustrated, Vol 
1).  I've attached the TCP state diagram
to this email for you.

Let's look at what happens, we start with both the client and the server in the 
TCP state ESTAB

ClientEvent Server
==   ====

ESTAB ESTAB

You issue a CTRL-C, causing the client to close the connection to the server.  
This causes the following:

ESTAB-CLOSE   ESTAB
-- FIN
CLOSE-FIN_WAIT_1   ESTAB

The TCP layer moves the connection to CLOSE state and sends a FIN to start 
connection tear down.
The server receives the FIN.
   ESTAB
ACK--
FIN_WAIT_1 ESTAB-CLOSE_WAIT
On the server the reception of the FIN causes the TCP layer to send an ACK of 
the FIN and moves the
connection to the CLOSE_WAIT state.

  FIN_WAIT_1-FIN_WAIT_2   CLOSE_WAIT

What should be happening is that now the server should send a FIN in response, 
but
either 1) it fails too or 2) it is lost in between.  Eventually, the TCP layer 
on the client times
out the FIN_WAIT_2 state and moves the connection to the CLOSED state.  However,
the server cannot move out of the CLOSE_WAIT state since it hasn't seen the ACK 
to it's
FIN.

There is no TCP variable in the FreeBSD implementation to change this (that I 
know of).

I have seen this happen at times when there is a buggy NAT firewall between you 
and the
server that causes the FIN from the server to get dropped.  If you have control 
of both sides,
you can do packet traces using tcpdump to see if the FIN from the server is 
ever sent or
receive.  It is possible that your client is dropping the packet itself.

Good luck,

Patrick
 
 Thanks.
 
 - Original Message - 
 From: Patrick Mahan [EMAIL PROTECTED]
 To: EdwardKing [EMAIL PROTECTED]
 Sent: Wednesday, August 20, 2008 12:06 PM
 Subject: Re: How to set TCP parameter?
 
 

 EdwardKing presented these words - circa 8/19/08 7:14 PM-
 Yes,I want to modify spent in the TIME_WAIT state? How to realize it?

 I use sysctl to view TCP parameter,but it failed
 $sysctl TCP_TIME_WAIT_INTERVAL
 sysctl: unknown oid 'TCP_TIME_WAIT_INTERVAL'

 Where is wrong?

 There is no such variable in the TCP protocol implementation on FreeBSD
 (that I can see).  Instead, you can try to modify the TCP Maximum Segment
 Lifetime (sysctl net.inet.tcp.msl).  TIME_WAIT should wait a maximum of
 2*msl before timing out.  However, changing it can adversly affect other 
 parts
 of the protocol.

 Why do you want to modify it?

 Patrick

 - Original Message - 
 From: Patrick Mahan [EMAIL PROTECTED]
 To: EdwardKing [EMAIL PROTECTED]
 Cc: FreeBSD freebsd-questions@freebsd.org
 Sent: Wednesday, August 20, 2008 9:59 AM
 Subject: Re: How to set TCP parameter?


 EdwardKing presented these words - circa 8/19/08 6:17 PM-
 How to set TCP parameters,such as tcp_time_wait_interval?

 You should use 'sysctl'.  See 'man 8 sysctl'.

 However, I don't see any time wait variables available via sysctl.  Are you
 trying to modify the time spent in the TIME_WAIT state?

 Patrick

 Thanks


 --
 Confidentiality Notice: The information contained in this e-mail and any
 accompanying attachment(s) is intended only for the use of the intended
 recipient and may be confidential and/or privileged of Neusoft 
 Corporation, its subsidiaries and/or its affiliates. If any reader of 
 this communication is not the intended recipient, unauthorized use, 
 forwarding, printing, storing, disclosure or copying

Re: How to set TCP parameter?

2008-08-19 Thread Patrick Mahan


EdwardKing presented these words - circa 8/19/08 6:17 PM-
 How to set TCP parameters,such as tcp_time_wait_interval?


You should use 'sysctl'.  See 'man 8 sysctl'.

However, I don't see any time wait variables available via sysctl.  Are you
trying to modify the time spent in the TIME_WAIT state?

Patrick

 Thanks
 
 
 --
 Confidentiality Notice: The information contained in this e-mail and any
 accompanying attachment(s) is intended only for the use of the intended
 recipient and may be confidential and/or privileged of Neusoft Corporation, 
 its subsidiaries and/or its affiliates. If any reader of this communication 
 is not the intended recipient, unauthorized use, forwarding, printing, 
 storing, disclosure or copying is strictly prohibited, and may be unlawful. 
 If you have received this communication in error, please immediately notify 
 the sender by return e-mail, and delete the original message and all copies 
 from your system. Thank you. 
 ---
 
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to [EMAIL PROTECTED]
 
 
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: problems with a C script, exiting with signal 10

2008-08-07 Thread Patrick Mahan



Jordi Moles Blanco presented these words - circa 8/7/08 3:13 AM-

Hi,

I've got this home-made script, written in C, on a  Freebsd 7.0 server 
with different versions of postfix: 2.3,2,4 and 2.5


The problem is that, while most of the time it works like a charm, 
sometimes it crashes and bounces the message. It's not really a big 
deal, cause the sender gets notified that their mail wasn't delivered 
and hopefully, they will resend it. However, the problem is that I've 
tried to debug my script but found nothing wrong at all, cause it only 
fails from time to time, let's say... once for each 2000 messages that 
postfix receives, and it appears to do so in a random way.


As i said... postfix can fail to deliver a message to one particular 
mailbox, but if then you resend the very same message to the very same 
mailbox, it will be delivered.


The error is reported in both maillog and messages, like this:


**/var/log/maillog
Aug  7 01:55:19 mail01 postfix/pipe[27534]: 3E1A0143709: 
to=EMAIL_ACCOUNT, relay=quota_postfix, delay=0.23, 
delays=0.11/0/0/0.11, dsn=5.3.0, status=bounced (Command died with 
signal 10: /usr/local/etc/postfix/quota_postfix)



*/var/log/messages***
Aug  7 01:55:19 mail01 kernel: pid 29535 (quota_postfix), uid 125: 
exited on signal 10




Well signal 10 is SIGBUS which is indicative of (generally) a bad address,
non-aligned memory address (on platforms it matters) or a hardware error.
I would look for places you are dereferencing a pointer without perhaps
first validating it.

Given that it rarely occurs, I might suspect that you are allocating some
memory, but failing to completely initialize (malloc() doesn't zero out
memory) it or assuming it is already initialize.

Good luck,

Patrick


Here you have some extra information about the script itself and the 
master.cf



*/usr/local/etc/postfix/quota_postfix***

# ls -la /usr/local/etc/postfix/quota_postfix
-rwsr-xr-x  1 postfix  postfix  20048 Aug  4 10:18 
/usr/local/etc/postfix/quota_postfix


It's got de suid flag cause it performs a du command and other file 
operations which need permissions, although i've tried with other groups 
of permissions and it eventually crashes anyway with signal 10


**master.cf*

.

# spamfilter
spamfilter  unix-   n   n   -   20  pipe
flags=R user=filter argv=/home/antispam.pl localhost:10027 antispam 
${sender} ${recipient} /usr/local/bin/spamc


# from spamfilter to smtpd:10026
localhost:10027 inetn   -   n   -   100   smtpd 
-o content_filter=quota_postfix



# quota_postfix
quota_postfix  unix-   n   n   -   20  pipe
flags=R user=filter argv=/usr/local/etc/postfix/quota_postfix 
localhost 10028 ${sender} ${recipient} ${domain}


# from quota_postfix to smtpd:10028
localhost:10028 inetn   -   n   -   100   smtpd 
-o content_filter=




So far, any program which crashed would leave a .core file in 
/usr/crash, but this one is not doing the same, so... i can't actually 
debug from the core file either.
Sysctl in my FreeBSD server is ok, but i guess that postfix, somehow is 
preventing this filter from generating a core file. Is that possible? Or 
am i completely wrong?


How could I, at least, generate the .core file?

Thanks.


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to 
[EMAIL PROTECTED]




___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: joining 2 files together ?

2008-08-07 Thread Patrick Mahan



beni presented these words - circa 8/7/08 8:34 AM-

Hi,

I am trying to find the equivalent for the old dos copy file1+file2 command
(copy myfile1.txt+myfile2.txt copies the contents in myfile2.txt and 
combines it with the contents in myfile1.txt).
But the standard freebsd cp doesn't seem to want the + between the two 
files :


bsdaddict# cp file1.avi+file2.avi
usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-alpv] source_file target_file
   cp [-R [-H | -L | -P]] [-f | -i | -n] [-alpv] source_file ... 
target_directory
bsdaddict#

So how to I append file2 at the end of file1 to get only one file ? To be more 
specific : I would like to merge 2 avi files into one. How do I get 
file1.avi+file2.avi into file3.avi ?


try 'cat file1.avi file2.avi  file3.avi'

Patrick

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: DNS troubles

2008-07-21 Thread Patrick Mahan



Jim presented these words - circa 7/21/08 6:30 PM-

I'm trying to get a machine working, but it can't seem to handle DNS
requests. I've just done a 7.0 install (from CD, usually I use net,
but it wasn't connecting to anything, now I know why).

I have a machine with two built in NICs on the motheroboard, one using
nfe the other using bge. When I try to connect to anything, I get a
cannot resolve host error. Both are set up to be static,
192.168.1.84, and bge is 192.168.1.86. I have tried both 192.168.1.1
(the router, which points to the ISPs DNS) and 4.2.2.1 in the
/etc/resolve.conf file, each separately, not both at once. The machine
can ping both of these addresses and gets a decent to rapid return
time (~.3ms for the former, 20ms for the latter) Neither works on
this machine. Both work on the other FreeBSD and Windows machines in
the house. I have the machine set to dual boot, and DNS works fine
under Windows.

I tried DHCP without an luck. The previous install on this machine just worked.

What I *SUSPECT* is the biggest clue (my guess, check an rc.d file, which?)
During boot up, after showing the network interfaces, until showing
the login prompt, the terminal gets spammed with b: not found.

Up to this point:
- I installed it once with a boot only CD and it worked fine, but
being absent minded, I reinstalled thinking it would be the
quickest/easiest way to fix an issue, and the install I had wasn't
really 'set-up' yet.
- The DNS checker (bind?) wasn't working properly during the first
reinstall. Sadly, I found this out after reformatting the partitions.
- I re-burned the CD with CD1 (not boot only), and tried again - DNS
still didn't work.
- I installed from CD.

Process for current install:
- I installed i386/7.0 from Install Disk 1, minimal install + dict,
man, info and doc
- I set the root password during the install
- I updated the /etc/ssh* files to the files from my old system (I
can ssh into the computer fine)
- I copied over the rc.conf and modified the NIC and startup entries
(see below)
- I added if_tap_load=YES to /boot/loader.conf (this was AFTER the
DNS issues had started)
- set the values in /etc/resolve.conf
- I copied /etc/supfile-ports and /etc/supfile-src from the old
install. These are pretty boring supfiles for ports and src
respectively.
- I added my non-root account (so I could ssh in)

That's it.

Any ideas? My suspicion is that my next step will be 'rebuild bind
from within /usr/src wherever it resides in there'. However, since it
wasn't working during install or now, I suspect that won't be enough.



Why do you think 'bind' is the problem?  You are not using bind, you are
using the DNS resolver (which is the client side of Bind).  Can you reach
each of the nodes listed in resolv.conf?  via ping?  via traceroute?

Have you tried to issue a 'dig 4.2.2.1 name' to see if you can reach the
DNS server?

I would first ensure that you have basic network connectivity, once that
is confirmed, that you have access to the DNS servers.

But your problem is not locally with Bind.

Patrick Mahan
ex-Window Washer


Thanks,
-Jim Stapleton

/etc/resolve.conf

domain  var-dev.net
nameserver  4.2.2.1
nameserver  4.2.2.2
nameserver  4.2.2.3


/etc/rc.conf

hostname=elrond.var-dev.net
ifconfig_bge0=inet 192.168.1.86 netmask 255.255.255.0
#ifconfig_re0_alias0=192.168.1.85 netmask 255.255.255.255
defaultrouter=192.168.1.1

#for QEmu
ifconfig_nfe0=up polling
autobridge_interfaces=bridge0
autobridge_bridge0=tap0 nfe0
cloned_interfaces=bridge0
# the bridge gets the IP
#ifconfig_bridge0=inet 10.10.10.2 netmask 255.255.255.0
ifconfig_bridge0=inet 192.168.1.84 netmask 255.255.255.0
ifconfig_bridge0_alias0=192.168.1.85 netmask 255.255.255.0

sshd_enable=YES
usbd_enable=YES
linux_enable=YES
#ntpdate_enable=YES
ntpd_enable=YES
#cupsd_enable=YES
#moused_enable=YES

#for beryl and hardware autodetect stuff
#compat5_enable=YES
#dbus_enable=YES
#polkitd_enable=YES
#hald_enable=YES
#gdm_enable=YES
bsdstats_enable=YES

# -- sysinstall generated deltas -- # Tue Mar 25 08:22:19 2008
keymap=us.iso

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]



___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Network programming question

2008-03-13 Thread Patrick Mahan



Andrew Falanga presented these words - circa 3/13/08 9:10 AM-

Hi,

I'd like to know why the inet_pton(3) doesn't fill in the address
family of the proper structure passed into it.  I'm at a complete loss
for why.  Here's the prototype:

int inet_pton(int af, const char * restrict src, void * restrict dst);


Three arguments only.  The address family, hm, I'm passing it in; the
address string in printable ASCII text, and a void pointer to the
address structure to put the address into, presumably one of the
sockaddr_* family structures for AF_INET or AF_INET6 (further, the man
page says that this function is only valid for these two families now
anyway).


From some coding for a program, I did find that this function,

inet_pton(3), *does* in fact mangle the sin_family member of the
sockaddr_in structure, so why not mangle it to what it should be?  I
was doing something like this:

// valid code above
sockaddr_in   sa;

sa.sin_family = AF_INET;
sa.sin_port = htons(3252);

inet_pton(AF_INET, 192.168.0.1, sa);

sendto(sa, msg, strlen(msg), 0, (struct sockaddr*)sa, sizeof(sa));



See man inet_pton . . . for details.

Briefly, inet_pton() doesn't understand sockaddr structures.  Instead,
it only understands in_addr or in6_addr structures which are included
inside the sockaddr structure.  So your above example should be changed
to

  // valid code above
  sockaddr_in sa;
  int res;

  sa.sin_family = AF_INET;
  sa.sin_port = htons(3252);

  if ((res = inet_pton(AF_INET, 192.168.0.1, sa.sin_addr))  0)
perror(inet_pton);

  if (!res)  // error occurred
fprintf(stderr, Address notation incorrect for AF_INET address\n);



The call to sendto is wrapped in an if an was failing for errno code
47, Address family not supported by protocol (I was using UDP).  I
changed the assignment of AF_INET to the sa.sin_family member to
*after* the call to inet_pton(3) and suddenly everything worked.  Why?
 Since the address family was used by inet_pton(3) to figure out how
to read the address and assign it to sa.sin_addr.s_addr, why not
simply assign AF_INET to the address family member in inet_pton(3)?



Because it is treating the sockaddr_in structure as an in_addr structure
which is clobbering the sin_family field.


I'm not trying to be argumentative.  I'm just curious.  It seems like
redundancy.  I've used the address family to tell inet_pton(3) how to
operate, and then this function can't assign it to the sockaddr_in
structure passed to it?  This makes little sense.  In case it's
because I'm using older FBSD libraries that had a flaw fixed, I'm
using FreeBSD 6.2-RELEASE-p4.  Is this because that's how POSIX
defined it to work?  Is this the right venue or should I try one of
the other mailing lists?



RTM,

Patrick
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Network programming question

2008-03-13 Thread Patrick Mahan



Andrew Falanga presented these words - circa 3/13/08 11:11 AM-

On Thu, Mar 13, 2008 at 11:45 AM, Patrick Mahan [EMAIL PROTECTED] wrote:


 Andrew Falanga presented these words - circa 3/13/08 9:10 AM-


Hi,

 See man inet_pton . . . for details.

 Briefly, inet_pton() doesn't understand sockaddr structures.  Instead,
 it only understands in_addr or in6_addr structures which are included
 inside the sockaddr structure.  So your above example should be changed
 to



Ok, I should have thought of that when reading the manual.


   if ((res = inet_pton(AF_INET, 192.168.0.1, sa.sin_addr))  0)
 perror(inet_pton);


 Because it is treating the sockaddr_in structure as an in_addr structure
 which is clobbering the sin_family field.



If this is true, then why are my packets sent at all?  The definition
of sockaddr_in (from /usr/include/netinet/in.h):

struct sockaddr_in {
uint8_t sin_len;
sa_family_t sin_family;
in_port_t   sin_port;
struct  in_addr sin_addr;
charsin_zero[8];
};


The definition of in_addr (from /usr/include/netinet/in.h):

struct in_addr {
in_addr_t s_addr;
};

The definition of in_addr_t (from /usr/include/netinet/in.h):
typedef uint32_tin_addr_t;

Passing in what I have, the address should indeed (as you've pointed
out) clobber the sin_family member.  However, since in_addr is
basically an unsigned integer, i.e. 4 bytes wide, shouldn't
inet_pton(3) clobber sin_len, sin_family  sin_port before ever
reaching sin_addr?  The sin_len  sin_family are 8 bit quantities, the
sin_port is 16 bits, that's 32.  If inet_pton(3) is expecting only an
in_addr I would think that a call to sendto(2) would fail because the
address in sin_addr is not filled, correct?


inet_pton() clobbered the fields you pointed out.  In fact the sin_family
field was being set to 0x01 which caused your initial EADDRNOTSUPPORT error
you were seeing.  You quick change fixed that problem.  However, (depending
on how sockaddr_in structure is actually allocated) the sin_addr field was
0.0.0.0.  This is actually an accepted form of the broadcast address for UDP
packets.  I forget exactly who the culprit was (Sun comes to mind) but there
was a need to allow broadcasts to 0.0.0.0 (which is also know as INADDR_ANY).
So, therefore, sendto() succeeded, just not in the way you expected.  Looking
at in_pcbconnect_setup() in the kernel shows that actually the packet is sent
to the local primary interface address.

Let's look at what really happen to that packet -

  192.168.0.1 after being mangled by inet_pton() gives
  the field sin_addr.s_addr of 0x0100A8C0.  This should make
  your sockaddr_in structure look like -

sa.sin_len = 0x01
sa.sin_family = 0x00
sa.sin_port = 0xA8C0 (which is port 49320)
sa.sin_addr.s_addr = 0x

So the sendto() call was sending a packet to your local interface for port 
49320.
And since UDP is a connectionless protocol, you don't have a way (unless it is
builtin to your application protocol) to determine an error.  For example, TFTP
sends back notification for every dgram received.

I hope this helps with your understanding.  I highly recommend if you are going
to do more network programming that you obtain at least some books on the 
subject.


Patrick
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: newbie internet connection question

2008-03-11 Thread Patrick Mahan



Paul Schmehl presented these words - circa 3/11/08 1:02 PM-
--On Tuesday, March 11, 2008 19:25:31 + Andy Watts 
[EMAIL PROTECTED] wrote:



Hi People

l downloaded FreeBSD 6.3 the other day out of curiosity..

The installation started ok but it all went wrong when it came to 
connecting

to the internet through my wired router

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/install-post.html 



l'm really not sure what entries to put in fig 2-29 that will allow my
connection.

My email address is [EMAIL PROTECTED]

My router's address is 192.168.1.1 and running ifconfig on my linux 
machine

gives the following:

eth0  Link encap:Ethernet  HWaddr 00:01:6C:E2:58:25  inet
addr:192.168.1.4  Bcast:192.168.1.255  Mask:255.255.255.0
 inet6 addr: fe80::201:6cff:fee2:5825/64 Scope:Link
 UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
 RX packets:5894 errors:0 dropped:0 overruns:0 frame:0
 TX packets:4645 errors:0 dropped:0 overruns:0 carrier:0
 collisions:0 txqueuelen:1000
 RX bytes:4431375 (4.2 MB)  TX bytes:616025 (601.5 KB)
 Interrupt:20 Base address:0xe400

loLink encap:Local Loopback  inet addr:127.0.0.1
Mask:255.0.0.0
 inet6 addr: ::1/128 Scope:Host
 UP LOOPBACK RUNNING  MTU:16436  Metric:1
 RX packets:48 errors:0 dropped:0 overruns:0 frame:0
 TX packets:48 errors:0 dropped:0 overruns:0 carrier:0
 collisions:0 txqueuelen:0
 RX bytes:5380 (5.2 KB)  TX bytes:5380 (5.2 KB)

Any pointers in the right direction would be greatly appreciated



If your router works like most do (and it appears that it does from the 
IP your linux box is getting), all you need to do is put this into 
/etc/rc.conf:


ifconfig_em0=DHCP

(or rerun sysinstall and configure your ethernet card to do dhcp.)

# sysinstall

Choose Configure/Networking/Interfaces and set your NIC to do dhcp.



Hmmm, he doesn't need to select DHCP (or maybe he already has) since the
interface (eth0) already has an assigned IP address on 192.168.1.0
network (192.168.1.4).  Can you ping the router's IP address ('ping
192.168.1.1')?  If so then you need to look at your router's external
IP address (the one that is actually visible to the Internet via your
ISP provided IP address).

Patrick
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: newbie internet connection question

2008-03-11 Thread Patrick Mahan



Mel presented these words - circa 3/11/08 6:10 PM-

On Wednesday 12 March 2008 01:46:40 Patrick Mahan wrote:

Paul Schmehl presented these words - circa 3/11/08 1:02 PM-


--On Tuesday, March 11, 2008 19:25:31 + Andy Watts

[EMAIL PROTECTED] wrote:




My router's address is 192.168.1.1 and running ifconfig on my linux
machine
gives the following:

eth0  Link encap:Ethernet  HWaddr 00:01:6C:E2:58:25  inet



Hmmm, he doesn't need to select DHCP (or maybe he already has) since the
interface (eth0)


See the problem with your statement? :p


I see, the info is from his Linux box.  So he either needs to ifconfig
his interface on FreeBSD or enable DHCP to get it assigned.

My bad,

Patrick
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: traceroute problems

2008-03-10 Thread Patrick Mahan



Jonathan Chen presented these words - circa 3/10/08 7:38 PM-

On Mon, Mar 10, 2008 at 11:30:05PM +0100, Wojciech Puchar wrote:

[...]

traceroute uses UDP packets, no special port numbers.


traceroute(8) indicates that the default UDP port number used is
udp/33434, incrementing for each hop out.


The incrementing is the TTL count in the IP header, not the port number.

It works by sending out a UDP packet for a (generally) unused port with
the TTL field to a specific number and looking for ICMP errors to 
indicate how far the packet went (the last node address is contained in

the ICMP error reply).  However, be warned, some network administrators
disable their routers from sending back these types of ICMP messages
to prevent you from learning about their routing paths.  In these cases,
you get back the 1 * * * type of output from traceroute.  Also, by
default traceroute attempts to do a reverse DNS on the IP address, so
you can speed things up by doing a 'traceroute -n' to avoid this look-up.

Patrick
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Having problems with my ports configuration

2008-02-29 Thread Patrick Mahan


System Info:

  Compaq Presario (AMD Athlon CPU)
  256 Mbytes RAM
  80 Gig IDE system disk
  FreeBSD 5.5-RELEASE #0: Tue May 23 14:58:27 UTC 2006

I am having problems with my current installed ports.  Last week
the drive where /usr/ports is upon (80 Gig IDE) start generating
READ errors on the console and hanging the system.  It took a few
days of doing multiple reboots, fsck and BIOS work before it was
back operating again.

One of the issues that came out of this was it seemed that the
ports database (/var/db/pkg/pkgdb.db) was corrupt.  So I tried
to rebuild it by deleting it and setting PKG_DBDIR).  I issued
a 'portsdb -Uu' and it fails -

host# portsdb -Uu
Updating the ports index ... Generating INDEX.tmp - please 
wait..p5-DateTime-Calendar-Japanese-0.06001: 
/usr/ports/japanese/p5-DateTime-Calendar-Japanese-Era non-existent -- 
dependency list incomplete

=== devel/p5-DateTime-Calendar-Japanese failed
*** Error code 1
1 error


I've tried fetching a new INDEX, done a pkgdb -Fu, but nothing seems to
work.

Also, 'pkg_info' gives no packages installed and portversion gives
** No matching package found: *.

So, somehow, I have managed to seriously hammer my ports/package
installation.  Is there a way to recover this info?  Is there any
way of determing just what is installed (I know of a few: Perl,
emacs, etc) from info stored under '/usr/ports'?

I've looked through the web and the archives and cannot seem to
find a similar type of problem.

Thanks,

Patrick
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Having problems with my ports configuration

2008-02-29 Thread Patrick Mahan



Mel presented these words - circa 2/29/08 1:56 PM-

On Friday 29 February 2008 21:25:06 Patrick Mahan wrote:

System Info:

   Compaq Presario (AMD Athlon CPU)
   256 Mbytes RAM
   80 Gig IDE system disk
   FreeBSD 5.5-RELEASE #0: Tue May 23 14:58:27 UTC 2006

I am having problems with my current installed ports.  Last week
the drive where /usr/ports is upon (80 Gig IDE) start generating
READ errors on the console and hanging the system.  It took a few
days of doing multiple reboots, fsck and BIOS work before it was
back operating again.

One of the issues that came out of this was it seemed that the
ports database (/var/db/pkg/pkgdb.db) was corrupt.  So I tried
to rebuild it by deleting it and setting PKG_DBDIR).  I issued
a 'portsdb -Uu' and it fails -


You're confusing .db's here. /vardb/pkg/pkgdb.db is fixed or rebuilt, using 
pkgdb -F. But read on...




Okay...


host# portsdb -Uu
Updating the ports index ... Generating INDEX.tmp - please
wait..p5-DateTime-Calendar-Japanese-0.06001:
/usr/ports/japanese/p5-DateTime-Calendar-Japanese-Era non-existent --
dependency list incomplete
=== devel/p5-DateTime-Calendar-Japanese failed
*** Error code 1
1 error


You're missing that directory, fsck probably deleted it. If you wanted to keep 
your old ports tree, you're outof luck without having a backup.

Otherwise:
csup -L2 /path/to/ports-supfile


This is cvsup, correct?



Or use portsnap, or whatever you're comfy with.



I've tried fetching a new INDEX, done a pkgdb -Fu, but nothing seems to
work.


pkgdb -F does nothing? No errors, warnings? Could be your /var/db/pkg is 
damaged as well, if it's the same disk.




pkgdb -F gives the following:

host# pkgdb -F
---  Checking the package registry database
host#

I'll look at using the other methods.  Is there any way I can hand parse
through the info under /usr/ports to determined everything I have installed?

Thanks,

Patrick

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Having problems with my ports configuration

2008-02-29 Thread Patrick Mahan



Shaun Amott presented these words - circa 2/29/08 6:45 PM-

On Fri, Feb 29, 2008 at 12:25:06PM -0800, Patrick Mahan wrote:

One of the issues that came out of this was it seemed that the
ports database (/var/db/pkg/pkgdb.db) was corrupt.  So I tried
to rebuild it by deleting it and setting PKG_DBDIR).  I issued
a 'portsdb -Uu' and it fails -


Do you have anything left under /var/db/pkg (presumably not, unless you
still have PKG_DBDIR set)?


host# portsdb -Uu
Updating the ports index ... Generating INDEX.tmp - please 
wait..p5-DateTime-Calendar-Japanese-0.06001: 
/usr/ports/japanese/p5-DateTime-Calendar-Japanese-Era non-existent -- 
dependency list incomplete

=== devel/p5-DateTime-Calendar-Japanese failed
*** Error code 1
1 error


Looks like you might have an old ports tree. Have you updated it lately?



I had done a portsnap about 6 hours before the first READ error on the
IDE drive.


So, somehow, I have managed to seriously hammer my ports/package
installation.  Is there a way to recover this info?  Is there any
way of determing just what is installed (I know of a few: Perl,
emacs, etc) from info stored under '/usr/ports'?


If you just removed the portupgrade database (which is all you
mentioned), you haven't lost anything important: it can be regenerated.
If the whole of /var/db/pkg was obliterated, you'll have to reinstall
everything. If you know what version of each port you had installed
(plus the OPTIONS, etc., used), installing over the top of what you have
now is probably the best you can do.



Unfortunately, the whole of /var/db/pkg was *pocked*.  As for knowing
what versions were installed, well, that's what I am trying to
determine.

I guess it looks like I am going to need a big *pocking* hammer

Thanks,

Patrick
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]