Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 85650
b: refs/heads/master
c: 56628b1
h: refs/heads/master
v: v3
  • Loading branch information
Pavel Emelyanov authored and David S. Miller committed Feb 13, 2008
1 parent 27b4a78 commit d29fbcd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 94de7feb2dee6d0039ecbe98ae8b63bbb63808b6
refs/heads/master: 56628b1d8964eb7ac924154d60b5d874bfb2b1e8
28 changes: 18 additions & 10 deletions trunk/net/netlabel/netlabel_unlabeled.c
Original file line number Diff line number Diff line change
Expand Up @@ -617,8 +617,6 @@ static int netlbl_unlhsh_add(struct net *net,
int ifindex;
struct net_device *dev;
struct netlbl_unlhsh_iface *iface;
struct in_addr *addr4, *mask4;
struct in6_addr *addr6, *mask6;
struct audit_buffer *audit_buf = NULL;
char *secctx = NULL;
u32 secctx_len;
Expand Down Expand Up @@ -651,7 +649,9 @@ static int netlbl_unlhsh_add(struct net *net,
audit_buf = netlbl_audit_start_common(AUDIT_MAC_UNLBL_STCADD,
audit_info);
switch (addr_len) {
case sizeof(struct in_addr):
case sizeof(struct in_addr): {
struct in_addr *addr4, *mask4;

addr4 = (struct in_addr *)addr;
mask4 = (struct in_addr *)mask;
ret_val = netlbl_unlhsh_add_addr4(iface, addr4, mask4, secid);
Expand All @@ -661,8 +661,11 @@ static int netlbl_unlhsh_add(struct net *net,
addr4->s_addr,
mask4->s_addr);
break;
}
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
case sizeof(struct in6_addr):
case sizeof(struct in6_addr): {
struct in6_addr *addr6, *mask6;

addr6 = (struct in6_addr *)addr;
mask6 = (struct in6_addr *)mask;
ret_val = netlbl_unlhsh_add_addr6(iface, addr6, mask6, secid);
Expand All @@ -671,6 +674,7 @@ static int netlbl_unlhsh_add(struct net *net,
dev_name,
addr6, mask6);
break;
}
#endif /* IPv6 */
default:
ret_val = -EINVAL;
Expand Down Expand Up @@ -1741,32 +1745,36 @@ int netlbl_unlabel_getattr(const struct sk_buff *skb,
u16 family,
struct netlbl_lsm_secattr *secattr)
{
struct iphdr *hdr4;
struct ipv6hdr *hdr6;
struct netlbl_unlhsh_addr4 *addr4;
struct netlbl_unlhsh_addr6 *addr6;
struct netlbl_unlhsh_iface *iface;

rcu_read_lock();
iface = netlbl_unlhsh_search_iface_def(skb->iif);
if (iface == NULL)
goto unlabel_getattr_nolabel;
switch (family) {
case PF_INET:
case PF_INET: {
struct iphdr *hdr4;
struct netlbl_unlhsh_addr4 *addr4;

hdr4 = ip_hdr(skb);
addr4 = netlbl_unlhsh_search_addr4(hdr4->saddr, iface);
if (addr4 == NULL)
goto unlabel_getattr_nolabel;
secattr->attr.secid = addr4->secid;
break;
}
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
case PF_INET6:
case PF_INET6: {
struct ipv6hdr *hdr6;
struct netlbl_unlhsh_addr6 *addr6;

hdr6 = ipv6_hdr(skb);
addr6 = netlbl_unlhsh_search_addr6(&hdr6->saddr, iface);
if (addr6 == NULL)
goto unlabel_getattr_nolabel;
secattr->attr.secid = addr6->secid;
break;
}
#endif /* IPv6 */
default:
goto unlabel_getattr_nolabel;
Expand Down

0 comments on commit d29fbcd

Please sign in to comment.