Re: syslogd and -a

2001-07-02 Thread Hajimu UMEMOTO

> On Mon, 2 Jul 2001 12:25:42 -0700
> Kris Kennaway <[EMAIL PROTECTED]> said:

kris> This doesn't seem to work with IPv6.  Isn't there a libc function
kris> which can be used to do this?

Yup, there is no api for masking address ether libc nor standard.
I'll commit the following patch for IPv6:

Index: usr.sbin/syslogd/syslogd.c
===
RCS file: /home/ncvs/src/usr.sbin/syslogd/syslogd.c,v
retrieving revision 1.79
diff -u -r1.79 syslogd.c
--- usr.sbin/syslogd/syslogd.c  2001/07/02 15:26:47 1.79
+++ usr.sbin/syslogd/syslogd.c  2001/07/02 19:39:32
@@ -2033,7 +2033,7 @@
reject = 0;
for (j = 0; j < 16; j += 4) {
if ((*(u_int32_t *)&sin6->sin6_addr.s6_addr[i] 
& *(u_int32_t *)&m6p->sin6_addr.s6_addr[i])
-   != *(u_int32_t 
*)&a6p->sin6_addr.s6_addr[i]) {
+   != (*(u_int32_t 
+*)&a6p->sin6_addr.s6_addr[i] & *(u_int32_t *)&m6p->sin6_addr.s6_addr[i])) {
++reject;
break;
}

--
Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan
[EMAIL PROTECTED]  [EMAIL PROTECTED]  ume@{,jp.}FreeBSD.org
http://www.imasy.org/~ume/

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



Re: syslogd and -a

2001-07-02 Thread Kris Kennaway

On Mon, Jul 02, 2001 at 09:38:42AM +0100, David Malone wrote:
> On Sun, Jul 01, 2001 at 09:20:44PM -0700, Crist J. Clark wrote:
> > Hmmm... Looks like,
> > 
> >   # syslogd -a 192.168.1.0/29
> > 
> > Will work and,
> > 
> >   # syslogd -a 192.168.1.1/29
> > 
> > Won't.
> 
> That's the standard behaviour of a netmask, isn't it? The usual
> way to check if host h is in network/netmask n/m is to check if:
> 
>   (h & m == n)
> 
> this means that the bits of the network which are not in the mask
> must be zero.

This doesn't seem to work with IPv6.  Isn't there a libc function
which can be used to do this?

Kris

 PGP signature


Re: syslogd and -a

2001-07-02 Thread Hajimu UMEMOTO

> On Mon, 2 Jul 2001 08:25:38 -0700
> "Crist J. Clark" <[EMAIL PROTECTED]> said:

cristjc> That's exactly what happens in the syslogd(8) code. However, I think
cristjc> that should be,

cristjc>   n &= m
cristjc>   .
cristjc>   .
cristjc>   .
cristjc>   ((h & m) == n)

I think it should be:

  ((h & m) == (n & m))

cristjc> That is, why allow the user to enter a network number that is not
cristjc> /really/ the network number? Either flag an error or do the
cristjc> calculation for the user. I think doing the calculation is the more
cristjc> sensible choice. Commiting it to CURRENT now.

When I committed IPv6 support to syslogd, I didn't mask address to
keep compatibility with IPv4.  So, I'll commit to IPv6 side, later.

--
Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan
[EMAIL PROTECTED]  [EMAIL PROTECTED]  ume@{,jp.}FreeBSD.org
http://www.imasy.org/~ume/

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



Re: syslogd and -a

2001-07-02 Thread David Hill

On Mon, 2 Jul 2001 09:38:42 +0100
David Malone <[EMAIL PROTECTED]> wrote:

> On Sun, Jul 01, 2001 at 09:20:44PM -0700, Crist J. Clark wrote:
> > Hmmm... Looks like,
> > 
> >   # syslogd -a 192.168.1.0/29
> > 
> > Will work and,
> > 
> >   # syslogd -a 192.168.1.1/29
> > 
> > Won't.
> 
> That's the standard behaviour of a netmask, isn't it? The usual
> way to check if host h is in network/netmask n/m is to check if:
> 
>   (h & m == n)
> 
> this means that the bits of the network which are not in the mask
> must be zero.
> 
>   David.
> 

Ok, changing the .1 to .0 worked for me.  The last octect must be the network number.

Thanks
- David

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



Re: syslogd and -a

2001-07-02 Thread Crist J. Clark

On Mon, Jul 02, 2001 at 09:38:42AM +0100, David Malone wrote:
> On Sun, Jul 01, 2001 at 09:20:44PM -0700, Crist J. Clark wrote:
> > Hmmm... Looks like,
> > 
> >   # syslogd -a 192.168.1.0/29
> > 
> > Will work and,
> > 
> >   # syslogd -a 192.168.1.1/29
> > 
> > Won't.
> 
> That's the standard behaviour of a netmask, isn't it? The usual
> way to check if host h is in network/netmask n/m is to check if:
> 
>   (h & m == n)
> 
> this means that the bits of the network which are not in the mask
> must be zero.

That's exactly what happens in the syslogd(8) code. However, I think
that should be,

  n &= m
  .
  .
  .
  ((h & m) == n)

That is, why allow the user to enter a network number that is not
/really/ the network number? Either flag an error or do the
calculation for the user. I think doing the calculation is the more
sensible choice. Commiting it to CURRENT now.
-- 
Crist J. Clark   [EMAIL PROTECTED]

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



Re: syslogd and -a

2001-07-02 Thread David Malone

On Sun, Jul 01, 2001 at 09:20:44PM -0700, Crist J. Clark wrote:
> Hmmm... Looks like,
> 
>   # syslogd -a 192.168.1.0/29
> 
> Will work and,
> 
>   # syslogd -a 192.168.1.1/29
> 
> Won't.

That's the standard behaviour of a netmask, isn't it? The usual
way to check if host h is in network/netmask n/m is to check if:

(h & m == n)

this means that the bits of the network which are not in the mask
must be zero.

David.

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



Re: syslogd and -a

2001-07-01 Thread Riccardo Torrini

On 02-Jul-01 (04:20:44/GMT) Crist J. Clark wrote:

>> It seems the -a option for syslogd does not work 100%.

> Hmmm... Looks like,
>   # syslogd -a 192.168.1.0/29
> Will work and,
>   # syslogd -a 192.168.1.1/29
> Won't.

Under 4.3-STABLE is the same.  To capure log from router I
added (in rc.conf) -a 192.168.22.254/32:* because with all
log enabled I notice that with ..22.0/24 syslod refused to
accept requests from network  :-(


Ciao,
Riccardo.

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



Re: syslogd and -a

2001-07-01 Thread Crist J. Clark

On Sun, Jul 01, 2001 at 11:41:25PM -0400, David Hill wrote:
> Hello -
> 
> It seems the -a option for syslogd does not work 100%.
> I need to log from hosts from 192.168.1.1-.6
> 
> doing "/usr/sbin/syslogd -a 192.168.1.1/29" does not work (nothing gets logged)
> 
> but, if i do
> 
> /usr/sbin/syslogd -a 192.168.1.1/32 -a 192.168.1.2/32, etc... that works
> 
> can anyone try this out?

Hmmm... Looks like,

  # syslogd -a 192.168.1.0/29

Will work and,

  # syslogd -a 192.168.1.1/29

Won't.

I'll have a look.
-- 
Crist J. Clark   [EMAIL PROTECTED]

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



syslogd and -a

2001-07-01 Thread David Hill

Hello -

It seems the -a option for syslogd does not work 100%.
I need to log from hosts from 192.168.1.1-.6

doing "/usr/sbin/syslogd -a 192.168.1.1/29" does not work (nothing gets logged)

but, if i do

/usr/sbin/syslogd -a 192.168.1.1/32 -a 192.168.1.2/32, etc... that works

can anyone try this out?

Thanks
- David


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