[IPV4]: Always pass ip_options pointer into ip_options_compile.

This makes code a bit more uniform and straigthforward.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Denis V. Lunev
2008-03-22 16:36:20 -07:00
committed by David S. Miller
parent ef722495c8
commit 22aba383ce
2 changed files with 9 additions and 11 deletions

View File

@@ -283,13 +283,14 @@ static inline int ip_rcv_options(struct sk_buff *skb)
} }
iph = ip_hdr(skb); iph = ip_hdr(skb);
opt = &(IPCB(skb)->opt);
opt->optlen = iph->ihl*4 - sizeof(struct iphdr);
if (ip_options_compile(NULL, skb)) { if (ip_options_compile(opt, skb)) {
IP_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS); IP_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS);
goto drop; goto drop;
} }
opt = &(IPCB(skb)->opt);
if (unlikely(opt->srr)) { if (unlikely(opt->srr)) {
struct in_device *in_dev = in_dev_get(dev); struct in_device *in_dev = in_dev_get(dev);
if (in_dev) { if (in_dev) {

View File

@@ -255,17 +255,14 @@ int ip_options_compile(struct ip_options * opt, struct sk_buff * skb)
unsigned char * optptr; unsigned char * optptr;
int optlen; int optlen;
unsigned char * pp_ptr = NULL; unsigned char * pp_ptr = NULL;
struct rtable *rt = skb ? skb->rtable : NULL; struct rtable *rt = NULL;
if (!opt) { if (skb != NULL) {
opt = &(IPCB(skb)->opt); rt = skb->rtable;
iph = skb_network_header(skb); optptr = (unsigned char *)&(ip_hdr(skb)[1]);
opt->optlen = ((struct iphdr *)iph)->ihl*4 - sizeof(struct iphdr); } else
optptr = iph + sizeof(struct iphdr);
} else {
optptr = opt->__data; optptr = opt->__data;
iph = optptr - sizeof(struct iphdr); iph = optptr - sizeof(struct iphdr);
}
for (l = opt->optlen; l > 0; ) { for (l = opt->optlen; l > 0; ) {
switch (*optptr) { switch (*optptr) {