Re: Processing IP options reveals IPSTEALH router

2001-12-22 Thread Maxim Konovalov


Hello,

On 18:51+0300, Dec 21, 2001, Yar Tikhiy wrote:

> On Wed, Dec 19, 2001 at 08:54:50PM +0300, Maxim Konovalov wrote:
> > On 19:49+0300, Dec 19, 2001, Yar Tikhiy wrote:
> >
> > > As for source routing, I believe a stealthy router should just drop
> > > such packets as though it were a host.  Of course, source-routed
> > > packets destined for the router itself should be accepted.
> >
> > So there are three IPSTEALTH cases:
> >
> > 1/ the dst address is not ours, net.inet.ip.sourceroute=0,
> > net.inet.ip.forwarding=1: process ip options by ip_dooptions().
> >
> > 2/ the dst address is ours: process ip options by ip_dooptions(),
> >
> > 3/ in other cases do not process ip options.
>
> I made a patch that adds the "stealthy IP options feature".
> Honestly, now I'm afraid it's "much ado about nothing", given how
> clumsy solution is needed for such a small problem.  Even the way
> of ignoring IP options completely when doing IPSTEALTH looks way
> better...

IMHO it is not a good idea to forward a packet with possible incorrect
ip options.

The patch looks OK for me.

-- 
Maxim Konovalov, MAcomnet, Internet-Intranet Dept., system engineer
phone: +7 (095) 796-9079, mailto: [EMAIL PROTECTED]


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: Repost - f_type value in statfs structure

2001-12-22 Thread Alfred Perlstein

* Wayne Pascoe <[EMAIL PROTECTED]> [011222 17:13] wrote:
> Chad David <[EMAIL PROTECTED]> writes:
> 
> > > The issue that I am having is detecting valid filesystems to do
> > > further checks on. I am only interested in checking local filesystems
> > > such as UFS. 
> > 
> > Check for the MNT_LOCAL flag in f_flags.
> > 
> -- code example snipped --
> 
> Thanks for that. I've tried it and the problem with it is that it
> reports things like procfs and devfs as being local. The only things
> that don't appear local are things like nfs mounts.
> 
> I guess I need a way to check only filesystems mounted off of
> disks. Is there any way of doing this ? 

See GETFSENT(3).

-Alfred

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: Repost - f_type value in statfs structure

2001-12-22 Thread Wayne Pascoe

Chad David <[EMAIL PROTECTED]> writes:

> > The issue that I am having is detecting valid filesystems to do
> > further checks on. I am only interested in checking local filesystems
> > such as UFS. 
> 
> Check for the MNT_LOCAL flag in f_flags.
> 
-- code example snipped --

Thanks for that. I've tried it and the problem with it is that it
reports things like procfs and devfs as being local. The only things
that don't appear local are things like nfs mounts.

I guess I need a way to check only filesystems mounted off of
disks. Is there any way of doing this ? 


-- 
- Wayne Pascoe
 | I laugh in the face of danger...
[EMAIL PROTECTED]  | Then I run and hide until it goes away!
http://www.molemanarmy.com   | 

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: The care and feeding of Vnodes?

2001-12-22 Thread Lamont Granquist



On Sat, 22 Dec 2001, Alfred Perlstein wrote:
> * Lamont Granquist <[EMAIL PROTECTED]> [011222 16:06] wrote:
> > So, yesterday I was playing around with the VFS code and trying to figure
> > out how to get a 'stub' of a filesystem that I could mount and unmount.
> > To do so I need to implement vfs_root() which requires returning a vnode
> > for the root of the filesystem.  So, I just called getnewvnode(), passing
> > it some 'stubby' vfsops that would just printf() whenever they were
> > called.  That way I thought I could figure out what was getting done to
> > the vnode.  I didn't do any other initialization to the vnode.
> >
> > So, I mounted the filesystem this way, and tried to unmount it and I got a
> > couple of vnops further into getting the filesystem to unmount.  However,
> > a few minutes later my laptop locked up, and upon rebooting I got
> > softupdate inconsistencies and filesystem corruption.  How did I manage to
> > hose my system this badly just playing around with one vnode?  And what
> > should I do in order to pass back this kind of "fake" root vnode that
> > isn't backed up by any actual filestore?
>
> Most likely your misbehaving VOPs caused corruption of other data.

that's a little odd, because the VOPs were just the vfs_default.c ones
with printf()s thrown in them

> Without source to your failed experiment it will be hard to determine
> what the problem is.

'k, here you go:

/* lcgfs_vfsops.c */

#include 
#include 
#include 
#include 
#include 

vop_t **lcgfs_vnodeop_p; /* XXX: needs to go in header file */

static int lcgfs_statfs __P((struct mount *, struct statfs *, struct proc *));
static int lcgfs_mount __P((struct mount *, char *, caddr_t, struct nameidata *, 
struct proc *));
static int lcgfs_root __P((struct mount *mp, struct vnode **vpp));

static int lcgfs_mount_stub __P((struct mount *mp, char *path, caddr_t data,
struct nameidata *ndp, struct proc *p));
static int lcgfs_start_stub __P((struct mount *mp, int flags, struct proc *p));
static int lcgfs_unmount_stub __P((struct mount *mp, int mntflags,
struct proc *p));
static int lcgfs_root_stub __P((struct mount *mp, struct vnode **vpp));
static int lcgfs_quotactl_stub __P((struct mount *mp, int cmds, uid_t uid,
caddr_t arg, struct proc *p));
static int lcgfs_statfs_stub __P((struct mount *mp, struct statfs *sbp,
struct proc *p));
static int lcgfs_sync_stub __P((struct mount *mp, int waitfor,
struct ucred *cred, struct proc *p));
static int lcgfs_vget_stub __P((struct mount *mp, ino_t ino,
struct vnode **vpp));
static int lcgfs_fhtovp_stub __P((struct mount *mp, struct fid *fhp,
struct vnode **vpp));
static int lcgfs_checkexp_stub __P((struct mount *mp, struct sockaddr *nam,
int *extflagsp, struct ucred **credanonp));
static int lcgfs_vptofh_stub __P((struct vnode *vp, struct fid *fhp));
static int lcgfs_init_stub __P((struct vfsconf *));
static int lcgfs_uninit_stub __P((struct vfsconf *));
static int lcgfs_extattrctl_stub __P((struct mount *mp, int cmd,
 const char *attrname, caddr_t arg, struct proc *p));


static int
lcgfs_statfs(mp,  sbp, p)
struct mount *mp;
struct statfs *sbp;
struct proc *p;
{
sbp->f_bsize  = 512;
sbp->f_iosize = 512;
sbp->f_blocks = 1024;
sbp->f_bfree  = 512;
sbp->f_bavail = 512;
sbp->f_files  = 11;
sbp->f_ffree  = 22;
if (sbp != &mp->mnt_stat) {
sbp->f_type = mp->mnt_vfc->vfc_typenum;
bcopy((caddr_t)mp->mnt_stat.f_mntonname,
(caddr_t)&sbp->f_mntonname[0], MNAMELEN);
bcopy((caddr_t)mp->mnt_stat.f_mntfromname,
(caddr_t)&sbp->f_mntfromname[0], MNAMELEN);
}
strncpy(sbp->f_fstypename, mp->mnt_vfc->vfc_name, MFSNAMELEN);
return (0);
}

static int
lcgfs_mount(mp, path, data, ndp, p)
struct mount *mp;
char *path;
caddr_t data;
struct nameidata *ndp;
struct proc *p;
{
size_t size;

(void) copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN - 1, &size);
bzero(mp->mnt_stat.f_mntonname + size, MNAMELEN - size);
strcpy(mp->mnt_stat.f_mntfromname, "lcgfs");
bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - 5);
/*  (void) copyinstr(args.fspec, mp->mnt_stat.f_mntfromname, MNAMELEN - 1,
&size);
bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size); */
(void) lcgfs_statfs(mp, &mp->mnt_stat, p);

return(0);

}



int
lcgfs_mount_stub (mp, path, data, ndp, p)
struct mount *mp;
char *path;
caddr_t data;
struct nameidata *ndp;
struct proc *p;
{
printf("lcgfs_mount_stub\n");
return (0);
}

int
lcgfs_unmount_stub (mp, mntflags, p)
struct mount *mp;
int mntflags;
struct proc *p;
{
printf("lcgfs_unmount_stub\n");
return (0);

Re: The care and feeding of Vnodes?

2001-12-22 Thread Alfred Perlstein

* Lamont Granquist <[EMAIL PROTECTED]> [011222 16:06] wrote:
> 
> So, yesterday I was playing around with the VFS code and trying to figure
> out how to get a 'stub' of a filesystem that I could mount and unmount.
> To do so I need to implement vfs_root() which requires returning a vnode
> for the root of the filesystem.  So, I just called getnewvnode(), passing
> it some 'stubby' vfsops that would just printf() whenever they were
> called.  That way I thought I could figure out what was getting done to
> the vnode.  I didn't do any other initialization to the vnode.
> 
> So, I mounted the filesystem this way, and tried to unmount it and I got a
> couple of vnops further into getting the filesystem to unmount.  However,
> a few minutes later my laptop locked up, and upon rebooting I got
> softupdate inconsistencies and filesystem corruption.  How did I manage to
> hose my system this badly just playing around with one vnode?  And what
> should I do in order to pass back this kind of "fake" root vnode that
> isn't backed up by any actual filestore?

Most likely your misbehaving VOPs caused corruption of other data.

Without source to your failed experiment it will be hard to determine
what the problem is.

-- 
-Alfred Perlstein [[EMAIL PROTECTED]]
'Instead of asking why a piece of software is using "1970s technology,"
 start asking why software is ignoring 30 years of accumulated wisdom.'
Tax deductable donations for FreeBSD: http://www.freebsdfoundation.org/

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



The care and feeding of Vnodes?

2001-12-22 Thread Lamont Granquist


So, yesterday I was playing around with the VFS code and trying to figure
out how to get a 'stub' of a filesystem that I could mount and unmount.
To do so I need to implement vfs_root() which requires returning a vnode
for the root of the filesystem.  So, I just called getnewvnode(), passing
it some 'stubby' vfsops that would just printf() whenever they were
called.  That way I thought I could figure out what was getting done to
the vnode.  I didn't do any other initialization to the vnode.

So, I mounted the filesystem this way, and tried to unmount it and I got a
couple of vnops further into getting the filesystem to unmount.  However,
a few minutes later my laptop locked up, and upon rebooting I got
softupdate inconsistencies and filesystem corruption.  How did I manage to
hose my system this badly just playing around with one vnode?  And what
should I do in order to pass back this kind of "fake" root vnode that
isn't backed up by any actual filestore?


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: IP options (was: Processing IP options reveals IPSTEALH router)

2001-12-22 Thread Maxim Konovalov


Hi, Yar,

On 19:12+0300, Dec 21, 2001, Yar Tikhiy wrote:

> On Thu, Dec 20, 2001 at 01:24:48AM +0300, Maxim Konovalov wrote:
> >
> > > Neither RFC 791 nor RFC 1122 nor RFC 1812 specify the following:
> > > if a source-routed IP packet reachs the end of its route, but its
> > > destination address doesn't match a current host/router, whether
> > > the packet should be discarded, sent forth through usual routing
> > > or accepted as destined for this host?  FreeBSD will route such a
> > > packet as usual.
> >
> > Stevens, TCP Ill. vII, p.257 says:
> >
> > "If the destination address of the packet does not match one of the
> > local addresses and the option is a strict source routing
> > (IPOPT_SSRR), an ICMP source route failure error is sent. If a local
> > address isn't listed in the route, the previous system sent the packet
> > to the wrong host. This isn't an error for a loose source route
> > (IPOPT_LSRR); it means IP must forward the packet toward the
> > destionation."
> >
> > That is what ip_input does near the line 1193.
>
> Oops, it appeared that I misunderstood the way the source route
> record worked.  FreeBSD does it right, except for a host (ipforwarding=0)
> replying with error ICMP on some source route attempts.
> What about the following small change?
>
> --- /usr/src/sys/netinet.orig/ip_input.c  Fri Dec  7 00:54:48 2001
> +++ netinet/ip_input.cFri Dec 21 19:08:56 2001
> @@ -1212,13 +1212,13 @@
>   ia = (struct in_ifaddr *)
>   ifa_ifwithaddr((struct sockaddr *)&ipaddr);
>   if (ia == 0) {
> + if (!ip_dosourceroute)
> + goto nosourcerouting;

Nice catch.

>   if (opt == IPOPT_SSRR) {
>   type = ICMP_UNREACH;
>   code = ICMP_UNREACH_SRCFAIL;
>   goto bad;
>   }
> - if (!ip_dosourceroute)
> - goto nosourcerouting;
>   /*
>* Loose routing, and not at next destination
>* yet; nothing to do except forward.
> @@ -1231,18 +1231,19 @@
>* End of source route.  Should be for us.
>*/
>   if (!ip_acceptsourceroute)
> - goto nosourcerouting;
> + goto logandsendicmp;
>   save_rte(cp, ip->ip_src);
>   break;
>   }
>
>   if (!ip_dosourceroute) {
> +nosourcerouting:

I do not agree here. As far as I understand when we recieve a SSRR
packet and there are no our addresses in the source routing addresses
list we have to send ICPM_UNREACH to the sender regardless of
net.inet.ip.forwarding.

>   if (ipforwarding) {
>   char buf[16]; /* aaa.bbb.ccc.ddd\0 */
>   /*
>* Acting as a router, so generate ICMP
>*/
> -nosourcerouting:
> +logandsendicmp:
>   strcpy(buf, inet_ntoa(ip->ip_dst));
>   log(LOG_WARNING,
>   "attempted source route from %s to %s\n",
>
>

Btw, there are many compares like

cnt < IPOPT_OLEN + sizeof(*cp)

in ip_doiptions(). IMHO more strict to compare agains IPOPT_MIN
because multibyte ip options length cannot be less then four bytes. Am
I wrong?

-- 
Maxim Konovalov, MAcomnet, Internet-Intranet Dept., system engineer
phone: +7 (095) 796-9079, mailto: [EMAIL PROTECTED]


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: how to mirror gnats db?

2001-12-22 Thread Nik Clayton

On Fri, Dec 21, 2001 at 04:54:43AM -0800, Hiten Pandya wrote:
> I wanted to ask, how I could mirror the gnats database
> to my own system.  I have cvsup.

http://www.freebsd.org/doc/en_US.ISO8859-1/articles/committers-guide/gnats.html

N
-- 
FreeBSD: The Power to Serve http://www.freebsd.org/
FreeBSD Documentation Project   http://www.freebsd.org/docproj/

  --- 15B8 3FFC DDB4 34B0 AA5F  94B7 93A8 0764 2C37 E375 ---



msg30394/pgp0.pgp
Description: PGP signature


Re: Installing FreeBSD on a 20Gb disc on a laptop with old BIOS

2001-12-22 Thread Adrian Penisoara

Hi,

  I'm not sure wether I've had this problem, but to me it seems that the
right solution is:

  * let the IBM DM make that FAT partition, because that's what helps
fdisk recognize the correct disk geometry (see the docs)

  * in the sysinstall delete that FAT partition and make one small slice
(no more than 500Mb) which will hold the root filesystem (otherwise
the bootloader won't be able to load the kernel) and make the rest a
separate slice

  * in disklabel make the / fs in the first slice (ad0s1a) and the rest of
the filesystems in the second slice (ad0s2). The swap can be in either
of them two.

 My $0.02
 Ady (@warpnet.ro)
___
| Programming in BASIC causes brain damage.   |
|   (Edsger Wybe Dijkstra)|

On Wed, 19 Dec 2001, Karl-Petter [iso-8859-1] Ã…kesson wrote:

> Hi,
> 
> I have an old IBM thinkpad 560 that I want to runt FreeBSD on. The
> original drive is only 2Gb so I upgraded to a 20Gb. Now it turned out
> that the BIOS was to old to support this and the laptop locked-up during
> the initialization phase before booting. DDO(Dynamic Drive Overlay) from
> OnTrack solved this since it tricks the BIOS to believe it has a much
> smaller drive.
> 
> But It seems to trick FDISK in the FreeBSD installation as well.
> I have tried a lot of different ways to come around this but somehow I
> always end up with a non-working system :-(
> 
> If I just install DDO on the drive and then start the FREEBSD
> installation FDISK thinks the drive starts at sector -63 and gets very
> confused. I solved this by letting the IBM Disk Manager, the software
> that I use to install DDO, to create a FAT partition in the beginning of
> the drive, only 100 MB.
> Now I can use the rest of the disk in FDISK to make it a FREEBSD
> partition, but it wont boot. Changing the first 100MB partition to
> FreeBSD type, does not help, the label editor cant use it, says "Unable
> to create partition. Too big?".
> 
> Anyone that have succesfully managed to install FreeBSD on a large drive
> that isnt supported by the BIOS and use the entire disk for FreeBSD? Any
> tips would be very welcome!
> 
> Kalle
> 
> To Unsubscribe: send mail to [EMAIL PROTECTED]
> with "unsubscribe freebsd-hackers" in the body of the message
> 


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: Processing IP options reveals IPSTEALH router

2001-12-22 Thread Yar Tikhiy

On Wed, Dec 19, 2001 at 08:54:50PM +0300, Maxim Konovalov wrote:
> On 19:49+0300, Dec 19, 2001, Yar Tikhiy wrote:
> 
> > As for source routing, I believe a stealthy router should just drop
> > such packets as though it were a host.  Of course, source-routed
> > packets destined for the router itself should be accepted.
> 
> So there are three IPSTEALTH cases:
> 
> 1/ the dst address is not ours, net.inet.ip.sourceroute=0,
> net.inet.ip.forwarding=1: process ip options by ip_dooptions().
> 
> 2/ the dst address is ours: process ip options by ip_dooptions(),
> 
> 3/ in other cases do not process ip options.

I made a patch that adds the "stealthy IP options feature".
Honestly, now I'm afraid it's "much ado about nothing", given how
clumsy solution is needed for such a small problem.  Even the way
of ignoring IP options completely when doing IPSTEALTH looks way
better...

-- 
Yar

P.S. Here's the patch:

--- ip_input.c.orig Fri Dec  7 00:54:48 2001
+++ ip_input.c  Fri Dec 21 17:59:22 2001
@@ -211,7 +211,7 @@
 struct sockaddr_in *ip_fw_fwd_addr;
 
 static voidsave_rte __P((u_char *, struct in_addr));
-static int ip_dooptions __P((struct mbuf *));
+static int ip_dooptions __P((struct mbuf *, int));
 static voidip_forward __P((struct mbuf *, int));
 static voidip_freef __P((struct ipqhead *, struct ipq *));
 #ifdef IPDIVERT
@@ -499,7 +499,7 @@
 * to be sent and the original packet to be freed).
 */
ip_nhops = 0;   /* for source routed packets */
-   if (hlen > sizeof (struct ip) && ip_dooptions(m)) {
+   if (hlen > sizeof (struct ip) && ip_dooptions(m, 0)) {
 #ifdef IPFIREWALL_FORWARD
ip_fw_fwd_addr = NULL;
 #endif
@@ -657,6 +657,19 @@
return;
 
 ours:
+#ifdef IPSTEALTH
+   /*
+* IPSTEALTH: Process non-routing options only
+* if the packet is destined for us.
+*/
+   if (ipstealth && hlen > sizeof (struct ip) && ip_dooptions(m, 1)) {
+#ifdef IPFIREWALL_FORWARD
+   ip_fw_fwd_addr = NULL;
+#endif
+   return;
+   }
+#endif /* IPSTEALTH */
+
/* Count the packet in the ip address stats */
if (ia != NULL) {
ia->ia_ifa.if_ipackets++;
@@ -1150,12 +1163,18 @@
  * Do option processing on a datagram,
  * possibly discarding it if bad options are encountered,
  * or forwarding it if source-routed.
+ * The pass argument is used when operating in the IPSTEALTH
+ * mode to tell what options to process:
+ * [LS]SRR (pass 0) or the others (pass 1).
+ * The reason for as many as two passes is that non-routing options
+ * must not be processed if the packet isn't for us when doing IPSTEALH.
  * Returns 1 if packet has been forwarded/freed,
  * 0 if the packet should be processed further.
  */
 static int
-ip_dooptions(m)
+ip_dooptions(m, pass)
struct mbuf *m;
+   int pass;
 {
register struct ip *ip = mtod(m, struct ip *);
register u_char *cp;
@@ -1200,6 +1219,10 @@
 */
case IPOPT_LSRR:
case IPOPT_SSRR:
+#ifdef IPSTEALTH
+   if (ipstealth && pass > 0)
+   break;
+#endif
if (optlen < IPOPT_OFFSET + sizeof(*cp)) {
code = &cp[IPOPT_OLEN] - (u_char *)ip;
goto bad;
@@ -1235,7 +1258,10 @@
save_rte(cp, ip->ip_src);
break;
}
-
+#ifdef IPSTEALTH
+   if (ipstealth)
+   goto dropit;
+#endif
if (!ip_dosourceroute) {
if (ipforwarding) {
char buf[16]; /* aaa.bbb.ccc.ddd\0 */
@@ -1254,6 +1280,9 @@
/*
 * Not acting as a router, so silently drop.
 */
+#ifdef IPSTEALTH
+dropit:
+#endif
ipstat.ips_cantforward++;
m_freem(m);
return (1);
@@ -1289,6 +1318,10 @@
break;
 
case IPOPT_RR:
+#ifdef IPSTEALTH
+   if (ipstealth && pass == 0)
+   break;
+#endif
if (optlen < IPOPT_OFFSET + sizeof(*cp)) {
code = &cp[IPOPT_OFFSET] - (u_char *)ip;
goto bad;
@@ -1322,6 +1355,10 @@
break;
 
case IPOPT_TS:
+#ifdef IPSTEALTH
+   if (ipstealth && pass == 0)
+   break;
+#endif
code = cp - (u_char *)ip;
if (optlen < 4 || optlen > 40) {
code = &cp[IPOPT_OLEN] - (u_char *)ip;

To Unsubscri

Re: IP options (was: Processing IP options reveals IPSTEALH router)

2001-12-22 Thread Yar Tikhiy

On Thu, Dec 20, 2001 at 01:24:48AM +0300, Maxim Konovalov wrote:
> 
> > Neither RFC 791 nor RFC 1122 nor RFC 1812 specify the following:
> > if a source-routed IP packet reachs the end of its route, but its
> > destination address doesn't match a current host/router, whether
> > the packet should be discarded, sent forth through usual routing
> > or accepted as destined for this host?  FreeBSD will route such a
> > packet as usual.
> 
> Stevens, TCP Ill. vII, p.257 says:
> 
> "If the destination address of the packet does not match one of the
> local addresses and the option is a strict source routing
> (IPOPT_SSRR), an ICMP source route failure error is sent. If a local
> address isn't listed in the route, the previous system sent the packet
> to the wrong host. This isn't an error for a loose source route
> (IPOPT_LSRR); it means IP must forward the packet toward the
> destionation."
> 
> That is what ip_input does near the line 1193.

Oops, it appeared that I misunderstood the way the source route
record worked.  FreeBSD does it right, except for a host (ipforwarding=0)
replying with error ICMP on some source route attempts.
What about the following small change?

--- /usr/src/sys/netinet.orig/ip_input.cFri Dec  7 00:54:48 2001
+++ netinet/ip_input.c  Fri Dec 21 19:08:56 2001
@@ -1212,13 +1212,13 @@
ia = (struct in_ifaddr *)
ifa_ifwithaddr((struct sockaddr *)&ipaddr);
if (ia == 0) {
+   if (!ip_dosourceroute)
+   goto nosourcerouting;
if (opt == IPOPT_SSRR) {
type = ICMP_UNREACH;
code = ICMP_UNREACH_SRCFAIL;
goto bad;
}
-   if (!ip_dosourceroute)
-   goto nosourcerouting;
/*
 * Loose routing, and not at next destination
 * yet; nothing to do except forward.
@@ -1231,18 +1231,19 @@
 * End of source route.  Should be for us.
 */
if (!ip_acceptsourceroute)
-   goto nosourcerouting;
+   goto logandsendicmp;
save_rte(cp, ip->ip_src);
break;
}
 
if (!ip_dosourceroute) {
+nosourcerouting:
if (ipforwarding) {
char buf[16]; /* aaa.bbb.ccc.ddd\0 */
/*
 * Acting as a router, so generate ICMP
 */
-nosourcerouting:
+logandsendicmp:
strcpy(buf, inet_ntoa(ip->ip_dst));
log(LOG_WARNING, 
"attempted source route from %s to %s\n",

-- 
Yar

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



[no subject]

2001-12-22 Thread yorickhardy

[EMAIL PROTECTED]
Subject: Re: patch for sb live record channel dead
In-Reply-To: <053501c18ada$11efb3f0$4004020a@haveblue>

My apologies, I noticed others having this problem (on the mailing list)
and when there was no response I thought I should have a go.

My apologies again for the inconvenience.

Yorick.

> This patch should fix the pcm0 recording channel dead error for the
> sb live. This is my first patch, so I hope it applies correctly.
> The patch is against stable, I do not believe it will work for current
> but I might be able to fix this also if the problem is present in
> current.

sigh, i do wish people would report these problems *before* we freeze.

i won't apply this for now- the better solution is to disable the efx and
dedicated-mic recording channel as we don't use the efx channel and none of
the sblives have a codec with a dedicated mic channel.

-current does not suffer this problem.

-cg


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: patch for sb live rear output

2001-12-22 Thread cameron grant

> This patch should enable the rear output (not digital to my knowledge) for
> the sb live, the volume can be set using the pcm2 setting from the mixer.

thanks for the patch.

i have a more general extensible mixer design in the works which will go
into -current soon.  once that's done, various drivers will be extended to
provide more control of features like spdif, rear speakers etc.  i will then
commit a version of your patch, modified for the new mixer code.

-cg



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: patch for sb live record channel dead

2001-12-22 Thread cameron grant

> This patch should fix the pcm0 recording channel dead error for the
> sb live. This is my first patch, so I hope it applies correctly.
> The patch is against stable, I do not believe it will work for current
> but I might be able to fix this also if the problem is present in
> current.

sigh, i do wish people would report these problems *before* we freeze.

i won't apply this for now- the better solution is to disable the efx and
dedicated-mic recording channel as we don't use the efx channel and none of
the sblives have a codec with a dedicated mic channel.

-current does not suffer this problem.

-cg



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



patch for sb live rear output

2001-12-22 Thread yorickhardy

This patch should enable the rear output (not digital to my knowledge) for
the sb live, the volume can be set using the pcm2 setting from the mixer.

I hope the patch applies correctly. It should work when applied with
/usr/src as the current directory.

Yorick Hardy.


*** sys/dev/sound/pci/emu10k1.c.origTue Dec 21 11:01:14 1999
--- sys/dev/sound/pci/emu10k1.c Fri Dec 21 22:33:00 2001
***
*** 28,33 
--- 28,34 

#include 
#include 
+ #include "mixer_if.h"
#include 

#include 
***
*** 39,44 
--- 40,49 
#define EMU10K1_PCI_ID  0x00021102
#define EMU_BUFFSIZE4096
#define EMU_CHANS   4
+ /*define which general purpose registers to use 
+   to store the rear volume information*/
+ #define REARLVOLREG   0x110
+ #define REARRVOLREG   0x111
#undef EMUDEBUG

struct emu_memblk {
***
*** 88,93 
--- 93,101 
device_tdev;
u_int32_t   type, rev;
u_int32_t   tos_link:1, APS:1;
+   u_int32_t   rearvol_ops;
+ 
+   struct snd_mixer *ac97mixer;

bus_space_tag_t st;
bus_space_handle_t sh;
***
*** 127,132 
--- 135,149 
static u_int32_t emu_rd(struct sc_info *, int, int);
static void emu_wr(struct sc_info *, int, u_int32_t, int);

+ /* mixer */
+ static int emumix_init(struct snd_mixer *m);
+ static int emumix_reinit(struct snd_mixer *m);
+ static int emumix_uninit(struct snd_mixer *m);
+ static int emumix_set(struct snd_mixer *m, unsigned dev, unsigned left, unsigned 
+right);
+ static u_int32_t emumix_setrecsrc(struct snd_mixer *m, u_int32_t src);
+ kobj_class_t emu_getmixerclass(void);
+ extern struct malloc_type M_MIXER[1];
+ 
/*  */

static u_int32_t emu_rfmt_ac97[] = {
***
*** 163,168 
--- 180,193 

static int adcspeed[8] = {48000, 44100, 32000, 24000, 22050, 16000, 11025, 8000};

+ #define MAX_EFX_CONSTS 17
+ static int efx_consts[2*MAX_EFX_CONSTS] = {
+   0x0, 0x40, 0x1, 0x41, 0x2, 0x42, 0x3, 0x43, 0x4, 0x44, 0x8, 0x45,
+   0x10, 0x46, 0x20, 0x047, 0x100, 0x048, 0x1, 0x049, 0x8, 0x4a,
+   0x1000, 0x04b, 0x2000, 0x4c, 0x4000, 0x4d, 0x8000, 0x4e,
+   0x7fff, 0x4f, 0x, 0x50
+ };
+ 
/*  */
/* Hardware */
static u_int32_t
***
*** 1180,1187 
emu_addefxop(sc, 6, 0x21, 0x40, 0x41, 0x101, &pc);
/* RearOut = (GPR[0/1] * RearVolume) >> 31 */
/*   RearVolume = GRP[0x10/0x11] */
!   emu_addefxop(sc, 0, 0x28, 0x40, 0x110, 0x100, &pc);
!   emu_addefxop(sc, 0, 0x29, 0x40, 0x111, 0x101, &pc);
/* TOS out = GPR[0/1] */
emu_addefxop(sc, 6, 0x22, 0x40, 0x40, 0x100, &pc);
emu_addefxop(sc, 6, 0x23, 0x40, 0x40, 0x101, &pc);
--- 1205,1221 
emu_addefxop(sc, 6, 0x21, 0x40, 0x41, 0x101, &pc);
/* RearOut = (GPR[0/1] * RearVolume) >> 31 */
/*   RearVolume = GRP[0x10/0x11] */
!   emu_addefxop(sc, 6, 0x100, 0x100, 0x40, 0x10, &pc);
!   emu_addefxop(sc, 6, 0x101, 0x101, 0x40, 0x11, &pc);
!   emu_addefxop(sc, 6, REARLVOLREG, 0x40, 0x40, 0x40, &pc);
!   emu_addefxop(sc, 6, REARRVOLREG, 0x40, 0x40, 0x40, &pc);
!   sc->rearvol_ops = pc;
!   for (i = 0; i < MAX_EFX_CONSTS; i++) {
!   emu_addefxop(sc, 6, REARLVOLREG, 0x40, 0x40, 0x40, &pc);
!   emu_addefxop(sc, 6, REARRVOLREG, 0x40, 0x40, 0x40, &pc);
!   }
!   emu_addefxop(sc, 0, 0x28, 0x40, REARLVOLREG, 0x100, &pc);
!   emu_addefxop(sc, 0, 0x29, 0x40, REARRVOLREG, 0x101, &pc);
/* TOS out = GPR[0/1] */
emu_addefxop(sc, 6, 0x22, 0x40, 0x40, 0x100, &pc);
emu_addefxop(sc, 6, 0x23, 0x40, 0x40, 0x101, &pc);
***
*** 1472,1478 

codec = AC97_CREATE(dev, sc, emu_ac97);
if (codec == NULL) goto bad;
!   if (mixer_init(dev, ac97_getmixerclass(), codec) == -1) goto bad;

sc->irqid = 0;
sc->irq = bus_alloc_resource(dev, SYS_RES_IRQ, &sc->irqid,
--- 1506,1519 

codec = AC97_CREATE(dev, sc, emu_ac97);
if (codec == NULL) goto bad;
! 
!   /* unsure how to do this nicely,
!  copy the code from mixer.c to access the ac97 mixer */
!   sc->ac97mixer = (struct snd_mixer *)kobj_create(ac97_getmixerclass(), M_MIXER, 
M_WAITOK | M_ZERO);
!   if (sc->ac97mixer == NULL) goto bad;
!   mix_setdevinfo(sc->ac97mixer, codec);
! 
!   if (mixer_init(dev, emu_getmixerclass(), sc) == -1) goto bad;

sc->irqid = 0;
sc->irq = bus_alloc_resource(dev, SYS_RES_IRQ, &sc->irqid,
***
*** 1497,1502 
--- 1538,1544 
return 0;

bad:
+   if (sc->ac97mixer) kobj_delete((kobj_t)sc->ac97mixer, M_MIXER);
if (codec) ac97_destroy(codec);
if (sc->reg) bus_release_resource(dev, sc->regtype, sc->regid, sc->reg);
if (sc->ih) bus_teardown_intr(dev, sc->irq, sc->ih);
***
*** 1597,1600 
--- 1639,1735 
static devclass_t emujoy_devclass;

DRIVER_MODULE(emujoy, pci, emujoy_driver, emujoy_devclass, 0, 0);
+ 
+ 
+ static int
+ emumix_init(struct snd_mixer *m)
+ {
+   s

patch for sb live record channel dead

2001-12-22 Thread yorickhardy

This patch should fix the pcm0 recording channel dead error for the
sb live. This is my first patch, so I hope it applies correctly.
The patch is against stable, I do not believe it will work for current
but I might be able to fix this also if the problem is present in 
current.

(the patch can be applied from /usr/src as the current directory.)

Yorick Hardy.

*** /home/yorick/FreeBSD/ctm/src/sys/dev/sound/pci/emu10k1.cWed Aug  1 23:32:24 
2001
--- sys/dev/sound/pci/emu10k1.c Tue Dec 21 11:01:14 1999
***
*** 146,154 
};

static struct pcmchan_caps emu_reccaps[3] = {
-   {8000, 48000, emu_rfmt_ac97, 0},
-   {8000, 8000, emu_rfmt_mic, 0},
{48000, 48000, emu_rfmt_efx, 0},
};

static u_int32_t emu_pfmt[] = {
--- 146,154 
};

static struct pcmchan_caps emu_reccaps[3] = {
{48000, 48000, emu_rfmt_efx, 0},
+   {8000, 8000, emu_rfmt_mic, 0},
+   {8000, 48000, emu_rfmt_ac97, 0},
};

static u_int32_t emu_pfmt[] = {
***
*** 765,771 
ch->spd = 8000;
ch->num = sc->rnum;
switch(sc->rnum) {
!   case 0:
ch->idxreg = ADCIDX;
ch->basereg = ADCBA;
ch->sizereg = ADCBS;
--- 765,771 
ch->spd = 8000;
ch->num = sc->rnum;
switch(sc->rnum) {
!   case 2:
ch->idxreg = ADCIDX;
ch->basereg = ADCBA;
ch->sizereg = ADCBS;
***
*** 781,787 
ch->irqmask = INTE_MICBUFENABLE;
break;

!   case 2:
ch->idxreg = FXIDX;
ch->basereg = FXBA;
ch->sizereg = FXBS;
--- 781,787 
ch->irqmask = INTE_MICBUFENABLE;
break;

!   case 0:
ch->idxreg = FXIDX;
ch->basereg = FXBA;
ch->sizereg = FXBS;
***
*** 815,825 
{
struct sc_rchinfo *ch = data;

!   if (ch->num == 0)
speed = adcspeed[emu_recval(speed)];
if (ch->num == 1)
speed = 8000;
!   if (ch->num == 2)
speed = 48000;
ch->spd = speed;
return ch->spd;
--- 815,825 
{
struct sc_rchinfo *ch = data;

!   if (ch->num == 2)
speed = adcspeed[emu_recval(speed)];
if (ch->num == 1)
speed = 8000;
!   if (ch->num == 0)
speed = 48000;
ch->spd = speed;
return ch->spd;
***
*** 854,860 
case PCMTRIG_START:
ch->run = 1;
emu_wrptr(sc, 0, ch->sizereg, ADCBS_BUFSIZE_4096);
!   if (ch->num == 0) {
val = ADCCR_LCHANENABLE;
if (ch->fmt & AFMT_STEREO)
val |= ADCCR_RCHANENABLE;
--- 854,860 
case PCMTRIG_START:
ch->run = 1;
emu_wrptr(sc, 0, ch->sizereg, ADCBS_BUFSIZE_4096);
!   if (ch->num == 2) {
val = ADCCR_LCHANENABLE;
if (ch->fmt & AFMT_STEREO)
val |= ADCCR_RCHANENABLE;
***
*** 939,946 

if (stat & (IPR_ADCBUFFULL | IPR_ADCBUFHALFFULL)) {
ack |= stat & (IPR_ADCBUFFULL | IPR_ADCBUFHALFFULL);
!   if (sc->rch[0].channel)
!   chn_intr(sc->rch[0].channel);
}
if (stat & (IPR_MICBUFFULL | IPR_MICBUFHALFFULL)) {
ack |= stat & (IPR_MICBUFFULL | IPR_MICBUFHALFFULL);
--- 939,946 

if (stat & (IPR_ADCBUFFULL | IPR_ADCBUFHALFFULL)) {
ack |= stat & (IPR_ADCBUFFULL | IPR_ADCBUFHALFFULL);
!   if (sc->rch[2].channel)
!   chn_intr(sc->rch[2].channel);
}
if (stat & (IPR_MICBUFFULL | IPR_MICBUFHALFFULL)) {
ack |= stat & (IPR_MICBUFFULL | IPR_MICBUFHALFFULL);
***
*** 949,956 
}
if (stat & (IPR_EFXBUFFULL | IPR_EFXBUFHALFFULL)) {
ack |= stat & (IPR_EFXBUFFULL | IPR_EFXBUFHALFFULL);
!   if (sc->rch[2].channel)
!   chn_intr(sc->rch[2].channel);
}
if (stat & IPR_PCIERROR) {
ack |= IPR_PCIERROR;
--- 949,956 
}
if (stat & (IPR_EFXBUFFULL | IPR_EFXBUFHALFFULL)) {
ack |= stat & (IPR_EFXBUFFULL | IPR_EFXBUFHALFFULL);
!   if (sc->rch[0].channel)
!   chn_intr(sc->rch[0].channel);
}
if (stat & IPR_PCIERROR) {
ack |= IPR_PCIERROR;


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: Another filesystem test program

2001-12-22 Thread Kris Kennaway

On Fri, Dec 21, 2001 at 09:22:22AM -0500, Peter Dufault wrote:
> > I'll throw it in there tomorrow.
> > 
> > -Matt
> > 
> 
> We ought to add a standard way of running the tests expected to pass,
> maybe a script in the subdirs "./regress pass" that runs the tests
> expected to pass and exits 0 if they do.

Take a look at what NetBSD and OpenBSD do; they have a somewhat more
advanced regression testing system than we do (including regression
tests for lots of userland bugs which apparently still exist on
FreeBSD).

Kris



msg30385/pgp0.pgp
Description: PGP signature