Commit 145ce502 authored by Joe Perches's avatar Joe Perches Committed by David S. Miller

net/sctp: Use pr_fmt and pr_<level>

Change SCTP_DEBUG_PRINTK and SCTP_DEBUG_PRINTK_IPADDR to
use do { print } while (0) guards.
Add SCTP_DEBUG_PRINTK_CONT to fix errors in log when
lines were continued.
Add #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
Add a missing newline in "Failed bind hash alloc"
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent dee06e47
...@@ -275,24 +275,35 @@ struct sctp_mib { ...@@ -275,24 +275,35 @@ struct sctp_mib {
/* Print debugging messages. */ /* Print debugging messages. */
#if SCTP_DEBUG #if SCTP_DEBUG
extern int sctp_debug_flag; extern int sctp_debug_flag;
#define SCTP_DEBUG_PRINTK(whatever...) \ #define SCTP_DEBUG_PRINTK(fmt, args...) \
((void) (sctp_debug_flag && printk(KERN_DEBUG whatever))) do { \
#define SCTP_DEBUG_PRINTK_IPADDR(lead, trail, leadparm, saddr, otherparms...) \ if (sctp_debug_flag) \
if (sctp_debug_flag) { \ printk(KERN_DEBUG pr_fmt(fmt), ##args); \
if (saddr->sa.sa_family == AF_INET6) { \ } while (0)
printk(KERN_DEBUG \ #define SCTP_DEBUG_PRINTK_CONT(fmt, args...) \
lead "%pI6" trail, \ do { \
leadparm, \ if (sctp_debug_flag) \
&saddr->v6.sin6_addr, \ pr_cont(fmt, ##args); \
otherparms); \ } while (0)
} else { \ #define SCTP_DEBUG_PRINTK_IPADDR(fmt_lead, fmt_trail, \
printk(KERN_DEBUG \ args_lead, saddr, args_trail...) \
lead "%pI4" trail, \ do { \
leadparm, \ if (sctp_debug_flag) { \
&saddr->v4.sin_addr.s_addr, \ if (saddr->sa.sa_family == AF_INET6) { \
otherparms); \ printk(KERN_DEBUG \
} \ pr_fmt(fmt_lead "%pI6" fmt_trail), \
} args_lead, \
&saddr->v6.sin6_addr, \
args_trail); \
} else { \
printk(KERN_DEBUG \
pr_fmt(fmt_lead "%pI4" fmt_trail), \
args_lead, \
&saddr->v4.sin_addr.s_addr, \
args_trail); \
} \
} \
} while (0)
#define SCTP_ENABLE_DEBUG { sctp_debug_flag = 1; } #define SCTP_ENABLE_DEBUG { sctp_debug_flag = 1; }
#define SCTP_DISABLE_DEBUG { sctp_debug_flag = 0; } #define SCTP_DISABLE_DEBUG { sctp_debug_flag = 0; }
...@@ -306,6 +317,7 @@ extern int sctp_debug_flag; ...@@ -306,6 +317,7 @@ extern int sctp_debug_flag;
#else /* SCTP_DEBUG */ #else /* SCTP_DEBUG */
#define SCTP_DEBUG_PRINTK(whatever...) #define SCTP_DEBUG_PRINTK(whatever...)
#define SCTP_DEBUG_PRINTK_CONT(fmt, args...)
#define SCTP_DEBUG_PRINTK_IPADDR(whatever...) #define SCTP_DEBUG_PRINTK_IPADDR(whatever...)
#define SCTP_ENABLE_DEBUG #define SCTP_ENABLE_DEBUG
#define SCTP_DISABLE_DEBUG #define SCTP_DISABLE_DEBUG
......
...@@ -48,6 +48,8 @@ ...@@ -48,6 +48,8 @@
* be incorporated into the next SCTP release. * be incorporated into the next SCTP release.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/types.h> #include <linux/types.h>
#include <linux/fcntl.h> #include <linux/fcntl.h>
#include <linux/poll.h> #include <linux/poll.h>
......
...@@ -37,6 +37,8 @@ ...@@ -37,6 +37,8 @@
* be incorporated into the next SCTP release. * be incorporated into the next SCTP release.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/types.h> #include <linux/types.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/net.h> #include <linux/net.h>
......
...@@ -43,6 +43,8 @@ ...@@ -43,6 +43,8 @@
* be incorporated into the next SCTP release. * be incorporated into the next SCTP release.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <net/sctp/sctp.h> #include <net/sctp/sctp.h>
#include <net/sctp/sm.h> #include <net/sctp/sm.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
......
...@@ -47,6 +47,8 @@ ...@@ -47,6 +47,8 @@
* be incorporated into the next SCTP release. * be incorporated into the next SCTP release.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -336,7 +338,7 @@ static void sctp_v6_get_saddr(struct sctp_sock *sk, ...@@ -336,7 +338,7 @@ static void sctp_v6_get_saddr(struct sctp_sock *sk,
memcpy(saddr, baddr, sizeof(union sctp_addr)); memcpy(saddr, baddr, sizeof(union sctp_addr));
SCTP_DEBUG_PRINTK("saddr: %pI6\n", &saddr->v6.sin6_addr); SCTP_DEBUG_PRINTK("saddr: %pI6\n", &saddr->v6.sin6_addr);
} else { } else {
printk(KERN_ERR "%s: asoc:%p Could not find a valid source " pr_err("%s: asoc:%p Could not find a valid source "
"address for the dest:%pI6\n", "address for the dest:%pI6\n",
__func__, asoc, &daddr->v6.sin6_addr); __func__, asoc, &daddr->v6.sin6_addr);
} }
......
...@@ -38,6 +38,8 @@ ...@@ -38,6 +38,8 @@
* be incorporated into the next SCTP release. * be incorporated into the next SCTP release.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/kernel.h> #include <linux/kernel.h>
#include <net/sctp/sctp.h> #include <net/sctp/sctp.h>
...@@ -134,8 +136,7 @@ void sctp_dbg_objcnt_init(void) ...@@ -134,8 +136,7 @@ void sctp_dbg_objcnt_init(void)
ent = proc_create("sctp_dbg_objcnt", 0, ent = proc_create("sctp_dbg_objcnt", 0,
proc_net_sctp, &sctp_objcnt_ops); proc_net_sctp, &sctp_objcnt_ops);
if (!ent) if (!ent)
printk(KERN_WARNING pr_warn("sctp_dbg_objcnt: Unable to create /proc entry.\n");
"sctp_dbg_objcnt: Unable to create /proc entry.\n");
} }
/* Cleanup the objcount entry in the proc filesystem. */ /* Cleanup the objcount entry in the proc filesystem. */
......
...@@ -41,6 +41,8 @@ ...@@ -41,6 +41,8 @@
* be incorporated into the next SCTP release. * be incorporated into the next SCTP release.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/types.h> #include <linux/types.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/wait.h> #include <linux/wait.h>
......
...@@ -46,6 +46,8 @@ ...@@ -46,6 +46,8 @@
* be incorporated into the next SCTP release. * be incorporated into the next SCTP release.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/types.h> #include <linux/types.h>
#include <linux/list.h> /* For struct list_head */ #include <linux/list.h> /* For struct list_head */
#include <linux/socket.h> #include <linux/socket.h>
...@@ -1463,23 +1465,23 @@ static void sctp_check_transmitted(struct sctp_outq *q, ...@@ -1463,23 +1465,23 @@ static void sctp_check_transmitted(struct sctp_outq *q,
/* Display the end of the /* Display the end of the
* current range. * current range.
*/ */
SCTP_DEBUG_PRINTK("-%08x", SCTP_DEBUG_PRINTK_CONT("-%08x",
dbg_last_ack_tsn); dbg_last_ack_tsn);
} }
/* Start a new range. */ /* Start a new range. */
SCTP_DEBUG_PRINTK(",%08x", tsn); SCTP_DEBUG_PRINTK_CONT(",%08x", tsn);
dbg_ack_tsn = tsn; dbg_ack_tsn = tsn;
break; break;
case 1: /* The last TSN was NOT ACKed. */ case 1: /* The last TSN was NOT ACKed. */
if (dbg_last_kept_tsn != dbg_kept_tsn) { if (dbg_last_kept_tsn != dbg_kept_tsn) {
/* Display the end of current range. */ /* Display the end of current range. */
SCTP_DEBUG_PRINTK("-%08x", SCTP_DEBUG_PRINTK_CONT("-%08x",
dbg_last_kept_tsn); dbg_last_kept_tsn);
} }
SCTP_DEBUG_PRINTK("\n"); SCTP_DEBUG_PRINTK_CONT("\n");
/* FALL THROUGH... */ /* FALL THROUGH... */
default: default:
...@@ -1526,18 +1528,18 @@ static void sctp_check_transmitted(struct sctp_outq *q, ...@@ -1526,18 +1528,18 @@ static void sctp_check_transmitted(struct sctp_outq *q,
break; break;
if (dbg_last_kept_tsn != dbg_kept_tsn) if (dbg_last_kept_tsn != dbg_kept_tsn)
SCTP_DEBUG_PRINTK("-%08x", SCTP_DEBUG_PRINTK_CONT("-%08x",
dbg_last_kept_tsn); dbg_last_kept_tsn);
SCTP_DEBUG_PRINTK(",%08x", tsn); SCTP_DEBUG_PRINTK_CONT(",%08x", tsn);
dbg_kept_tsn = tsn; dbg_kept_tsn = tsn;
break; break;
case 0: case 0:
if (dbg_last_ack_tsn != dbg_ack_tsn) if (dbg_last_ack_tsn != dbg_ack_tsn)
SCTP_DEBUG_PRINTK("-%08x", SCTP_DEBUG_PRINTK_CONT("-%08x",
dbg_last_ack_tsn); dbg_last_ack_tsn);
SCTP_DEBUG_PRINTK("\n"); SCTP_DEBUG_PRINTK_CONT("\n");
/* FALL THROUGH... */ /* FALL THROUGH... */
default: default:
...@@ -1556,17 +1558,17 @@ static void sctp_check_transmitted(struct sctp_outq *q, ...@@ -1556,17 +1558,17 @@ static void sctp_check_transmitted(struct sctp_outq *q,
switch (dbg_prt_state) { switch (dbg_prt_state) {
case 0: case 0:
if (dbg_last_ack_tsn != dbg_ack_tsn) { if (dbg_last_ack_tsn != dbg_ack_tsn) {
SCTP_DEBUG_PRINTK("-%08x\n", dbg_last_ack_tsn); SCTP_DEBUG_PRINTK_CONT("-%08x\n", dbg_last_ack_tsn);
} else { } else {
SCTP_DEBUG_PRINTK("\n"); SCTP_DEBUG_PRINTK_CONT("\n");
} }
break; break;
case 1: case 1:
if (dbg_last_kept_tsn != dbg_kept_tsn) { if (dbg_last_kept_tsn != dbg_kept_tsn) {
SCTP_DEBUG_PRINTK("-%08x\n", dbg_last_kept_tsn); SCTP_DEBUG_PRINTK_CONT("-%08x\n", dbg_last_kept_tsn);
} else { } else {
SCTP_DEBUG_PRINTK("\n"); SCTP_DEBUG_PRINTK_CONT("\n");
} }
} }
#endif /* SCTP_DEBUG */ #endif /* SCTP_DEBUG */
......
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/kprobes.h> #include <linux/kprobes.h>
#include <linux/socket.h> #include <linux/socket.h>
...@@ -192,7 +194,7 @@ static __init int sctpprobe_init(void) ...@@ -192,7 +194,7 @@ static __init int sctpprobe_init(void)
if (ret) if (ret)
goto remove_proc; goto remove_proc;
pr_info("SCTP probe registered (port=%d)\n", port); pr_info("probe registered (port=%d)\n", port);
return 0; return 0;
......
...@@ -46,6 +46,8 @@ ...@@ -46,6 +46,8 @@
* be incorporated into the next SCTP release. * be incorporated into the next SCTP release.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
...@@ -707,8 +709,7 @@ static int sctp_ctl_sock_init(void) ...@@ -707,8 +709,7 @@ static int sctp_ctl_sock_init(void)
&init_net); &init_net);
if (err < 0) { if (err < 0) {
printk(KERN_ERR pr_err("Failed to create the SCTP control socket\n");
"SCTP: Failed to create the SCTP control socket.\n");
return err; return err;
} }
return 0; return 0;
...@@ -1206,7 +1207,7 @@ SCTP_STATIC __init int sctp_init(void) ...@@ -1206,7 +1207,7 @@ SCTP_STATIC __init int sctp_init(void)
__get_free_pages(GFP_ATOMIC, order); __get_free_pages(GFP_ATOMIC, order);
} while (!sctp_assoc_hashtable && --order > 0); } while (!sctp_assoc_hashtable && --order > 0);
if (!sctp_assoc_hashtable) { if (!sctp_assoc_hashtable) {
printk(KERN_ERR "SCTP: Failed association hash alloc.\n"); pr_err("Failed association hash alloc\n");
status = -ENOMEM; status = -ENOMEM;
goto err_ahash_alloc; goto err_ahash_alloc;
} }
...@@ -1220,7 +1221,7 @@ SCTP_STATIC __init int sctp_init(void) ...@@ -1220,7 +1221,7 @@ SCTP_STATIC __init int sctp_init(void)
sctp_ep_hashtable = (struct sctp_hashbucket *) sctp_ep_hashtable = (struct sctp_hashbucket *)
kmalloc(64 * sizeof(struct sctp_hashbucket), GFP_KERNEL); kmalloc(64 * sizeof(struct sctp_hashbucket), GFP_KERNEL);
if (!sctp_ep_hashtable) { if (!sctp_ep_hashtable) {
printk(KERN_ERR "SCTP: Failed endpoint_hash alloc.\n"); pr_err("Failed endpoint_hash alloc\n");
status = -ENOMEM; status = -ENOMEM;
goto err_ehash_alloc; goto err_ehash_alloc;
} }
...@@ -1239,7 +1240,7 @@ SCTP_STATIC __init int sctp_init(void) ...@@ -1239,7 +1240,7 @@ SCTP_STATIC __init int sctp_init(void)
__get_free_pages(GFP_ATOMIC, order); __get_free_pages(GFP_ATOMIC, order);
} while (!sctp_port_hashtable && --order > 0); } while (!sctp_port_hashtable && --order > 0);
if (!sctp_port_hashtable) { if (!sctp_port_hashtable) {
printk(KERN_ERR "SCTP: Failed bind hash alloc."); pr_err("Failed bind hash alloc\n");
status = -ENOMEM; status = -ENOMEM;
goto err_bhash_alloc; goto err_bhash_alloc;
} }
...@@ -1248,8 +1249,7 @@ SCTP_STATIC __init int sctp_init(void) ...@@ -1248,8 +1249,7 @@ SCTP_STATIC __init int sctp_init(void)
INIT_HLIST_HEAD(&sctp_port_hashtable[i].chain); INIT_HLIST_HEAD(&sctp_port_hashtable[i].chain);
} }
printk(KERN_INFO "SCTP: Hash tables configured " pr_info("Hash tables configured (established %d bind %d)\n",
"(established %d bind %d)\n",
sctp_assoc_hashsize, sctp_port_hashsize); sctp_assoc_hashsize, sctp_port_hashsize);
/* Disable ADDIP by default. */ /* Disable ADDIP by default. */
...@@ -1290,8 +1290,7 @@ SCTP_STATIC __init int sctp_init(void) ...@@ -1290,8 +1290,7 @@ SCTP_STATIC __init int sctp_init(void)
/* Initialize the control inode/socket for handling OOTB packets. */ /* Initialize the control inode/socket for handling OOTB packets. */
if ((status = sctp_ctl_sock_init())) { if ((status = sctp_ctl_sock_init())) {
printk (KERN_ERR pr_err("Failed to initialize the SCTP control sock\n");
"SCTP: Failed to initialize the SCTP control sock.\n");
goto err_ctl_sock_init; goto err_ctl_sock_init;
} }
......
...@@ -50,6 +50,8 @@ ...@@ -50,6 +50,8 @@
* be incorporated into the next SCTP release. * be incorporated into the next SCTP release.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/types.h> #include <linux/types.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/ip.h> #include <linux/ip.h>
......
...@@ -47,6 +47,8 @@ ...@@ -47,6 +47,8 @@
* be incorporated into the next SCTP release. * be incorporated into the next SCTP release.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/socket.h> #include <linux/socket.h>
...@@ -1146,26 +1148,23 @@ static int sctp_side_effects(sctp_event_t event_type, sctp_subtype_t subtype, ...@@ -1146,26 +1148,23 @@ static int sctp_side_effects(sctp_event_t event_type, sctp_subtype_t subtype,
case SCTP_DISPOSITION_VIOLATION: case SCTP_DISPOSITION_VIOLATION:
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_ERR "sctp protocol violation state %d " pr_err("protocol violation state %d chunkid %d\n",
"chunkid %d\n", state, subtype.chunk); state, subtype.chunk);
break; break;
case SCTP_DISPOSITION_NOT_IMPL: case SCTP_DISPOSITION_NOT_IMPL:
printk(KERN_WARNING "sctp unimplemented feature in state %d, " pr_warn("unimplemented feature in state %d, event_type %d, event_id %d\n",
"event_type %d, event_id %d\n", state, event_type, subtype.chunk);
state, event_type, subtype.chunk);
break; break;
case SCTP_DISPOSITION_BUG: case SCTP_DISPOSITION_BUG:
printk(KERN_ERR "sctp bug in state %d, " pr_err("bug in state %d, event_type %d, event_id %d\n",
"event_type %d, event_id %d\n",
state, event_type, subtype.chunk); state, event_type, subtype.chunk);
BUG(); BUG();
break; break;
default: default:
printk(KERN_ERR "sctp impossible disposition %d " pr_err("impossible disposition %d in state %d, event_type %d, event_id %d\n",
"in state %d, event_type %d, event_id %d\n",
status, state, event_type, subtype.chunk); status, state, event_type, subtype.chunk);
BUG(); BUG();
break; break;
...@@ -1679,8 +1678,8 @@ static int sctp_cmd_interpreter(sctp_event_t event_type, ...@@ -1679,8 +1678,8 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
sctp_cmd_send_asconf(asoc); sctp_cmd_send_asconf(asoc);
break; break;
default: default:
printk(KERN_WARNING "Impossible command: %u, %p\n", pr_warn("Impossible command: %u, %p\n",
cmd->verb, cmd->obj.ptr); cmd->verb, cmd->obj.ptr);
break; break;
} }
......
...@@ -50,6 +50,8 @@ ...@@ -50,6 +50,8 @@
* be incorporated into the next SCTP release. * be incorporated into the next SCTP release.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/types.h> #include <linux/types.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/ip.h> #include <linux/ip.h>
...@@ -1138,18 +1140,16 @@ sctp_disposition_t sctp_sf_backbeat_8_3(const struct sctp_endpoint *ep, ...@@ -1138,18 +1140,16 @@ sctp_disposition_t sctp_sf_backbeat_8_3(const struct sctp_endpoint *ep,
if (unlikely(!link)) { if (unlikely(!link)) {
if (from_addr.sa.sa_family == AF_INET6) { if (from_addr.sa.sa_family == AF_INET6) {
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_WARNING pr_warn("%s association %p could not find address %pI6\n",
"%s association %p could not find address %pI6\n", __func__,
__func__, asoc,
asoc, &from_addr.v6.sin6_addr);
&from_addr.v6.sin6_addr);
} else { } else {
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_WARNING pr_warn("%s association %p could not find address %pI4\n",
"%s association %p could not find address %pI4\n", __func__,
__func__, asoc,
asoc, &from_addr.v4.sin_addr.s_addr);
&from_addr.v4.sin_addr.s_addr);
} }
return SCTP_DISPOSITION_DISCARD; return SCTP_DISPOSITION_DISCARD;
} }
......
...@@ -46,6 +46,8 @@ ...@@ -46,6 +46,8 @@
* be incorporated into the next SCTP release. * be incorporated into the next SCTP release.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <net/sctp/sctp.h> #include <net/sctp/sctp.h>
#include <net/sctp/sm.h> #include <net/sctp/sm.h>
...@@ -66,15 +68,19 @@ static const sctp_sm_table_entry_t bug = { ...@@ -66,15 +68,19 @@ static const sctp_sm_table_entry_t bug = {
.name = "sctp_sf_bug" .name = "sctp_sf_bug"
}; };
#define DO_LOOKUP(_max, _type, _table) \ #define DO_LOOKUP(_max, _type, _table) \
if ((event_subtype._type > (_max))) { \ ({ \
printk(KERN_WARNING \ const sctp_sm_table_entry_t *rtn; \
"sctp table %p possible attack:" \ \
" event %d exceeds max %d\n", \ if ((event_subtype._type > (_max))) { \
_table, event_subtype._type, _max); \ pr_warn("table %p possible attack: event %d exceeds max %d\n", \
return &bug; \ _table, event_subtype._type, _max); \
} \ rtn = &bug; \
return &_table[event_subtype._type][(int)state]; } else \
rtn = &_table[event_subtype._type][(int)state]; \
\
rtn; \
})
const sctp_sm_table_entry_t *sctp_sm_lookup_event(sctp_event_t event_type, const sctp_sm_table_entry_t *sctp_sm_lookup_event(sctp_event_t event_type,
sctp_state_t state, sctp_state_t state,
...@@ -83,21 +89,15 @@ const sctp_sm_table_entry_t *sctp_sm_lookup_event(sctp_event_t event_type, ...@@ -83,21 +89,15 @@ const sctp_sm_table_entry_t *sctp_sm_lookup_event(sctp_event_t event_type,
switch (event_type) { switch (event_type) {
case SCTP_EVENT_T_CHUNK: case SCTP_EVENT_T_CHUNK:
return sctp_chunk_event_lookup(event_subtype.chunk, state); return sctp_chunk_event_lookup(event_subtype.chunk, state);
break;
case SCTP_EVENT_T_TIMEOUT: case SCTP_EVENT_T_TIMEOUT:
DO_LOOKUP(SCTP_EVENT_TIMEOUT_MAX, timeout, return DO_LOOKUP(SCTP_EVENT_TIMEOUT_MAX, timeout,
timeout_event_table); timeout_event_table);
break;
case SCTP_EVENT_T_OTHER: case SCTP_EVENT_T_OTHER:
DO_LOOKUP(SCTP_EVENT_OTHER_MAX, other, other_event_table); return DO_LOOKUP(SCTP_EVENT_OTHER_MAX, other,
break; other_event_table);
case SCTP_EVENT_T_PRIMITIVE: case SCTP_EVENT_T_PRIMITIVE:
DO_LOOKUP(SCTP_EVENT_PRIMITIVE_MAX, primitive, return DO_LOOKUP(SCTP_EVENT_PRIMITIVE_MAX, primitive,
primitive_event_table); primitive_event_table);
break;
default: default:
/* Yikes! We got an illegal event type. */ /* Yikes! We got an illegal event type. */
return &bug; return &bug;
......
...@@ -57,6 +57,8 @@ ...@@ -57,6 +57,8 @@
* be incorporated into the next SCTP release. * be incorporated into the next SCTP release.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/types.h> #include <linux/types.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/wait.h> #include <linux/wait.h>
...@@ -2458,9 +2460,8 @@ static int sctp_setsockopt_delayed_ack(struct sock *sk, ...@@ -2458,9 +2460,8 @@ static int sctp_setsockopt_delayed_ack(struct sock *sk,
if (params.sack_delay == 0 && params.sack_freq == 0) if (params.sack_delay == 0 && params.sack_freq == 0)
return 0; return 0;
} else if (optlen == sizeof(struct sctp_assoc_value)) { } else if (optlen == sizeof(struct sctp_assoc_value)) {
printk(KERN_WARNING "SCTP: Use of struct sctp_assoc_value " pr_warn("Use of struct sctp_assoc_value in delayed_ack socket option deprecated\n");
"in delayed_ack socket option deprecated\n"); pr_warn("Use struct sctp_sack_info instead\n");
printk(KERN_WARNING "SCTP: Use struct sctp_sack_info instead\n");
if (copy_from_user(&params, optval, optlen)) if (copy_from_user(&params, optval, optlen))
return -EFAULT; return -EFAULT;
...@@ -2868,10 +2869,8 @@ static int sctp_setsockopt_maxseg(struct sock *sk, char __user *optval, unsigned ...@@ -2868,10 +2869,8 @@ static int sctp_setsockopt_maxseg(struct sock *sk, char __user *optval, unsigned
int val; int val;
if (optlen == sizeof(int)) { if (optlen == sizeof(int)) {
printk(KERN_WARNING pr_warn("Use of int in maxseg socket option deprecated\n");
"SCTP: Use of int in maxseg socket option deprecated\n"); pr_warn("Use struct sctp_assoc_value instead\n");
printk(KERN_WARNING
"SCTP: Use struct sctp_assoc_value instead\n");
if (copy_from_user(&val, optval, optlen)) if (copy_from_user(&val, optval, optlen))
return -EFAULT; return -EFAULT;
params.assoc_id = 0; params.assoc_id = 0;
...@@ -3121,10 +3120,8 @@ static int sctp_setsockopt_maxburst(struct sock *sk, ...@@ -3121,10 +3120,8 @@ static int sctp_setsockopt_maxburst(struct sock *sk,
int assoc_id = 0; int assoc_id = 0;
if (optlen == sizeof(int)) { if (optlen == sizeof(int)) {
printk(KERN_WARNING pr_warn("Use of int in max_burst socket option deprecated\n");
"SCTP: Use of int in max_burst socket option deprecated\n"); pr_warn("Use struct sctp_assoc_value instead\n");
printk(KERN_WARNING
"SCTP: Use struct sctp_assoc_value instead\n");
if (copy_from_user(&val, optval, optlen)) if (copy_from_user(&val, optval, optlen))
return -EFAULT; return -EFAULT;
} else if (optlen == sizeof(struct sctp_assoc_value)) { } else if (optlen == sizeof(struct sctp_assoc_value)) {
...@@ -4281,9 +4278,8 @@ static int sctp_getsockopt_delayed_ack(struct sock *sk, int len, ...@@ -4281,9 +4278,8 @@ static int sctp_getsockopt_delayed_ack(struct sock *sk, int len,
if (copy_from_user(&params, optval, len)) if (copy_from_user(&params, optval, len))
return -EFAULT; return -EFAULT;
} else if (len == sizeof(struct sctp_assoc_value)) { } else if (len == sizeof(struct sctp_assoc_value)) {
printk(KERN_WARNING "SCTP: Use of struct sctp_assoc_value " pr_warn("Use of struct sctp_assoc_value in delayed_ack socket option deprecated\n");
"in delayed_ack socket option deprecated\n"); pr_warn("Use struct sctp_sack_info instead\n");
printk(KERN_WARNING "SCTP: Use struct sctp_sack_info instead\n");
if (copy_from_user(&params, optval, len)) if (copy_from_user(&params, optval, len))
return -EFAULT; return -EFAULT;
} else } else
...@@ -4929,10 +4925,8 @@ static int sctp_getsockopt_maxseg(struct sock *sk, int len, ...@@ -4929,10 +4925,8 @@ static int sctp_getsockopt_maxseg(struct sock *sk, int len,
struct sctp_association *asoc; struct sctp_association *asoc;
if (len == sizeof(int)) { if (len == sizeof(int)) {
printk(KERN_WARNING pr_warn("Use of int in maxseg socket option deprecated\n");
"SCTP: Use of int in maxseg socket option deprecated\n"); pr_warn("Use struct sctp_assoc_value instead\n");
printk(KERN_WARNING
"SCTP: Use struct sctp_assoc_value instead\n");
params.assoc_id = 0; params.assoc_id = 0;
} else if (len >= sizeof(struct sctp_assoc_value)) { } else if (len >= sizeof(struct sctp_assoc_value)) {
len = sizeof(struct sctp_assoc_value); len = sizeof(struct sctp_assoc_value);
...@@ -5023,10 +5017,8 @@ static int sctp_getsockopt_maxburst(struct sock *sk, int len, ...@@ -5023,10 +5017,8 @@ static int sctp_getsockopt_maxburst(struct sock *sk, int len,
struct sctp_association *asoc; struct sctp_association *asoc;
if (len == sizeof(int)) { if (len == sizeof(int)) {
printk(KERN_WARNING pr_warn("Use of int in max_burst socket option deprecated\n");
"SCTP: Use of int in max_burst socket option deprecated\n"); pr_warn("Use struct sctp_assoc_value instead\n");
printk(KERN_WARNING
"SCTP: Use struct sctp_assoc_value instead\n");
params.assoc_id = 0; params.assoc_id = 0;
} else if (len >= sizeof(struct sctp_assoc_value)) { } else if (len >= sizeof(struct sctp_assoc_value)) {
len = sizeof(struct sctp_assoc_value); len = sizeof(struct sctp_assoc_value);
...@@ -5586,8 +5578,7 @@ SCTP_STATIC int sctp_listen_start(struct sock *sk, int backlog) ...@@ -5586,8 +5578,7 @@ SCTP_STATIC int sctp_listen_start(struct sock *sk, int backlog)
tfm = crypto_alloc_hash(sctp_hmac_alg, 0, CRYPTO_ALG_ASYNC); tfm = crypto_alloc_hash(sctp_hmac_alg, 0, CRYPTO_ALG_ASYNC);
if (IS_ERR(tfm)) { if (IS_ERR(tfm)) {
if (net_ratelimit()) { if (net_ratelimit()) {
printk(KERN_INFO pr_info("failed to load transform for %s: %ld\n",
"SCTP: failed to load transform for %s: %ld\n",
sctp_hmac_alg, PTR_ERR(tfm)); sctp_hmac_alg, PTR_ERR(tfm));
} }
return -ENOSYS; return -ENOSYS;
......
...@@ -48,6 +48,8 @@ ...@@ -48,6 +48,8 @@
* be incorporated into the next SCTP release. * be incorporated into the next SCTP release.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/random.h> #include <linux/random.h>
...@@ -244,10 +246,9 @@ void sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu) ...@@ -244,10 +246,9 @@ void sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu)
struct dst_entry *dst; struct dst_entry *dst;
if (unlikely(pmtu < SCTP_DEFAULT_MINSEGMENT)) { if (unlikely(pmtu < SCTP_DEFAULT_MINSEGMENT)) {
printk(KERN_WARNING "%s: Reported pmtu %d too low, " pr_warn("%s: Reported pmtu %d too low, using default minimum of %d\n",
"using default minimum of %d\n", __func__, pmtu,
__func__, pmtu, SCTP_DEFAULT_MINSEGMENT);
SCTP_DEFAULT_MINSEGMENT);
/* Use default minimum segment size and disable /* Use default minimum segment size and disable
* pmtu discovery on this transport. * pmtu discovery on this transport.
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment