On Wed, Aug 06, 2014 at 05:32:48AM -0700, [email protected] wrote:
> Signed-off-by: John Johansen <[email protected]>

Looks good in itself, but I noticed that the network_families array is
missing values 0, 12, 27, and 28 when built on my trusty laptop. So, uh, is
'return i' and 'return network_families[af]' correct in face of holes?

Thanks

> ---
>  parser/network.c |   19 +++++++++++++++++++
>  parser/network.h |    5 +++++
>  2 files changed, 24 insertions(+)
> 
> --- 2.9-test.orig/parser/network.c
> +++ 2.9-test/parser/network.c
> @@ -305,6 +305,25 @@
>  #include "af_names.h"
>  };
>  
> +int net_find_af_val(const char *af)
> +{
> +     int i;
> +     for (i = 0; network_families[i]; i++) {
> +             if (strcmp(network_families[i], af) == 0)
> +                     return i;
> +     }
> +
> +     return -1;
> +}
> +
> +const char *net_find_af_name(unsigned int af)
> +{
> +     if (af < 0 || af > get_af_max())
> +             return NULL;
> +
> +     return network_families[af];
> +}
> +
>  void __debug_network(unsigned int *array, const char *name)
>  {
>       unsigned int count = sizeof(sock_types)/sizeof(sock_types[0]);
> --- 2.9-test.orig/parser/network.h
> +++ 2.9-test/parser/network.h
> @@ -77,5 +77,10 @@
>  
>  int net_find_type_val(const char *type);
>  const char *net_find_type_name(int type);
> +int net_find_af_val(const char *af);
> +const char *net_find_af_name(unsigned int af);
> +const struct network_tuple *net_find_mapping(const char *family,
> +                                          const char *type,
> +                                          const char *protocol);
>  
>  #endif /* __AA_NETWORK_H */
> 
> 
> -- 
> AppArmor mailing list
> [email protected]
> Modify settings or unsubscribe at: 
> https://lists.ubuntu.com/mailman/listinfo/apparmor
> 

Attachment: signature.asc
Description: Digital signature

-- 
AppArmor mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/apparmor

Reply via email to