Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-6-0]: src/sys/net Pull up following revision(s) (requested by kef...



details:   https://anonhg.NetBSD.org/src/rev/c3469db9881a
branches:  netbsd-6-0
changeset: 774836:c3469db9881a
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Tue Jul 30 03:07:50 2013 +0000

description:
Pull up following revision(s) (requested by kefren in ticket #921):
        sys/net/if_mpls.c: revision 1.9
stop abusing kmem during softint context to prevent panic

diffstat:

 sys/net/if_mpls.c |  29 ++++++++++-------------------
 1 files changed, 10 insertions(+), 19 deletions(-)

diffs (84 lines):

diff -r 42a25aeb7b98 -r c3469db9881a sys/net/if_mpls.c
--- a/sys/net/if_mpls.c Mon Jul 29 20:27:21 2013 +0000
+++ b/sys/net/if_mpls.c Tue Jul 30 03:07:50 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_mpls.c,v 1.8 2011/07/03 18:46:12 kefren Exp $ */
+/*     $NetBSD: if_mpls.c,v 1.8.14.1 2013/07/30 03:07:50 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_mpls.c,v 1.8 2011/07/03 18:46:12 kefren Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mpls.c,v 1.8.14.1 2013/07/30 03:07:50 msaitoh Exp $");
 
 #include "opt_inet.h"
 #include "opt_mpls.h"
@@ -38,7 +38,6 @@
 #include <sys/param.h>
 
 #include <sys/errno.h>
-#include <sys/kmem.h>
 #include <sys/malloc.h>
 #include <sys/mbuf.h>
 #include <sys/sysctl.h>
@@ -518,25 +517,21 @@
 static struct mbuf *
 mpls_label_inet(struct mbuf *m, union mpls_shim *ms, uint offset)
 {
-       struct ip *iphdr;
+       struct ip iphdr;
 
        if (mpls_mapttl_inet || mpls_mapprec_inet) {
                if ((m->m_len < sizeof(struct ip)) &&
                    (m = m_pullup(m, offset + sizeof(struct ip))) == 0)
                        return NULL; /* XXX */
-               iphdr = kmem_alloc(sizeof(struct ip), KM_NOSLEEP);
-               if (iphdr == NULL)
-                       return NULL;
-               m_copydata(m, offset, sizeof(struct ip), iphdr);
+               m_copydata(m, offset, sizeof(struct ip), &iphdr);
 
                /* Map TTL */
                if (mpls_mapttl_inet)
-                       ms->shim.ttl = iphdr->ip_ttl;
+                       ms->shim.ttl = iphdr.ip_ttl;
 
                /* Copy IP precedence to EXP */
                if (mpls_mapprec_inet)
-                       ms->shim.exp = ((u_int8_t)iphdr->ip_tos) >> 5;
-               kmem_free (iphdr, sizeof(struct ip));
+                       ms->shim.exp = ((u_int8_t)iphdr.ip_tos) >> 5;
        }
 
        if ((m = mpls_prepend_shim(m, ms)) == NULL)
@@ -592,23 +587,19 @@
 static struct mbuf *
 mpls_label_inet6(struct mbuf *m, union mpls_shim *ms, uint offset)
 {
-       struct ip6_hdr *ip6h;
+       struct ip6_hdr ip6h;
 
        if (mpls_mapttl_inet6 || mpls_mapclass_inet6) {
                if (m->m_len < sizeof(struct ip6_hdr) &&
                    (m = m_pullup(m, offset + sizeof(struct ip6_hdr))) == 0)
                        return NULL;
-               ip6h = kmem_alloc(sizeof(struct ip6_hdr), KM_NOSLEEP);
-               if (ip6h == NULL)
-                       return NULL;
-               m_copydata(m, offset, sizeof(struct ip6_hdr), ip6h);
+               m_copydata(m, offset, sizeof(struct ip6_hdr), &ip6h);
 
                if (mpls_mapttl_inet6)
-                       ms->shim.ttl = ip6h->ip6_hlim;
+                       ms->shim.ttl = ip6h.ip6_hlim;
 
                if (mpls_mapclass_inet6)
-                       ms->shim.exp = ip6h->ip6_vfc << 1 >> 5;
-               kmem_free(ip6h, sizeof(struct ip6_hdr));
+                       ms->shim.exp = ip6h.ip6_vfc << 1 >> 5;
        }
 
        if ((m = mpls_prepend_shim(m, ms)) == NULL)



Home | Main Index | Thread Index | Old Index