Re: Question about IPIP tunnel

From: Park, Hyun Seo (hspark@ce.cnu.ac.kr)
Date: Fri Sep 22 2000 - 04:54:19 EST


Hello, again...
I solved it .... Thanks anyway...
----- Original Message -----
From: "Park, Hyun Seo" <hspark@ce.cnu.ac.kr>
To: <linux-net@vger.kernel.org>
Sent: Friday, September 22, 2000 2:06 PM
Subject: Question about IPIP tunnel

> Hello All,
> I am a student in Korea ...
> I have a question about IPIP tunnel with using new_tunnel module....
> I want to extract outer source address, outer dest address,
> inner source address and inner dest address each....
> I looked a tunneled packet using "SOCK_PACKET" ...
> I tried to extract them from that packet ...
> I can get outer source and destination address from it ...
> But
> when I try to get inner source and destination address from it,
> my program is terminated with "Segmentation Fault"...
>
> Source code in my program
> ===============================================================
> boolean isTunneledPkt(struct strbuf *data, u32 *outsrc, u32 *outdst,
> u32 *insrc, u32 *indst)
> {
> int ip_hdr_len, i;
> u32 ip_outsrc, ip_outdst, ip_insrc, ip_indst;
>
> if ((data->len < 54) || (data->buf[23] != IPPROTO_IPIP) ||
> (data->buf[12] != 8) || (data->buf[13] != 0)) {
> return(FALSE);
> }
>
> mip3dbg(("Tunneled_Packet._%d\n", (unsigned char)data->buf[23]));
> /* Outer IP header */
> ip_outsrc = 0;
> for (i = 26; i < 30; i++)
> ip_outsrc = (ip_outsrc << 8) | (0xff & data->buf[i]);
> *outsrc = htonl(ip_outsrc);
>
> ip_outdst = 0;
> for (i = 30; i < 34; i++)
> ip_outdst = (ip_outdst << 8) | (0xff & data->buf[i]);
> *outdst = htonl(ip_outdst);
>
> /* Inner IP header */
> ip_insrc = 0;
> for (i = 46; i < 50; i++)
> ip_insrc = (ip_insrc << 8) | (0xff & data->buf[i]);
> *insrc = htonl(ip_insrc);
>
> ip_indst = 0;
> for (i = 50; i < 54; i++)
> ip_indst = (ip_indst << 8) | (0xff & data->buf[i]);
> *indst = htonl(ip_indst);
>
> return(TRUE);
> }
>
> data contains a packet with Ethernet Header ....
>
> Any comments will be appreciated ...
> Thanks in advance ...
>
>
>
>
> Nryvnnz?
:.˛mkabzwmb˛mb{ayʇڙ,jfhz_



This archive was generated by hypermail 2b29 : Sat Sep 23 2000 - 21:00:32 EST