* Firewall bug in 2.0.27 kernel
@ 1997-04-10 0:41 Alvin Starr
0 siblings, 0 replies; 7+ messages in thread
From: Alvin Starr @ 1997-04-10 0:41 UTC (permalink / raw)
Just gotta love C for its ability to do address calculations
in "ip_fw.c" you will find
int ip_fw_chk(struct iphdr *ip, struct device *rif, __u16 *redirport,
struct ip_fw *chain, int policy, int mode)
{
struct ip_fw *f;
struct tcphdr *tcp=(struct tcphdr *)((unsigned long *)ip+ip->ihl);
struct udphdr *udp=(struct udphdr *)((unsigned long *)ip+ip->ihl);
struct icmphdr *icmp=(struct icmphdr *)((unsigned long *)ip+ip->ihl);
The problem is that the address calculation multiplies the ihl value by 8
due to the fact that it points to an "unsigned long". This calculation
should be infact
((char *)ip)+(ip->ihl<<2)
If somebody wants to tell me where to send the patch I will generate a
patch against 2.0.27 and e-mail it out.
Alvin Starr || voice: (416)493-3325
Interlink Connectivity || fax: (416)493-7974
alvin@iplink.net ||
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: Firewall bug in 2.0.27 kernel
@ 1997-04-10 14:24 Anderson, Greg
1997-04-10 15:43 ` Alvin Starr
0 siblings, 1 reply; 7+ messages in thread
From: Anderson, Greg @ 1997-04-10 14:24 UTC (permalink / raw)
>Alvin Starr wrote:
>
>Just gotta love C for its ability to do address calculations
>
>in "ip_fw.c" you will find
[snip]
>The problem is that the address calculation multiplies the ihl value by 8
>due to the fact that it points to an "unsigned long". This calculation
>should be infact
> ((char *)ip)+(ip->ihl<<2)
Is this only a problem on Alpha? What problems does this cause, bogus
filtering? I'm setting up firewalling on 2.0.27 Intel box and the code
is the same. Should I apply your patch to it?
Greg A.
- free yourself of paranoia, but trust no one -
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: Firewall bug in 2.0.27 kernel
@ 1997-04-10 14:24 Anderson, Greg
0 siblings, 0 replies; 7+ messages in thread
From: Anderson, Greg @ 1997-04-10 14:24 UTC (permalink / raw)
>Alvin Starr wrote:
>
>Just gotta love C for its ability to do address calculations
>
>in "ip_fw.c" you will find
[snip]
>The problem is that the address calculation multiplies the ihl value by 8
>due to the fact that it points to an "unsigned long". This calculation
>should be infact
> ((char *)ip)+(ip->ihl<<2)
Is this only a problem on Alpha? What problems does this cause, bogus
filtering? I'm setting up firewalling on 2.0.27 Intel box and the code
is the same. Should I apply your patch to it?
Greg A.
- free yourself of paranoia, but trust no one -
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: Firewall bug in 2.0.27 kernel
@ 1997-04-10 14:24 Anderson, Greg
0 siblings, 0 replies; 7+ messages in thread
From: Anderson, Greg @ 1997-04-10 14:24 UTC (permalink / raw)
>Alvin Starr wrote:
>
>Just gotta love C for its ability to do address calculations
>
>in "ip_fw.c" you will find
[snip]
>The problem is that the address calculation multiplies the ihl value by 8
>due to the fact that it points to an "unsigned long". This calculation
>should be infact
> ((char *)ip)+(ip->ihl<<2)
Is this only a problem on Alpha? What problems does this cause, bogus
filtering? I'm setting up firewalling on 2.0.27 Intel box and the code
is the same. Should I apply your patch to it?
Greg A.
- free yourself of paranoia, but trust no one -
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: Firewall bug in 2.0.27 kernel
1997-04-10 14:24 Firewall bug in 2.0.27 kernel Anderson, Greg
@ 1997-04-10 15:43 ` Alvin Starr
0 siblings, 0 replies; 7+ messages in thread
From: Alvin Starr @ 1997-04-10 15:43 UTC (permalink / raw)
On Thu, 10 Apr 1997, Anderson, Greg wrote:
> >Alvin Starr wrote:
> >
> >Just gotta love C for its ability to do address calculations
> >
> >in "ip_fw.c" you will find
>
> [snip]
>
> >The problem is that the address calculation multiplies the ihl value by 8
> >due to the fact that it points to an "unsigned long". This calculation
> >should be infact
> > ((char *)ip)+(ip->ihl<<2)
>
> Is this only a problem on Alpha? What problems does this cause, bogus
> filtering? I'm setting up firewalling on 2.0.27 Intel box and the code
> is the same. Should I apply your patch to it?
The problem will only show itself on systems where sizeof(long unsigned)
!= 4. You should be safe on an intel platform.
The problem is that the person who wrote the code took advantage of the
fact that a unsigned long was 4 bytes in size. This is not true on all
platforms.
Alvin Starr || voice: (416)493-3325
Interlink Connectivity || fax: (416)493-7974
alvin@iplink.net ||
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: Firewall bug in 2.0.27 kernel
[not found] <Pine.OSF.3.91.970410113452.29178C-100000@caesar.iplink.net>
@ 1997-04-10 16:30 ` Robert Drotar
0 siblings, 0 replies; 7+ messages in thread
From: Robert Drotar @ 1997-04-10 16:30 UTC (permalink / raw)
-----BEGIN PGP SIGNED MESSAGE-----
On Thu, 10 Apr 1997, Alvin Starr wrote:
> The problem will only show itself on systems where sizeof(long unsigned)
> != 4. You should be safe on an intel platform.
> The problem is that the person who wrote the code took advantage of the
> fact that a unsigned long was 4 bytes in size. This is not true on all
> platforms.
>
> Alvin Starr || voice: (416)493-3325
I have hed the same proble and here is the solution:
struct tcphdr *tcp=(struct tcphdr *)((__u32 *)ip+ip->ihl);
struct udphdr *udp=(struct udphdr *)((__u32 *)ip+ip->ihl);
struct icmphdr *icmp=(struct icmphdr *)((__u32 *)ip+ip->ihl);
This will work at x86 too :)
WhiteAngel
_.------------------------------.
.---------------.- Department of Computer Science |
| Robert Drotar | Charles University Prague __.-'
`---------------'-_ Czech Republic ____.-----'
`--------------'
mailto: Robert.Drotar@kamila.kolej.mff.cuni.cz
www: http://ss1000.ms.mff.cuni.cz/~rdro1314
voice: ++420-2-85 56 152 ext. 732
-----BEGIN PGP SIGNATURE-----
Version: 2.6.3i
Charset: noconv
iQCVAwUBM00VwBvajr1XDdg9AQGDxAP/e7CfXC+i/2Qpbf44YjPd0gLFqLYOLSo3
lf5Zkk1EFStAQX9CFXRSrOWFA+vcJqS7p+bzJmlEW3PN7P1k1G/jqb4mp0DiKnlV
17pT2zDQr7XZ/rGbSVoANH2dEqaT5BQlmBCOSHs6jfrQPtROah9ytjGWwf4zkrVV
1KXfQ2kJUAA=
=c+l7
-----END PGP SIGNATURE-----
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: Firewall bug in 2.0.27 kernel
@ 1997-04-10 18:31 Anderson, Greg
0 siblings, 0 replies; 7+ messages in thread
From: Anderson, Greg @ 1997-04-10 18:31 UTC (permalink / raw)
Thanks. I think I'll rebuild my Intel kernal with this when I get a
chance. I take it a u-long is 64 bits on an Alpha?
Robert Drotar wrote:
>On Thu, 10 Apr 1997, Alvin Starr wrote:
>
>> The problem will only show itself on systems where sizeof(long unsigned)
>> != 4. You should be safe on an intel platform.
>> The problem is that the person who wrote the code took advantage of the
>> fact that a unsigned long was 4 bytes in size. This is not true on all
>> platforms.
>>
>> Alvin Starr || voice: (416)493-3325
>
> I have hed the same proble and here is the solution:
> struct tcphdr *tcp=(struct tcphdr *)((__u32 *)ip+ip->ihl);
> struct udphdr *udp=(struct udphdr *)((__u32 *)ip+ip->ihl);
> struct icmphdr *icmp=(struct icmphdr *)((__u32 *)ip+ip->ihl);
>
> This will work at x86 too :)
>
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~1997-04-10 18:31 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-04-10 14:24 Firewall bug in 2.0.27 kernel Anderson, Greg
1997-04-10 15:43 ` Alvin Starr
-- strict thread matches above, loose matches on Subject: below --
1997-04-10 18:31 Anderson, Greg
[not found] <Pine.OSF.3.91.970410113452.29178C-100000@caesar.iplink.net>
1997-04-10 16:30 ` Robert Drotar
1997-04-10 14:24 Anderson, Greg
1997-04-10 14:24 Anderson, Greg
1997-04-10 0:41 Alvin Starr
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox