Git Product home page Git Product logo

Comments (6)

Thermi avatar Thermi commented on June 4, 2024

Unless you're using libipsec, all data traffic is processed by the kernel, so instrumenting strongSwan won't help you at all.
You can get packet dumps as shown here, and then once the packets are in Netfilter, you can use the TRACE target in *raw (iptables) or use nftables meta nftrace to get information in the kernel log regarding the processing of the packets within your rule set.

Regarding 3), it happens the other way around,. The kernel steals away all non-IKE (in that case with the NONESP-Marker in the beginning instead of the SPI) before they could be passed to the socket.

I suspect it's just either your iptables/nftables rule set or a misconfiguration of the TS. If you'd share the information as listed in #196, I could tell you more.

from strongswan.

qianguozheng avatar qianguozheng commented on June 4, 2024

Thanks @Thermi , my router is using lantiq hardware acceleration module for ipsec, I'm afraid it is different from the iptables/nftables, because the firewall using OpenRG jungo firewalls.
I traced the code the xfrm part, but still don't know which part is wrong,
some log is as below: xfrm4_transport_input(61): udp sport=32529, dport=152, src=17.148.17.148, dst=0.188.0.0 this line looks the address is wrong. May this is the problem ?

Jan  1 00:03:00 kern.warning [S=2027] kernel:  [  273.724000] Richard - __udp4_lib_rcv(1702): udp sport=4500, dport=4500, src=10.50.50.54, dst=10.50.50.50
Jan  1 00:03:00 kern.warning [S=2028] kernel:  [  273.724000] Richard - udp_queue_rcv_skb(1494) encap_rcv
Jan  1 00:03:00 kern.warning [S=2029] kernel:  [  273.724000] Richard - xfrm4_udp_encap_rcv(81)
Jan  1 00:03:00 kern.warning [S=2030] kernel:  [  273.724000] Richard - xfrm4_udp_encap_rcv(150)
Jan  1 00:03:00 kern.warning [S=2031] kernel:  [  273.724000] Richard - xfrm4_rcv_encap(44)
Jan  1 00:03:00 kern.warning [S=2032] kernel:  [  273.724000] Richard - xfrm_input(107) encap_type=2, spi=0, nexthdr=50
Jan  1 00:03:00 kern.warning [S=2033] kernel:  [  273.724000] Richard - xfrm_input(150)  spi=c2b263ac
Jan  1 00:03:00 kern.warning [S=2034] kernel:  [  273.724000] Richard - xfrm_input(157) family=2, spi=c2b263ac, nexthdr=50, daddr=104.199.233.28
Jan  1 00:03:00 kern.warning [S=2035] kernel:  [  273.724000] Richard - xfrm_input(198) nexthdr=-150
Jan  1 00:03:00 kern.warning [S=2036] kernel:  [  273.724000] Richard - xfrm_input(200) return 0
Jan  1 00:03:00 kern.warning [S=2037] kernel:  [  273.724000] Richard - udp_queue_rcv_skb(1497)  ret=0
Jan  1 00:03:00 kern.warning [S=2038] kernel:  [  273.724000] Richard - xfrm_input(107) encap_type=-1, spi=0, nexthdr=17
Jan  1 00:03:00 kern.warning [S=2039] kernel:  [  273.724000] Richard - xfrm4_transport_input(45) 
Jan  1 00:03:00 kern.warning [S=2040] kernel:  [  273.724000] Richard - xfrm4_transport_input(61): udp sport=32529, dport=152, src=17.148.17.148, dst=0.188.0.0
Jan  1 00:03:00 kern.warning [S=2041] kernel:  [  273.724000] Richard - xfrm4_transport_finish(53)

from strongswan.

qianguozheng avatar qianguozheng commented on June 4, 2024

code of function xfrm4_transport_input.

static int xfrm4_transport_input(struct xfrm_state *x, struct sk_buff *skb)
{
	printk("Richard - %s(%d) \n", __FUNCTION__, __LINE__);
	int ihl = skb->data - skb_transport_header(skb);

	if (skb->transport_header != skb->network_header) {
		memmove(skb_transport_header(skb),
			skb_network_header(skb), ihl);
		skb->network_header = skb->transport_header;
	}
	ip_hdr(skb)->tot_len = htons(skb->len + ihl);
	
	__be32 saddr, daddr;
	saddr = ip_hdr(skb)->saddr;
	daddr = ip_hdr(skb)->daddr;
	struct udphdr *uh;
	uh   = udp_hdr(skb);
	
	printk("Richard - %s(%d): udp sport=%d, dport=%d, src=%pI4, dst=%pI4\n", __FUNCTION__, __LINE__, uh->source, uh->dest, &saddr, &daddr);
	
	skb_reset_transport_header(skb);
	return 0;
}

from strongswan.

Thermi avatar Thermi commented on June 4, 2024

It'd make no sense for the IPsec acceleration to be usable for delivering skbs to sockets, but not be able to integrate it into Netfilter.
So the debugging options are still available for you.

Take a look at /proc/net/xfrm_stat. If that pseudofile is available, you can see decryption failures and other error counters.

from strongswan.

Thermi avatar Thermi commented on June 4, 2024

Did you figure it out?

from strongswan.

qianguozheng avatar qianguozheng commented on June 4, 2024

Did you figure it out?

Yes, it's the sdk's problem

from strongswan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.