From 40e42c82e594770b992165a4919aa17fa4935037 Mon Sep 17 00:00:00 2001 From: nayden Date: Wed, 11 Jul 2018 21:18:23 +0000 Subject: [PATCH] Disambiguate the source of panics in sys/net* by adding __func__ magic constant to panic() calls. ok benno@ henning@ tb@ --- sys/net/if_pppx.c | 6 +++--- sys/net/pf_if.c | 10 +++++----- sys/net80211/ieee80211.c | 12 ++++++------ sys/net80211/ieee80211_mira.c | 10 +++++----- sys/netinet/in.c | 8 ++++---- sys/netinet6/nd6.c | 6 +++--- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/sys/net/if_pppx.c b/sys/net/if_pppx.c index e81c09b1ec6..b43911eeb76 100644 --- a/sys/net/if_pppx.c +++ b/sys/net/if_pppx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pppx.c,v 1.65 2018/06/15 12:39:38 yasuoka Exp $ */ +/* $OpenBSD: if_pppx.c,v 1.66 2018/07/11 21:18:23 nayden Exp $ */ /* * Copyright (c) 2010 Claudio Jeker @@ -839,7 +839,7 @@ pppx_add_session(struct pppx_dev *pxd, struct pipex_session_req *req) } if (RBT_INSERT(pppx_ifs, &pppx_ifs, pxi) != NULL) - panic("pppx_ifs modified while lock was held"); + panic("%s: pppx_ifs modified while lock was held", __func__); LIST_INSERT_HEAD(&pxd->pxd_pxis, pxi, pxi_list); rw_exit_write(&pppx_ifs_lk); @@ -991,7 +991,7 @@ pppx_if_destroy(struct pppx_dev *pxd, struct pppx_if *pxi) rw_enter_write(&pppx_ifs_lk); if (RBT_REMOVE(pppx_ifs, &pppx_ifs, pxi) == NULL) - panic("pppx_ifs modified while lock was held"); + panic("%s: pppx_ifs modified while lock was held", __func__); LIST_REMOVE(pxi, pxi_list); rw_exit_write(&pppx_ifs_lk); diff --git a/sys/net/pf_if.c b/sys/net/pf_if.c index 7ea1f05ea16..827ecb097d7 100644 --- a/sys/net/pf_if.c +++ b/sys/net/pf_if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf_if.c,v 1.94 2018/07/11 09:05:51 henning Exp $ */ +/* $OpenBSD: pf_if.c,v 1.95 2018/07/11 21:18:23 nayden Exp $ */ /* * Copyright 2005 Henning Brauer @@ -227,7 +227,7 @@ pfi_attach_ifnet(struct ifnet *ifp) pfi_initialize(); pfi_update++; if ((kif = pfi_kif_get(ifp->if_xname)) == NULL) - panic("pfi_kif_get failed"); + panic("%s: pfi_kif_get failed", __func__); kif->pfik_ifp = ifp; ifp->if_pf_kif = (caddr_t)kif; @@ -265,7 +265,7 @@ pfi_attach_ifgroup(struct ifg_group *ifg) pfi_initialize(); pfi_update++; if ((kif = pfi_kif_get(ifg->ifg_group)) == NULL) - panic("pfi_kif_get failed"); + panic("%s: pfi_kif_get failed", __func__); kif->pfik_group = ifg; ifg->ifg_pf_kif = (caddr_t)kif; @@ -293,7 +293,7 @@ pfi_group_change(const char *group) pfi_update++; if ((kif = pfi_kif_get(group)) == NULL) - panic("pfi_kif_get failed"); + panic("%s: pfi_kif_get failed", __func__); pfi_kif_update(kif); } @@ -305,7 +305,7 @@ pfi_group_addmember(const char *group, struct ifnet *ifp) if ((gkif = pfi_kif_get(group)) == NULL || (ikif = pfi_kif_get(ifp->if_xname)) == NULL) - panic("pfi_kif_get failed"); + panic("%s: pfi_kif_get failed", __func__); ikif->pfik_flags |= gkif->pfik_flags; pfi_group_change(group); diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c index 458b4f363ea..3f5aba761e3 100644 --- a/sys/net80211/ieee80211.c +++ b/sys/net80211/ieee80211.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211.c,v 1.68 2018/04/28 14:49:07 stsp Exp $ */ +/* $OpenBSD: ieee80211.c,v 1.69 2018/07/11 21:18:23 nayden Exp $ */ /* $NetBSD: ieee80211.c,v 1.19 2004/06/06 05:45:29 dyoung Exp $ */ /*- @@ -823,7 +823,7 @@ ieee80211_setmode(struct ieee80211com *ic, enum ieee80211_phymode mode) * channel list before committing to the new mode. */ if (mode >= nitems(chanflags)) - panic("unexpected mode %u", mode); + panic("%s: unexpected mode %u", __func__, mode); modeflags = chanflags[mode]; for (i = 0; i <= IEEE80211_CHAN_MAX; i++) { c = &ic->ic_channels[i]; @@ -969,7 +969,7 @@ ieee80211_mcs2media(struct ieee80211com *ic, int mcs, case IEEE80211_MODE_11B: case IEEE80211_MODE_11G: /* these modes use rates, not MCS */ - panic("unexpected mode %d", mode); + panic("%s: unexpected mode %d", __func__, mode); break; case IEEE80211_MODE_AUTO: case IEEE80211_MODE_11N: @@ -1062,7 +1062,7 @@ ieee80211_rate2media(struct ieee80211com *ic, int rate, break; case IEEE80211_MODE_11N: /* 11n uses MCS, not rates. */ - panic("unexpected mode %d", mode); + panic("%s: unexpected mode %d", __func__, mode); break; } for (i = 0; i < nitems(rates); i++) @@ -1135,7 +1135,7 @@ ieee80211_rate2plcp(u_int8_t rate, enum ieee80211_phymode mode) case 108: return 0x0c; } } else - panic("unexpected mode %u", mode); + panic("%s: unexpected mode %u", __func__, mode); DPRINTF(("unsupported rate %u\n", rate)); @@ -1168,7 +1168,7 @@ ieee80211_plcp2rate(u_int8_t plcp, enum ieee80211_phymode mode) case 0x0c: return 108; } } else - panic("unexpected mode %u", mode); + panic("%s: unexpected mode %u", __func__, mode); DPRINTF(("unsupported plcp %u\n", plcp)); diff --git a/sys/net80211/ieee80211_mira.c b/sys/net80211/ieee80211_mira.c index 37ec98beaac..1aa59fdd72a 100644 --- a/sys/net80211/ieee80211_mira.c +++ b/sys/net80211/ieee80211_mira.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_mira.c,v 1.11 2017/04/23 21:04:55 stsp Exp $ */ +/* $OpenBSD: ieee80211_mira.c,v 1.12 2018/07/11 21:18:23 nayden Exp $ */ /* * Copyright (c) 2016 Stefan Sperling @@ -614,7 +614,7 @@ ieee80211_mira_next_rateset(struct ieee80211_mira_node *mn, int mcs) else /* MCS 0-7 */ return NULL; } else - panic("invalid probing mode %d", mn->probing); + panic("%s: invalid probing mode %d", __func__, mn->probing); rsnext = &ieee80211_mira_ratesets[next]; if ((rsnext->mcs_mask & mn->valid_rates) == 0) @@ -695,7 +695,7 @@ ieee80211_mira_probe_next_rateset(struct ieee80211_mira_node *mn, (1 << ieee80211_mira_next_lower_intra_rate(mn, ni)); #endif } else - panic("invalid probing mode %d", mn->probing); + panic("%s: invalid probing mode %d", __func__, mn->probing); } int @@ -709,7 +709,7 @@ ieee80211_mira_next_mcs(struct ieee80211_mira_node *mn, else if (mn->probing & IEEE80211_MIRA_PROBING_UP) next = ieee80211_mira_next_intra_rate(mn, ni); else - panic("invalid probing mode %d", mn->probing); + panic("%s: invalid probing mode %d", __func__, mn->probing); return next; } @@ -725,7 +725,7 @@ ieee80211_mira_prev_mcs(struct ieee80211_mira_node *mn, else if (mn->probing & IEEE80211_MIRA_PROBING_UP) next = ieee80211_mira_next_lower_intra_rate(mn, ni); else - panic("invalid probing mode %d", mn->probing); + panic("%s: invalid probing mode %d", __func__, mn->probing); return next; } diff --git a/sys/netinet/in.c b/sys/netinet/in.c index b5ef386d21d..49fe289999f 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in.c,v 1.159 2018/06/03 18:35:48 tb Exp $ */ +/* $OpenBSD: in.c,v 1.160 2018/07/11 21:18:23 nayden Exp $ */ /* $NetBSD: in.c,v 1.26 1996/02/13 23:41:39 christos Exp $ */ /* @@ -324,7 +324,7 @@ in_ioctl_sifaddr(u_long cmd, caddr_t data, struct ifnet *ifp, int privileged) int newifaddr; if (cmd != SIOCSIFADDR) - panic("invalid ioctl %lu", cmd); + panic("%s: invalid ioctl %lu", __func__, cmd); if (!privileged) return (EPERM); @@ -477,7 +477,7 @@ in_ioctl_change_ifaddr(u_long cmd, caddr_t data, struct ifnet *ifp, break; default: - panic("invalid ioctl %lu", cmd); + panic("%s: invalid ioctl %lu", __func__, cmd); } NET_UNLOCK(); @@ -542,7 +542,7 @@ in_ioctl_get(u_long cmd, caddr_t data, struct ifnet *ifp) break; default: - panic("invalid ioctl %lu", cmd); + panic("%s: invalid ioctl %lu", __func__, cmd); } err: diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 3af3909e365..bce15ad5135 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6.c,v 1.224 2018/05/02 07:19:45 tb Exp $ */ +/* $OpenBSD: nd6.c,v 1.225 2018/07/11 21:18:23 nayden Exp $ */ /* $KAME: nd6.c,v 1.280 2002/06/08 19:52:07 itojun Exp $ */ /* @@ -179,7 +179,7 @@ nd6_option(union nd_opts *ndopts) if (!ndopts) panic("ndopts == NULL in nd6_option"); if (!ndopts->nd_opts_last) - panic("uninitialized ndopts in nd6_option"); + panic("%s: uninitialized ndopts", __func__); if (!ndopts->nd_opts_search) return NULL; if (ndopts->nd_opts_done) @@ -230,7 +230,7 @@ nd6_options(union nd_opts *ndopts) if (!ndopts) panic("ndopts == NULL in nd6_options"); if (!ndopts->nd_opts_last) - panic("uninitialized ndopts in nd6_options"); + panic("%s: uninitialized ndopts", __func__); if (!ndopts->nd_opts_search) return 0; -- 2.20.1