Skip to contentSkip to conversation

MAC address update

DISCUSSION Sarbeswar Mohapatra 2 participants 3 messages May 16, 2007 – May 22, 2007 netfilter

lore
Share & tools
lore
#0 lore raw

Hi,
I am using netfilter hook (NF_POST_ROUTING) to create IP tunnel. In the nf hook function, the skb is expanded and added a new IP header (IP tunnel). When I see the packet in ethereal it does not update the MAC address according to the new IP header, rather the MAC address is the one for the original ip header (I am talking about the destination only, the source MAC header is the same as both src ip addresses belong to the local machine). Also for testing purpose, I tried to modify the destination ip address instead of adding a new IP header, it still has the old MAC address. What I understood was after the hook the skb should go to ip_finish_output2 and it should call use the ARP module to update the MAC address. Please send me your suggestion, if I am missing anything.

Regards,
Sarbeswar

Sarbeswar Mohapatra
NetHawk Corp
3400 Waterview Pkwy
Suite 100
Richardson, TX - 75080

Email: [email protected]
Tel:   +1 972 761 9271 Ext. 299
CELL:  +1 214 682 5645
FAX:   +1 972 761 9067 
#1 lore raw

ons 2007-05-16 klockan 16:18 -0500 skrev Sarbeswar Mohapatra:

Quoted 3 lines

Hi,
I am using netfilter hook (NF_POST_ROUTING) to create IP tunnel. In the nf hook function, the skb is expanded and added a new IP header (IP tunnel).

Hmm.. shouldn't this be done before routing?

After routing the kernel has already decided which next-hop the packet should be sent to. If you change this after the routing is done you need to re-route the packet, the kernel won't notice otherwise.

Regards
Henrik

#2 lore raw

Hi Henrik,
Thanks for your response. I already figured that out before leaving the nf hook function, I had to update the routing and got it working.

Regards,
Sarbeswar

Sarbeswar Mohapatra
NetHawk Corp
3400 Waterview Pkwy
Suite 100
Richardson, TX - 75080

Email: [email protected]
Tel:   +1 972 761 9271 Ext. 299
CELL:  +1 214 682 5645
FAX:   +1 972 761 9067 

-----Original Message-----
From: Henrik Nordstrom [mailto:[email protected]]
Sent: Monday, May 21, 2007 5:10 PM
To: Sarbeswar Mohapatra
Cc: [email protected]
Subject: Re: MAC address update

ons 2007-05-16 klockan 16:18 -0500 skrev Sarbeswar Mohapatra:

Quoted 3 lines

Hi,
I am using netfilter hook (NF_POST_ROUTING) to create IP tunnel. In the nf hook function, the skb is expanded and added a new IP header (IP

tunnel).

Hmm.. shouldn't this be done before routing?

After routing the kernel has already decided which next-hop the packet should be sent to. If you change this after the routing is done you need to re-route the packet, the kernel won't notice otherwise.

Regards
Henrik