int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) {
struct udp_sock *up = udp_sk(sk);
int rc;
int is_udplite = IS_UDPLITE(sk);
/*
* Charge it to the socket, dropping if the queue is full.
*/
if (!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb))
goto drop;
nf_reset(skb);
我正在阅读Linux net / ipv4 / udp.c中的代码。任何人都可以向我解释为什么UDP数据包需要通过xfrm_policy_check()运行?
据我所知,函数返回:
我可能误解了函数返回值,因为不完全理解源代码。
答案 0 :(得分:0)
xfrm4_policy_check
函数根据IPsec策略检查数据包。如果允许处理数据包,则此函数的返回值为1;如果不允许,则返回零。例如,如果skb->ip_summed
未设置为CHECKSUM_UNNECESSASRY
且数据包未通过校验和,则IPsec可能决定丢弃数据包。