Index: sys/geom/geom_map.c =================================================================== --- sys/geom/geom_map.c +++ sys/geom/geom_map.c @@ -1,6 +1,5 @@ /*- * Copyright (c) 2010-2011 Aleksandr Rybalko - * based on geom_redboot.c * Copyright (c) 2009 Sam Leffler, Errno Consulting * All rights reserved. * @@ -34,11 +33,9 @@ #include #include -#include -#include + #include #include -#include #include #include #include @@ -51,6 +48,9 @@ #define MAP_CLASS_NAME "MAP" #define MAP_MAXSLICE 64 #define MAP_MAX_MARKER_LEN 64 +#define DPRINTF(...) if (bootverbose) { \ + printf("GEOM_MAP: " __VA_ARGS__); \ +} struct g_map_softc { off_t offset[MAP_MAXSLICE]; /* offset in flash */ @@ -119,8 +119,10 @@ g_slice_dumpconf(sb, indent, gp, cp, pp); if (pp != NULL) { if (indent == NULL) { - sbuf_printf(sb, " entry %jd", (intmax_t)sc->entry[pp->index]); - sbuf_printf(sb, " dsize %jd", (intmax_t)sc->dsize[pp->index]); + sbuf_printf(sb, " entry %jd", + (intmax_t)sc->entry[pp->index]); + sbuf_printf(sb, " dsize %jd", + (intmax_t)sc->dsize[pp->index]); } else { sbuf_printf(sb, "%s%jd\n", indent, (intmax_t)sc->entry[pp->index]); @@ -152,10 +154,9 @@ if (ret < 3) return (1); - if (bootverbose) { - printf("MAP: search %s for key \"%s\" from 0x%jx, step 0x%jx\n", - cp->geom->name, search_key, (intmax_t)search_start, (intmax_t)search_step); - } + DPRINTF("search %s for key \"%s\" from 0x%jx, step 0x%jx\n", + cp->geom->name, search_key, (intmax_t)search_start, + (intmax_t)search_step); /* error if search_key is empty */ if (strlen(search_key) < 1) @@ -219,8 +220,7 @@ * as "/dev/map/uboot" */ if (resource_string_value("map", i, "name", &name) != 0) { - if (bootverbose) - printf("MAP: hint.map.%d has no name\n", i); + DPRINTF("hint.map.%d has no name\n", i); return (1); } @@ -231,29 +231,21 @@ * until we found marker or end of media reached */ if (resource_string_value("map", i, "start", &value) != 0) { - if (bootverbose) - printf("MAP: \"%s\" has no start value\n", name); + DPRINTF("\"%s\" has no start value\n", name); return (1); } if (find_marker(cp, value, &start) != 0) { - if (bootverbose) { - printf("MAP: \"%s\" can't parse/use start value\n", - name); - } + DPRINTF("\"%s\" can't parse/use start value\n", name); return (1); } /* like "start" */ if (resource_string_value("map", i, "end", &value) != 0) { - if (bootverbose) - printf("MAP: \"%s\" has no end value\n", name); + DPRINTF("\"%s\" has no end value\n", name); return (1); } if (find_marker(cp, value, &end) != 0) { - if (bootverbose) { - printf("MAP: \"%s\" can't parse/use start value\n", - name); - } + DPRINTF("\"%s\" can't parse/use start value\n", name); return (1); } @@ -265,10 +257,7 @@ if (resource_string_value("map", i, "offset", &value) == 0) { offset = strtouq(value, &op, 0); if (*op != '\0') { - if (bootverbose) { - printf("MAP: \"%s\" can't parse offset\n", - name); - } + DPRINTF("\"%s\" can't parse offset\n", name); return (1); } } else { @@ -279,10 +268,7 @@ if (resource_string_value("map", i, "dsize", &value) == 0) { dsize = strtouq(value, &op, 0); if (*op != '\0') { - if (bootverbose) { - printf("MAP: \"%s\" can't parse dsize\n", - name); - } + DPRINTF("\"%s\" can't parse dsize\n", name); return (1); } } else { @@ -295,37 +281,26 @@ /* end is 0 or size is 0, No MAP - so next */ if (end < start) { - if (bootverbose) { - printf("MAP: \"%s\", \"end\" less than " - "\"start\"\n", name); - } + DPRINTF("\"%s\", \"end\" less than \"start\"\n", name); return (1); } if (offset + dsize > size) { - if (bootverbose) { - printf("MAP: \"%s\", \"dsize\" bigger than " - "partition - offset\n", name); - } + DPRINTF("\"%s\", \"dsize\" bigger than partition - offset\n", + name); return (1); } ret = g_slice_config(gp, i, G_SLICE_CONFIG_SET, start + offset, dsize, cp->provider->sectorsize, "map/%s", name); if (ret != 0) { - if (bootverbose) { - printf("MAP: g_slice_config returns %d for \"%s\"\n", - ret, name); - } + DPRINTF("g_slice_config returns %d for \"%s\"\n", ret, name); return (1); } - if (bootverbose) { - printf("MAP: %s: %jxx%jx, data=%jxx%jx " - "\"/dev/map/%s\"\n", - cp->geom->name, (intmax_t)start, (intmax_t)size, (intmax_t)offset, - (intmax_t)dsize, name); - } + DPRINTF("%s: %jxx%jx, data=%jxx%jx \"/dev/map/%s\"\n", + cp->geom->name, (intmax_t)start, (intmax_t)size, + (intmax_t)offset, (intmax_t)dsize, name); sc->offset[i] = start; sc->size[i] = size; @@ -364,31 +339,17 @@ g_access(cp, -1, 0, 0); if (LIST_EMPTY(&gp->provider)) { - if (bootverbose) - printf("MAP: No valid partition found at %s\n", pp->name); + DPRINTF("No valid partition found at %s\n", pp->name); g_slice_spoiled(cp); return (NULL); } return (gp); } -static void -g_map_config(struct gctl_req *req, struct g_class *mp, const char *verb) -{ - struct g_geom *gp; - - g_topology_assert(); - gp = gctl_get_geom(req, mp, "geom"); - if (gp == NULL) - return; - gctl_error(req, "Unknown verb"); -} - static struct g_class g_map_class = { .name = MAP_CLASS_NAME, .version = G_VERSION, .taste = g_map_taste, .dumpconf = g_map_dumpconf, - .ctlreq = g_map_config, }; DECLARE_GEOM_CLASS(g_map_class, g_map); Index: sys/i386/i386/machdep.c =================================================================== --- sys/i386/i386/machdep.c +++ sys/i386/i386/machdep.c @@ -3588,9 +3588,6 @@ printf("Intel Pentium detected, installing workaround for F00F bug\n"); tmp = kmem_malloc(kernel_arena, PAGE_SIZE * 2, M_WAITOK | M_ZERO); - if (tmp == 0) - panic("kmem_malloc returned 0"); - /* Put the problematic entry (#6) at the end of the lower page. */ new_idt = (struct gate_descriptor*) (tmp + PAGE_SIZE - 7 * sizeof(struct gate_descriptor)); Index: sys/modules/geom/Makefile =================================================================== --- sys/modules/geom/Makefile +++ sys/modules/geom/Makefile @@ -11,6 +11,7 @@ geom_journal \ geom_label \ geom_linux_lvm \ + geom_map \ geom_mirror \ geom_mountver \ geom_multipath \ Index: sys/modules/geom/geom_map/Makefile =================================================================== --- /dev/null +++ sys/modules/geom/geom_map/Makefile @@ -0,0 +1,8 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../../../geom + +KMOD= geom_map +SRCS= geom_map.c bus_if.h device_if.h + +.include Index: sys/netinet6/in6_pcb.c =================================================================== --- sys/netinet6/in6_pcb.c +++ sys/netinet6/in6_pcb.c @@ -642,18 +642,12 @@ /* * If the error designates a new path MTU for a destination * and the application (associated with this socket) wanted to - * know the value, notify. Note that we notify for all - * disconnected sockets if the corresponding application - * wanted. This is because some UDP applications keep sending - * sockets disconnected. + * know the value, notify. * XXX: should we avoid to notify the value to TCP sockets? */ - if (cmd == PRC_MSGSIZE && (inp->inp_flags & IN6P_MTU) != 0 && - (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr) || - IN6_ARE_ADDR_EQUAL(&inp->in6p_faddr, &sa6_dst->sin6_addr))) { + if (cmd == PRC_MSGSIZE) ip6_notify_pmtu(inp, (struct sockaddr_in6 *)dst, - (u_int32_t *)cmdarg); - } + *(u_int32_t *)cmdarg); /* * Detect if we should notify the error. If no source and Index: sys/netinet6/ip6_input.c =================================================================== --- sys/netinet6/ip6_input.c +++ sys/netinet6/ip6_input.c @@ -1343,24 +1343,28 @@ #undef IS2292 void -ip6_notify_pmtu(struct inpcb *in6p, struct sockaddr_in6 *dst, u_int32_t *mtu) +ip6_notify_pmtu(struct inpcb *inp, struct sockaddr_in6 *dst, u_int32_t mtu) { struct socket *so; struct mbuf *m_mtu; struct ip6_mtuinfo mtuctl; - so = in6p->inp_socket; - - if (mtu == NULL) + KASSERT(inp != NULL, ("%s: inp == NULL", __func__)); + /* + * Notify the error by sending IPV6_PATHMTU ancillary data if + * application wanted to know the MTU value. + * NOTE: we notify for disconnected sockets, because some udp + * applications keep sending sockets disconnected. + * NOTE: our implementation doesn't notify connected sockets that has + * foreign address that is different than given destination addresses + * (this is permitted by RFC 3542). + */ + if ((inp->inp_flags & IN6P_MTU) == 0 || ( + !IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr) && + !IN6_ARE_ADDR_EQUAL(&inp->in6p_faddr, &dst->sin6_addr))) return; -#ifdef DIAGNOSTIC - if (so == NULL) /* I believe this is impossible */ - panic("ip6_notify_pmtu: socket is NULL"); -#endif - - bzero(&mtuctl, sizeof(mtuctl)); /* zero-clear for safety */ - mtuctl.ip6m_mtu = *mtu; + mtuctl.ip6m_mtu = mtu; mtuctl.ip6m_addr = *dst; if (sa6_recoverscope(&mtuctl.ip6m_addr)) return; @@ -1369,14 +1373,13 @@ IPV6_PATHMTU, IPPROTO_IPV6)) == NULL) return; + so = inp->inp_socket; if (sbappendaddr(&so->so_rcv, (struct sockaddr *)dst, NULL, m_mtu) == 0) { m_freem(m_mtu); /* XXX: should count statistics */ } else sorwakeup(so); - - return; } #ifdef PULLDOWN_TEST Index: sys/netinet6/ip6_output.c =================================================================== --- sys/netinet6/ip6_output.c +++ sys/netinet6/ip6_output.c @@ -910,19 +910,12 @@ * Even if the DONTFRAG option is specified, we cannot send the * packet when the data length is larger than the MTU of the * outgoing interface. - * Notify the error by sending IPV6_PATHMTU ancillary data as - * well as returning an error code (the latter is not described - * in the API spec.) + * Notify the error by sending IPV6_PATHMTU ancillary data if + * application wanted to know the MTU value. Also return an + * error code (this is not described in the API spec). */ - u_int32_t mtu32; - struct ip6ctlparam ip6cp; - - mtu32 = (u_int32_t)mtu; - bzero(&ip6cp, sizeof(ip6cp)); - ip6cp.ip6c_cmdarg = (void *)&mtu32; - pfctlinput2(PRC_MSGSIZE, (struct sockaddr *)&ro_pmtu->ro_dst, - (void *)&ip6cp); - + if (inp != NULL) + ip6_notify_pmtu(inp, &dst_sa, (u_int32_t)mtu); error = EMSGSIZE; goto bad; } Index: sys/netinet6/ip6_var.h =================================================================== --- sys/netinet6/ip6_var.h +++ sys/netinet6/ip6_var.h @@ -368,8 +368,7 @@ struct mbuf **ip6_savecontrol_v4(struct inpcb *, struct mbuf *, struct mbuf **, int *); void ip6_savecontrol(struct inpcb *, struct mbuf *, struct mbuf **); -void ip6_notify_pmtu(struct inpcb *, struct sockaddr_in6 *, - u_int32_t *); +void ip6_notify_pmtu(struct inpcb *, struct sockaddr_in6 *, u_int32_t); int ip6_sysctl(int *, u_int, void *, size_t *, void *, size_t); void ip6_forward(struct mbuf *, int);