mip6.c (f94f3cb37a1c4d44dd2070cc4a6165689bda9c92) mip6.c (b71d1d426d263b0b6cb5760322efebbfc89d4463)
1/*
2 * Copyright (C)2003-2006 Helsinki University of Technology
3 * Copyright (C)2003-2006 USAGI/WIDE Project
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.

--- 112 unchanged lines hidden (view full) ---

121};
122
123static struct mip6_report_rate_limiter mip6_report_rl = {
124 .lock = __SPIN_LOCK_UNLOCKED(mip6_report_rl.lock)
125};
126
127static int mip6_destopt_input(struct xfrm_state *x, struct sk_buff *skb)
128{
1/*
2 * Copyright (C)2003-2006 Helsinki University of Technology
3 * Copyright (C)2003-2006 USAGI/WIDE Project
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.

--- 112 unchanged lines hidden (view full) ---

121};
122
123static struct mip6_report_rate_limiter mip6_report_rl = {
124 .lock = __SPIN_LOCK_UNLOCKED(mip6_report_rl.lock)
125};
126
127static int mip6_destopt_input(struct xfrm_state *x, struct sk_buff *skb)
128{
129 struct ipv6hdr *iph = ipv6_hdr(skb);
129 const struct ipv6hdr *iph = ipv6_hdr(skb);
130 struct ipv6_destopt_hdr *destopt = (struct ipv6_destopt_hdr *)skb->data;
131 int err = destopt->nexthdr;
132
133 spin_lock(&x->lock);
134 if (!ipv6_addr_equal(&iph->saddr, (struct in6_addr *)x->coaddr) &&
135 !ipv6_addr_any((struct in6_addr *)x->coaddr))
136 err = -ENOENT;
137 spin_unlock(&x->lock);

--- 38 unchanged lines hidden (view full) ---

176
177 WARN_ON(len != x->props.header_len);
178 dstopt->hdrlen = (x->props.header_len >> 3) - 1;
179
180 return 0;
181}
182
183static inline int mip6_report_rl_allow(struct timeval *stamp,
130 struct ipv6_destopt_hdr *destopt = (struct ipv6_destopt_hdr *)skb->data;
131 int err = destopt->nexthdr;
132
133 spin_lock(&x->lock);
134 if (!ipv6_addr_equal(&iph->saddr, (struct in6_addr *)x->coaddr) &&
135 !ipv6_addr_any((struct in6_addr *)x->coaddr))
136 err = -ENOENT;
137 spin_unlock(&x->lock);

--- 38 unchanged lines hidden (view full) ---

176
177 WARN_ON(len != x->props.header_len);
178 dstopt->hdrlen = (x->props.header_len >> 3) - 1;
179
180 return 0;
181}
182
183static inline int mip6_report_rl_allow(struct timeval *stamp,
184 struct in6_addr *dst,
185 struct in6_addr *src, int iif)
184 const struct in6_addr *dst,
185 const struct in6_addr *src, int iif)
186{
187 int allow = 0;
188
189 spin_lock_bh(&mip6_report_rl.lock);
190 if (mip6_report_rl.stamp.tv_sec != stamp->tv_sec ||
191 mip6_report_rl.stamp.tv_usec != stamp->tv_usec ||
192 mip6_report_rl.iif != iif ||
193 !ipv6_addr_equal(&mip6_report_rl.src, src) ||

--- 150 unchanged lines hidden (view full) ---

344 .input = mip6_destopt_input,
345 .output = mip6_destopt_output,
346 .reject = mip6_destopt_reject,
347 .hdr_offset = mip6_destopt_offset,
348};
349
350static int mip6_rthdr_input(struct xfrm_state *x, struct sk_buff *skb)
351{
186{
187 int allow = 0;
188
189 spin_lock_bh(&mip6_report_rl.lock);
190 if (mip6_report_rl.stamp.tv_sec != stamp->tv_sec ||
191 mip6_report_rl.stamp.tv_usec != stamp->tv_usec ||
192 mip6_report_rl.iif != iif ||
193 !ipv6_addr_equal(&mip6_report_rl.src, src) ||

--- 150 unchanged lines hidden (view full) ---

344 .input = mip6_destopt_input,
345 .output = mip6_destopt_output,
346 .reject = mip6_destopt_reject,
347 .hdr_offset = mip6_destopt_offset,
348};
349
350static int mip6_rthdr_input(struct xfrm_state *x, struct sk_buff *skb)
351{
352 struct ipv6hdr *iph = ipv6_hdr(skb);
352 const struct ipv6hdr *iph = ipv6_hdr(skb);
353 struct rt2_hdr *rt2 = (struct rt2_hdr *)skb->data;
354 int err = rt2->rt_hdr.nexthdr;
355
356 spin_lock(&x->lock);
357 if (!ipv6_addr_equal(&iph->daddr, (struct in6_addr *)x->coaddr) &&
358 !ipv6_addr_any((struct in6_addr *)x->coaddr))
359 err = -ENOENT;
360 spin_unlock(&x->lock);

--- 165 unchanged lines hidden ---
353 struct rt2_hdr *rt2 = (struct rt2_hdr *)skb->data;
354 int err = rt2->rt_hdr.nexthdr;
355
356 spin_lock(&x->lock);
357 if (!ipv6_addr_equal(&iph->daddr, (struct in6_addr *)x->coaddr) &&
358 !ipv6_addr_any((struct in6_addr *)x->coaddr))
359 err = -ENOENT;
360 spin_unlock(&x->lock);

--- 165 unchanged lines hidden ---