]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/ipv4/cipso_ipv4.c
[SK_BUFF]: Introduce ipv6_hdr(), remove skb->nh.ipv6h
[linux-2.6-omap-h63xx.git] / net / ipv4 / cipso_ipv4.c
index 60aafb4a8adff56c8fa3fd54d664fd76e2ee7177..11a3404d65af2eef33a9ebf216fd3bb25425d694 100644 (file)
@@ -732,11 +732,12 @@ static int cipso_v4_map_lvl_hton(const struct cipso_v4_doi *doi_def,
                *net_lvl = host_lvl;
                return 0;
        case CIPSO_V4_MAP_STD:
-               if (host_lvl < doi_def->map.std->lvl.local_size) {
+               if (host_lvl < doi_def->map.std->lvl.local_size &&
+                   doi_def->map.std->lvl.local[host_lvl] < CIPSO_V4_INV_LVL) {
                        *net_lvl = doi_def->map.std->lvl.local[host_lvl];
                        return 0;
                }
-               break;
+               return -EPERM;
        }
 
        return -EINVAL;
@@ -771,7 +772,7 @@ static int cipso_v4_map_lvl_ntoh(const struct cipso_v4_doi *doi_def,
                        *host_lvl = doi_def->map.std->lvl.cipso[net_lvl];
                        return 0;
                }
-               break;
+               return -EPERM;
        }
 
        return -EINVAL;
@@ -1173,7 +1174,7 @@ static int cipso_v4_map_cat_rng_ntoh(const struct cipso_v4_doi *doi_def,
        u16 cat_low;
        u16 cat_high;
 
-       for(net_iter = 0; net_iter < net_cat_len; net_iter += 4) {
+       for (net_iter = 0; net_iter < net_cat_len; net_iter += 4) {
                cat_high = ntohs(*((__be16 *)&net_cat[net_iter]));
                if ((net_iter + 4) <= net_cat_len)
                        cat_low = ntohs(*((__be16 *)&net_cat[net_iter + 2]));
@@ -1675,7 +1676,7 @@ validate_return:
  */
 void cipso_v4_error(struct sk_buff *skb, int error, u32 gateway)
 {
-       if (skb->nh.iph->protocol == IPPROTO_ICMP || error != -EACCES)
+       if (ip_hdr(skb)->protocol == IPPROTO_ICMP || error != -EACCES)
                return;
 
        if (gateway)
@@ -1932,6 +1933,11 @@ int cipso_v4_skbuff_getattr(const struct sk_buff *skb,
                                                 &cipso_ptr[6],
                                                 secattr);
                break;
+       case CIPSO_V4_TAG_RANGE:
+               ret_val = cipso_v4_parsetag_rng(doi_def,
+                                               &cipso_ptr[6],
+                                               secattr);
+               break;
        }
 
 skbuff_getattr_return: