Commit 058bd4d2 authored by Joe Perches's avatar Joe Perches Committed by David S. Miller

net: Convert printks to pr_<level>

Use a more current kernel messaging style.

Convert a printk block to print_hex_dump.
Coalesce formats, align arguments.
Use %s, __func__ instead of embedding function names.

Some messages that were prefixed with <foo>_close are
now prefixed with <foo>_fini.  Some ah4 and esp messages
are now not prefixed with "ip ".

The intent of this patch is to later add something like
  #define pr_fmt(fmt) "IPv4: " fmt.
to standardize the output messages.

Text size is trivially reduced. (x86-32 allyesconfig)

$ size net/ipv4/built-in.o*
   text	   data	    bss	    dec	    hex	filename
 887888	  31558	 249696	1169142	 11d6f6	net/ipv4/built-in.o.new
 887934	  31558	 249800	1169292	 11d78c	net/ipv4/built-in.o.old
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 43db362d
...@@ -1085,13 +1085,11 @@ void inet_register_protosw(struct inet_protosw *p) ...@@ -1085,13 +1085,11 @@ void inet_register_protosw(struct inet_protosw *p)
return; return;
out_permanent: out_permanent:
printk(KERN_ERR "Attempt to override permanent protocol %d.\n", pr_err("Attempt to override permanent protocol %d\n", protocol);
protocol);
goto out; goto out;
out_illegal: out_illegal:
printk(KERN_ERR pr_err("Ignoring attempt to register invalid socket type %d\n",
"Ignoring attempt to register invalid socket type %d.\n",
p->type); p->type);
goto out; goto out;
} }
...@@ -1100,8 +1098,7 @@ EXPORT_SYMBOL(inet_register_protosw); ...@@ -1100,8 +1098,7 @@ EXPORT_SYMBOL(inet_register_protosw);
void inet_unregister_protosw(struct inet_protosw *p) void inet_unregister_protosw(struct inet_protosw *p)
{ {
if (INET_PROTOSW_PERMANENT & p->flags) { if (INET_PROTOSW_PERMANENT & p->flags) {
printk(KERN_ERR pr_err("Attempt to unregister permanent protocol %d\n",
"Attempt to unregister permanent protocol %d.\n",
p->protocol); p->protocol);
} else { } else {
spin_lock_bh(&inetsw_lock); spin_lock_bh(&inetsw_lock);
...@@ -1150,8 +1147,8 @@ static int inet_sk_reselect_saddr(struct sock *sk) ...@@ -1150,8 +1147,8 @@ static int inet_sk_reselect_saddr(struct sock *sk)
return 0; return 0;
if (sysctl_ip_dynaddr > 1) { if (sysctl_ip_dynaddr > 1) {
printk(KERN_INFO "%s(): shifting inet->saddr from %pI4 to %pI4\n", pr_info("%s(): shifting inet->saddr from %pI4 to %pI4\n",
__func__, &old_saddr, &new_saddr); __func__, &old_saddr, &new_saddr);
} }
inet->inet_saddr = inet->inet_rcv_saddr = new_saddr; inet->inet_saddr = inet->inet_rcv_saddr = new_saddr;
...@@ -1680,14 +1677,14 @@ static int __init inet_init(void) ...@@ -1680,14 +1677,14 @@ static int __init inet_init(void)
*/ */
if (inet_add_protocol(&icmp_protocol, IPPROTO_ICMP) < 0) if (inet_add_protocol(&icmp_protocol, IPPROTO_ICMP) < 0)
printk(KERN_CRIT "inet_init: Cannot add ICMP protocol\n"); pr_crit("%s: Cannot add ICMP protocol\n", __func__);
if (inet_add_protocol(&udp_protocol, IPPROTO_UDP) < 0) if (inet_add_protocol(&udp_protocol, IPPROTO_UDP) < 0)
printk(KERN_CRIT "inet_init: Cannot add UDP protocol\n"); pr_crit("%s: Cannot add UDP protocol\n", __func__);
if (inet_add_protocol(&tcp_protocol, IPPROTO_TCP) < 0) if (inet_add_protocol(&tcp_protocol, IPPROTO_TCP) < 0)
printk(KERN_CRIT "inet_init: Cannot add TCP protocol\n"); pr_crit("%s: Cannot add TCP protocol\n", __func__);
#ifdef CONFIG_IP_MULTICAST #ifdef CONFIG_IP_MULTICAST
if (inet_add_protocol(&igmp_protocol, IPPROTO_IGMP) < 0) if (inet_add_protocol(&igmp_protocol, IPPROTO_IGMP) < 0)
printk(KERN_CRIT "inet_init: Cannot add IGMP protocol\n"); pr_crit("%s: Cannot add IGMP protocol\n", __func__);
#endif #endif
/* Register the socket-side information for inet_create. */ /* Register the socket-side information for inet_create. */
...@@ -1734,14 +1731,14 @@ static int __init inet_init(void) ...@@ -1734,14 +1731,14 @@ static int __init inet_init(void)
*/ */
#if defined(CONFIG_IP_MROUTE) #if defined(CONFIG_IP_MROUTE)
if (ip_mr_init()) if (ip_mr_init())
printk(KERN_CRIT "inet_init: Cannot init ipv4 mroute\n"); pr_crit("%s: Cannot init ipv4 mroute\n", __func__);
#endif #endif
/* /*
* Initialise per-cpu ipv4 mibs * Initialise per-cpu ipv4 mibs
*/ */
if (init_ipv4_mibs()) if (init_ipv4_mibs())
printk(KERN_CRIT "inet_init: Cannot init ipv4 mibs\n"); pr_crit("%s: Cannot init ipv4 mibs\n", __func__);
ipv4_proc_init(); ipv4_proc_init();
......
...@@ -445,9 +445,9 @@ static int ah_init_state(struct xfrm_state *x) ...@@ -445,9 +445,9 @@ static int ah_init_state(struct xfrm_state *x)
if (aalg_desc->uinfo.auth.icv_fullbits/8 != if (aalg_desc->uinfo.auth.icv_fullbits/8 !=
crypto_ahash_digestsize(ahash)) { crypto_ahash_digestsize(ahash)) {
printk(KERN_INFO "AH: %s digestsize %u != %hu\n", pr_info("AH: %s digestsize %u != %hu\n",
x->aalg->alg_name, crypto_ahash_digestsize(ahash), x->aalg->alg_name, crypto_ahash_digestsize(ahash),
aalg_desc->uinfo.auth.icv_fullbits/8); aalg_desc->uinfo.auth.icv_fullbits/8);
goto error; goto error;
} }
...@@ -510,11 +510,11 @@ static const struct net_protocol ah4_protocol = { ...@@ -510,11 +510,11 @@ static const struct net_protocol ah4_protocol = {
static int __init ah4_init(void) static int __init ah4_init(void)
{ {
if (xfrm_register_type(&ah_type, AF_INET) < 0) { if (xfrm_register_type(&ah_type, AF_INET) < 0) {
printk(KERN_INFO "ip ah init: can't add xfrm type\n"); pr_info("%s: can't add xfrm type\n", __func__);
return -EAGAIN; return -EAGAIN;
} }
if (inet_add_protocol(&ah4_protocol, IPPROTO_AH) < 0) { if (inet_add_protocol(&ah4_protocol, IPPROTO_AH) < 0) {
printk(KERN_INFO "ip ah init: can't add protocol\n"); pr_info("%s: can't add protocol\n", __func__);
xfrm_unregister_type(&ah_type, AF_INET); xfrm_unregister_type(&ah_type, AF_INET);
return -EAGAIN; return -EAGAIN;
} }
...@@ -524,9 +524,9 @@ static int __init ah4_init(void) ...@@ -524,9 +524,9 @@ static int __init ah4_init(void)
static void __exit ah4_fini(void) static void __exit ah4_fini(void)
{ {
if (inet_del_protocol(&ah4_protocol, IPPROTO_AH) < 0) if (inet_del_protocol(&ah4_protocol, IPPROTO_AH) < 0)
printk(KERN_INFO "ip ah close: can't remove protocol\n"); pr_info("%s: can't remove protocol\n", __func__);
if (xfrm_unregister_type(&ah_type, AF_INET) < 0) if (xfrm_unregister_type(&ah_type, AF_INET) < 0)
printk(KERN_INFO "ip ah close: can't remove xfrm type\n"); pr_info("%s: can't remove xfrm type\n", __func__);
} }
module_init(ah4_init); module_init(ah4_init);
......
...@@ -706,11 +706,11 @@ static const struct net_protocol esp4_protocol = { ...@@ -706,11 +706,11 @@ static const struct net_protocol esp4_protocol = {
static int __init esp4_init(void) static int __init esp4_init(void)
{ {
if (xfrm_register_type(&esp_type, AF_INET) < 0) { if (xfrm_register_type(&esp_type, AF_INET) < 0) {
printk(KERN_INFO "ip esp init: can't add xfrm type\n"); pr_info("%s: can't add xfrm type\n", __func__);
return -EAGAIN; return -EAGAIN;
} }
if (inet_add_protocol(&esp4_protocol, IPPROTO_ESP) < 0) { if (inet_add_protocol(&esp4_protocol, IPPROTO_ESP) < 0) {
printk(KERN_INFO "ip esp init: can't add protocol\n"); pr_info("%s: can't add protocol\n", __func__);
xfrm_unregister_type(&esp_type, AF_INET); xfrm_unregister_type(&esp_type, AF_INET);
return -EAGAIN; return -EAGAIN;
} }
...@@ -720,9 +720,9 @@ static int __init esp4_init(void) ...@@ -720,9 +720,9 @@ static int __init esp4_init(void)
static void __exit esp4_fini(void) static void __exit esp4_fini(void)
{ {
if (inet_del_protocol(&esp4_protocol, IPPROTO_ESP) < 0) if (inet_del_protocol(&esp4_protocol, IPPROTO_ESP) < 0)
printk(KERN_INFO "ip esp close: can't remove protocol\n"); pr_info("%s: can't remove protocol\n", __func__);
if (xfrm_unregister_type(&esp_type, AF_INET) < 0) if (xfrm_unregister_type(&esp_type, AF_INET) < 0)
printk(KERN_INFO "ip esp close: can't remove xfrm type\n"); pr_info("%s: can't remove xfrm type\n", __func__);
} }
module_init(esp4_init); module_init(esp4_init);
......
...@@ -695,7 +695,7 @@ void fib_add_ifaddr(struct in_ifaddr *ifa) ...@@ -695,7 +695,7 @@ void fib_add_ifaddr(struct in_ifaddr *ifa)
if (ifa->ifa_flags & IFA_F_SECONDARY) { if (ifa->ifa_flags & IFA_F_SECONDARY) {
prim = inet_ifa_byprefix(in_dev, prefix, mask); prim = inet_ifa_byprefix(in_dev, prefix, mask);
if (prim == NULL) { if (prim == NULL) {
printk(KERN_WARNING "fib_add_ifaddr: bug: prim == NULL\n"); pr_warn("%s: bug: prim == NULL\n", __func__);
return; return;
} }
} }
...@@ -749,11 +749,11 @@ void fib_del_ifaddr(struct in_ifaddr *ifa, struct in_ifaddr *iprim) ...@@ -749,11 +749,11 @@ void fib_del_ifaddr(struct in_ifaddr *ifa, struct in_ifaddr *iprim)
if (ifa->ifa_flags & IFA_F_SECONDARY) { if (ifa->ifa_flags & IFA_F_SECONDARY) {
prim = inet_ifa_byprefix(in_dev, any, ifa->ifa_mask); prim = inet_ifa_byprefix(in_dev, any, ifa->ifa_mask);
if (prim == NULL) { if (prim == NULL) {
printk(KERN_WARNING "fib_del_ifaddr: bug: prim == NULL\n"); pr_warn("%s: bug: prim == NULL\n", __func__);
return; return;
} }
if (iprim && iprim != prim) { if (iprim && iprim != prim) {
printk(KERN_WARNING "fib_del_ifaddr: bug: iprim != prim\n"); pr_warn("%s: bug: iprim != prim\n", __func__);
return; return;
} }
} else if (!ipv4_is_zeronet(any) && } else if (!ipv4_is_zeronet(any) &&
......
...@@ -154,7 +154,7 @@ static void free_fib_info_rcu(struct rcu_head *head) ...@@ -154,7 +154,7 @@ static void free_fib_info_rcu(struct rcu_head *head)
void free_fib_info(struct fib_info *fi) void free_fib_info(struct fib_info *fi)
{ {
if (fi->fib_dead == 0) { if (fi->fib_dead == 0) {
pr_warning("Freeing alive fib_info %p\n", fi); pr_warn("Freeing alive fib_info %p\n", fi);
return; return;
} }
change_nexthops(fi) { change_nexthops(fi) {
......
...@@ -1170,9 +1170,8 @@ static struct list_head *fib_insert_node(struct trie *t, u32 key, int plen) ...@@ -1170,9 +1170,8 @@ static struct list_head *fib_insert_node(struct trie *t, u32 key, int plen)
} }
if (tp && tp->pos + tp->bits > 32) if (tp && tp->pos + tp->bits > 32)
pr_warning("fib_trie" pr_warn("fib_trie tp=%p pos=%d, bits=%d, key=%0x plen=%d\n",
" tp=%p pos=%d, bits=%d, key=%0x plen=%d\n", tp, tp->pos, tp->bits, key, plen);
tp, tp->pos, tp->bits, key, plen);
/* Rebalance the trie */ /* Rebalance the trie */
......
...@@ -670,7 +670,7 @@ static void icmp_unreach(struct sk_buff *skb) ...@@ -670,7 +670,7 @@ static void icmp_unreach(struct sk_buff *skb)
break; break;
case ICMP_FRAG_NEEDED: case ICMP_FRAG_NEEDED:
if (ipv4_config.no_pmtu_disc) { if (ipv4_config.no_pmtu_disc) {
LIMIT_NETDEBUG(KERN_INFO "ICMP: %pI4: fragmentation needed and DF set.\n", LIMIT_NETDEBUG(KERN_INFO "ICMP: %pI4: fragmentation needed and DF set\n",
&iph->daddr); &iph->daddr);
} else { } else {
info = ip_rt_frag_needed(net, iph, info = ip_rt_frag_needed(net, iph,
...@@ -681,7 +681,7 @@ static void icmp_unreach(struct sk_buff *skb) ...@@ -681,7 +681,7 @@ static void icmp_unreach(struct sk_buff *skb)
} }
break; break;
case ICMP_SR_FAILED: case ICMP_SR_FAILED:
LIMIT_NETDEBUG(KERN_INFO "ICMP: %pI4: Source Route Failed.\n", LIMIT_NETDEBUG(KERN_INFO "ICMP: %pI4: Source Route Failed\n",
&iph->daddr); &iph->daddr);
break; break;
default: default:
...@@ -713,13 +713,10 @@ static void icmp_unreach(struct sk_buff *skb) ...@@ -713,13 +713,10 @@ static void icmp_unreach(struct sk_buff *skb)
if (!net->ipv4.sysctl_icmp_ignore_bogus_error_responses && if (!net->ipv4.sysctl_icmp_ignore_bogus_error_responses &&
inet_addr_type(net, iph->daddr) == RTN_BROADCAST) { inet_addr_type(net, iph->daddr) == RTN_BROADCAST) {
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_WARNING "%pI4 sent an invalid ICMP " pr_warn("%pI4 sent an invalid ICMP type %u, code %u error to a broadcast: %pI4 on %s\n",
"type %u, code %u " &ip_hdr(skb)->saddr,
"error to a broadcast: %pI4 on %s\n", icmph->type, icmph->code,
&ip_hdr(skb)->saddr, &iph->daddr, skb->dev->name);
icmph->type, icmph->code,
&iph->daddr,
skb->dev->name);
goto out; goto out;
} }
...@@ -946,8 +943,8 @@ static void icmp_address_reply(struct sk_buff *skb) ...@@ -946,8 +943,8 @@ static void icmp_address_reply(struct sk_buff *skb)
break; break;
} }
if (!ifa && net_ratelimit()) { if (!ifa && net_ratelimit()) {
printk(KERN_INFO "Wrong address mask %pI4 from %s/%pI4\n", pr_info("Wrong address mask %pI4 from %s/%pI4\n",
mp, dev->name, &ip_hdr(skb)->saddr); mp, dev->name, &ip_hdr(skb)->saddr);
} }
} }
} }
......
...@@ -643,8 +643,7 @@ static int ip_frag_reasm(struct ipq *qp, struct sk_buff *prev, ...@@ -643,8 +643,7 @@ static int ip_frag_reasm(struct ipq *qp, struct sk_buff *prev,
goto out_fail; goto out_fail;
out_oversize: out_oversize:
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_INFO "Oversized IP packet from %pI4.\n", pr_info("Oversized IP packet from %pI4\n", &qp->saddr);
&qp->saddr);
out_fail: out_fail:
IP_INC_STATS_BH(net, IPSTATS_MIB_REASMFAILS); IP_INC_STATS_BH(net, IPSTATS_MIB_REASMFAILS);
return err; return err;
......
...@@ -1716,7 +1716,7 @@ static int __init ipgre_init(void) ...@@ -1716,7 +1716,7 @@ static int __init ipgre_init(void)
{ {
int err; int err;
printk(KERN_INFO "GRE over IPv4 tunneling driver\n"); pr_info("GRE over IPv4 tunneling driver\n");
err = register_pernet_device(&ipgre_net_ops); err = register_pernet_device(&ipgre_net_ops);
if (err < 0) if (err < 0)
...@@ -1724,7 +1724,7 @@ static int __init ipgre_init(void) ...@@ -1724,7 +1724,7 @@ static int __init ipgre_init(void)
err = gre_add_protocol(&ipgre_protocol, GREPROTO_CISCO); err = gre_add_protocol(&ipgre_protocol, GREPROTO_CISCO);
if (err < 0) { if (err < 0) {
printk(KERN_INFO "ipgre init: can't add protocol\n"); pr_info("%s: can't add protocol\n", __func__);
goto add_proto_failed; goto add_proto_failed;
} }
...@@ -1753,7 +1753,7 @@ static void __exit ipgre_fini(void) ...@@ -1753,7 +1753,7 @@ static void __exit ipgre_fini(void)
rtnl_link_unregister(&ipgre_tap_ops); rtnl_link_unregister(&ipgre_tap_ops);
rtnl_link_unregister(&ipgre_link_ops); rtnl_link_unregister(&ipgre_link_ops);
if (gre_del_protocol(&ipgre_protocol, GREPROTO_CISCO) < 0) if (gre_del_protocol(&ipgre_protocol, GREPROTO_CISCO) < 0)
printk(KERN_INFO "ipgre close: can't remove protocol\n"); pr_info("%s: can't remove protocol\n", __func__);
unregister_pernet_device(&ipgre_net_ops); unregister_pernet_device(&ipgre_net_ops);
} }
......
...@@ -299,8 +299,8 @@ static inline bool ip_rcv_options(struct sk_buff *skb) ...@@ -299,8 +299,8 @@ static inline bool ip_rcv_options(struct sk_buff *skb)
if (!IN_DEV_SOURCE_ROUTE(in_dev)) { if (!IN_DEV_SOURCE_ROUTE(in_dev)) {
if (IN_DEV_LOG_MARTIANS(in_dev) && if (IN_DEV_LOG_MARTIANS(in_dev) &&
net_ratelimit()) net_ratelimit())
printk(KERN_INFO "source route option %pI4 -> %pI4\n", pr_info("source route option %pI4 -> %pI4\n",
&iph->saddr, &iph->daddr); &iph->saddr, &iph->daddr);
goto drop; goto drop;
} }
} }
......
...@@ -577,7 +577,7 @@ void ip_forward_options(struct sk_buff *skb) ...@@ -577,7 +577,7 @@ void ip_forward_options(struct sk_buff *skb)
ip_rt_get_source(&optptr[srrptr-1], skb, rt); ip_rt_get_source(&optptr[srrptr-1], skb, rt);
optptr[2] = srrptr+4; optptr[2] = srrptr+4;
} else if (net_ratelimit()) } else if (net_ratelimit())
printk(KERN_CRIT "ip_forward(): Argh! Destination lost!\n"); pr_crit("%s(): Argh! Destination lost!\n", __func__);
if (opt->ts_needaddr) { if (opt->ts_needaddr) {
optptr = raw + opt->ts; optptr = raw + opt->ts;
ip_rt_get_source(&optptr[optptr[2]-9], skb, rt); ip_rt_get_source(&optptr[optptr[2]-9], skb, rt);
......
...@@ -156,11 +156,11 @@ static const struct net_protocol ipcomp4_protocol = { ...@@ -156,11 +156,11 @@ static const struct net_protocol ipcomp4_protocol = {
static int __init ipcomp4_init(void) static int __init ipcomp4_init(void)
{ {
if (xfrm_register_type(&ipcomp_type, AF_INET) < 0) { if (xfrm_register_type(&ipcomp_type, AF_INET) < 0) {
printk(KERN_INFO "ipcomp init: can't add xfrm type\n"); pr_info("%s: can't add xfrm type\n", __func__);
return -EAGAIN; return -EAGAIN;
} }
if (inet_add_protocol(&ipcomp4_protocol, IPPROTO_COMP) < 0) { if (inet_add_protocol(&ipcomp4_protocol, IPPROTO_COMP) < 0) {
printk(KERN_INFO "ipcomp init: can't add protocol\n"); pr_info("%s: can't add protocol\n", __func__);
xfrm_unregister_type(&ipcomp_type, AF_INET); xfrm_unregister_type(&ipcomp_type, AF_INET);
return -EAGAIN; return -EAGAIN;
} }
...@@ -170,9 +170,9 @@ static int __init ipcomp4_init(void) ...@@ -170,9 +170,9 @@ static int __init ipcomp4_init(void)
static void __exit ipcomp4_fini(void) static void __exit ipcomp4_fini(void)
{ {
if (inet_del_protocol(&ipcomp4_protocol, IPPROTO_COMP) < 0) if (inet_del_protocol(&ipcomp4_protocol, IPPROTO_COMP) < 0)
printk(KERN_INFO "ip ipcomp close: can't remove protocol\n"); pr_info("%s: can't remove protocol\n", __func__);
if (xfrm_unregister_type(&ipcomp_type, AF_INET) < 0) if (xfrm_unregister_type(&ipcomp_type, AF_INET) < 0)
printk(KERN_INFO "ip ipcomp close: can't remove xfrm type\n"); pr_info("%s: can't remove xfrm type\n", __func__);
} }
module_init(ipcomp4_init); module_init(ipcomp4_init);
......
This diff is collapsed.
...@@ -892,7 +892,7 @@ static int __init ipip_init(void) ...@@ -892,7 +892,7 @@ static int __init ipip_init(void)
err = xfrm4_tunnel_register(&ipip_handler, AF_INET); err = xfrm4_tunnel_register(&ipip_handler, AF_INET);
if (err < 0) { if (err < 0) {
unregister_pernet_device(&ipip_net_ops); unregister_pernet_device(&ipip_net_ops);
printk(KERN_INFO "ipip init: can't register tunnel\n"); pr_info("%s: can't register tunnel\n", __func__);
} }
return err; return err;
} }
...@@ -900,7 +900,7 @@ static int __init ipip_init(void) ...@@ -900,7 +900,7 @@ static int __init ipip_init(void)
static void __exit ipip_fini(void) static void __exit ipip_fini(void)
{ {
if (xfrm4_tunnel_deregister(&ipip_handler, AF_INET)) if (xfrm4_tunnel_deregister(&ipip_handler, AF_INET))
printk(KERN_INFO "ipip close: can't deregister tunnel\n"); pr_info("%s: can't deregister tunnel\n", __func__);
unregister_pernet_device(&ipip_net_ops); unregister_pernet_device(&ipip_net_ops);
} }
......
...@@ -951,7 +951,7 @@ static int ipmr_cache_report(struct mr_table *mrt, ...@@ -951,7 +951,7 @@ static int ipmr_cache_report(struct mr_table *mrt,
rcu_read_unlock(); rcu_read_unlock();
if (ret < 0) { if (ret < 0) {
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_WARNING "mroute: pending queue full, dropping entries.\n"); pr_warn("mroute: pending queue full, dropping entries\n");
kfree_skb(skb); kfree_skb(skb);
} }
...@@ -2538,7 +2538,7 @@ int __init ip_mr_init(void) ...@@ -2538,7 +2538,7 @@ int __init ip_mr_init(void)
goto reg_notif_fail; goto reg_notif_fail;
#ifdef CONFIG_IP_PIMSM_V2 #ifdef CONFIG_IP_PIMSM_V2
if (inet_add_protocol(&pim_protocol, IPPROTO_PIM) < 0) { if (inet_add_protocol(&pim_protocol, IPPROTO_PIM) < 0) {
printk(KERN_ERR "ip_mr_init: can't add PIM protocol\n"); pr_err("%s: can't add PIM protocol\n", __func__);
err = -EAGAIN; err = -EAGAIN;
goto add_proto_fail; goto add_proto_fail;
} }
......
...@@ -156,7 +156,7 @@ static struct sock *ping_v4_lookup(struct net *net, __be32 saddr, __be32 daddr, ...@@ -156,7 +156,7 @@ static struct sock *ping_v4_lookup(struct net *net, __be32 saddr, __be32 daddr,
struct hlist_nulls_node *hnode; struct hlist_nulls_node *hnode;
pr_debug("try to find: num = %d, daddr = %pI4, dif = %d\n", pr_debug("try to find: num = %d, daddr = %pI4, dif = %d\n",
(int)ident, &daddr, dif); (int)ident, &daddr, dif);
read_lock_bh(&ping_table.lock); read_lock_bh(&ping_table.lock);
ping_portaddr_for_each_entry(sk, hnode, hslot) { ping_portaddr_for_each_entry(sk, hnode, hslot) {
...@@ -229,7 +229,7 @@ static int ping_init_sock(struct sock *sk) ...@@ -229,7 +229,7 @@ static int ping_init_sock(struct sock *sk)
static void ping_close(struct sock *sk, long timeout) static void ping_close(struct sock *sk, long timeout)
{ {
pr_debug("ping_close(sk=%p,sk->num=%u)\n", pr_debug("ping_close(sk=%p,sk->num=%u)\n",
inet_sk(sk), inet_sk(sk)->inet_num); inet_sk(sk), inet_sk(sk)->inet_num);
pr_debug("isk->refcnt = %d\n", sk->sk_refcnt.counter); pr_debug("isk->refcnt = %d\n", sk->sk_refcnt.counter);
sk_common_release(sk); sk_common_release(sk);
...@@ -252,7 +252,7 @@ static int ping_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) ...@@ -252,7 +252,7 @@ static int ping_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
return -EINVAL; return -EINVAL;
pr_debug("ping_v4_bind(sk=%p,sa_addr=%08x,sa_port=%d)\n", pr_debug("ping_v4_bind(sk=%p,sa_addr=%08x,sa_port=%d)\n",
sk, addr->sin_addr.s_addr, ntohs(addr->sin_port)); sk, addr->sin_addr.s_addr, ntohs(addr->sin_port));
chk_addr_ret = inet_addr_type(sock_net(sk), addr->sin_addr.s_addr); chk_addr_ret = inet_addr_type(sock_net(sk), addr->sin_addr.s_addr);
if (addr->sin_addr.s_addr == htonl(INADDR_ANY)) if (addr->sin_addr.s_addr == htonl(INADDR_ANY))
...@@ -280,9 +280,9 @@ static int ping_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) ...@@ -280,9 +280,9 @@ static int ping_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
} }
pr_debug("after bind(): num = %d, daddr = %pI4, dif = %d\n", pr_debug("after bind(): num = %d, daddr = %pI4, dif = %d\n",
(int)isk->inet_num, (int)isk->inet_num,
&isk->inet_rcv_saddr, &isk->inet_rcv_saddr,
(int)sk->sk_bound_dev_if); (int)sk->sk_bound_dev_if);
err = 0; err = 0;
if (isk->inet_rcv_saddr) if (isk->inet_rcv_saddr)
...@@ -335,7 +335,7 @@ void ping_err(struct sk_buff *skb, u32 info) ...@@ -335,7 +335,7 @@ void ping_err(struct sk_buff *skb, u32 info)
return; return;
pr_debug("ping_err(type=%04x,code=%04x,id=%04x,seq=%04x)\n", type, pr_debug("ping_err(type=%04x,code=%04x,id=%04x,seq=%04x)\n", type,
code, ntohs(icmph->un.echo.id), ntohs(icmph->un.echo.sequence)); code, ntohs(icmph->un.echo.id), ntohs(icmph->un.echo.sequence));
sk = ping_v4_lookup(net, iph->daddr, iph->saddr, sk = ping_v4_lookup(net, iph->daddr, iph->saddr,
ntohs(icmph->un.echo.id), skb->dev->ifindex); ntohs(icmph->un.echo.id), skb->dev->ifindex);
...@@ -679,7 +679,7 @@ static int ping_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, ...@@ -679,7 +679,7 @@ static int ping_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
static int ping_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) static int ping_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
{ {
pr_debug("ping_queue_rcv_skb(sk=%p,sk->num=%d,skb=%p)\n", pr_debug("ping_queue_rcv_skb(sk=%p,sk->num=%d,skb=%p)\n",
inet_sk(sk), inet_sk(sk)->inet_num, skb); inet_sk(sk), inet_sk(sk)->inet_num, skb);
if (sock_queue_rcv_skb(sk, skb) < 0) { if (sock_queue_rcv_skb(sk, skb) < 0) {
kfree_skb(skb); kfree_skb(skb);
pr_debug("ping_queue_rcv_skb -> failed\n"); pr_debug("ping_queue_rcv_skb -> failed\n");
...@@ -705,7 +705,7 @@ void ping_rcv(struct sk_buff *skb) ...@@ -705,7 +705,7 @@ void ping_rcv(struct sk_buff *skb)
/* We assume the packet has already been checked by icmp_rcv */ /* We assume the packet has already been checked by icmp_rcv */
pr_debug("ping_rcv(skb=%p,id=%04x,seq=%04x)\n", pr_debug("ping_rcv(skb=%p,id=%04x,seq=%04x)\n",
skb, ntohs(icmph->un.echo.id), ntohs(icmph->un.echo.sequence)); skb, ntohs(icmph->un.echo.id), ntohs(icmph->un.echo.sequence));
/* Push ICMP header back */ /* Push ICMP header back */
skb_push(skb, skb->data - (u8 *)icmph); skb_push(skb, skb->data - (u8 *)icmph);
......
...@@ -491,11 +491,8 @@ static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, ...@@ -491,11 +491,8 @@ static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
if (msg->msg_namelen < sizeof(*usin)) if (msg->msg_namelen < sizeof(*usin))
goto out; goto out;
if (usin->sin_family != AF_INET) { if (usin->sin_family != AF_INET) {
static int complained; pr_info_once("%s: %s forgot to set AF_INET. Fix it!\n",
if (!complained++) __func__, current->comm);
printk(KERN_INFO "%s forgot to set AF_INET in "
"raw sendmsg. Fix it!\n",
current->comm);
err = -EAFNOSUPPORT; err = -EAFNOSUPPORT;
if (usin->sin_family) if (usin->sin_family)
goto out; goto out;
......
...@@ -959,7 +959,7 @@ void rt_cache_flush_batch(struct net *net) ...@@ -959,7 +959,7 @@ void rt_cache_flush_batch(struct net *net)
static void rt_emergency_hash_rebuild(struct net *net) static void rt_emergency_hash_rebuild(struct net *net)
{ {
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_WARNING "Route hash chain too long!\n"); pr_warn("Route hash chain too long!\n");
rt_cache_invalidate(net); rt_cache_invalidate(net);
} }
...@@ -1083,7 +1083,7 @@ static int rt_garbage_collect(struct dst_ops *ops) ...@@ -1083,7 +1083,7 @@ static int rt_garbage_collect(struct dst_ops *ops)
if (dst_entries_get_slow(&ipv4_dst_ops) < ip_rt_max_size) if (dst_entries_get_slow(&ipv4_dst_ops) < ip_rt_max_size)
goto out; goto out;
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_WARNING "dst cache overflow\n"); pr_warn("dst cache overflow\n");
RT_CACHE_STAT_INC(gc_dst_overflow); RT_CACHE_STAT_INC(gc_dst_overflow);
return 1; return 1;
...@@ -1181,8 +1181,7 @@ static struct rtable *rt_intern_hash(unsigned hash, struct rtable *rt, ...@@ -1181,8 +1181,7 @@ static struct rtable *rt_intern_hash(unsigned hash, struct rtable *rt,
int err = rt_bind_neighbour(rt); int err = rt_bind_neighbour(rt);
if (err) { if (err) {
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_WARNING pr_warn("Neighbour table failure & not caching routes\n");
"Neighbour table failure & not caching routes.\n");
ip_rt_put(rt); ip_rt_put(rt);
return ERR_PTR(err); return ERR_PTR(err);
} }
...@@ -1258,7 +1257,7 @@ static struct rtable *rt_intern_hash(unsigned hash, struct rtable *rt, ...@@ -1258,7 +1257,7 @@ static struct rtable *rt_intern_hash(unsigned hash, struct rtable *rt,
struct net *net = dev_net(rt->dst.dev); struct net *net = dev_net(rt->dst.dev);
int num = ++net->ipv4.current_rt_cache_rebuild_count; int num = ++net->ipv4.current_rt_cache_rebuild_count;
if (!rt_caching(net)) { if (!rt_caching(net)) {
printk(KERN_WARNING "%s: %d rebuilds is over limit, route caching disabled\n", pr_warn("%s: %d rebuilds is over limit, route caching disabled\n",
rt->dst.dev->name, num); rt->dst.dev->name, num);
} }
rt_emergency_hash_rebuild(net); rt_emergency_hash_rebuild(net);
...@@ -1299,7 +1298,7 @@ static struct rtable *rt_intern_hash(unsigned hash, struct rtable *rt, ...@@ -1299,7 +1298,7 @@ static struct rtable *rt_intern_hash(unsigned hash, struct rtable *rt,
} }
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_WARNING "ipv4: Neighbour table overflow.\n"); pr_warn("ipv4: Neighbour table overflow\n");
rt_drop(rt); rt_drop(rt);
return ERR_PTR(-ENOBUFS); return ERR_PTR(-ENOBUFS);
} }
...@@ -1503,10 +1502,10 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw, ...@@ -1503,10 +1502,10 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw,
reject_redirect: reject_redirect:
#ifdef CONFIG_IP_ROUTE_VERBOSE #ifdef CONFIG_IP_ROUTE_VERBOSE
if (IN_DEV_LOG_MARTIANS(in_dev) && net_ratelimit()) if (IN_DEV_LOG_MARTIANS(in_dev) && net_ratelimit())
printk(KERN_INFO "Redirect from %pI4 on %s about %pI4 ignored.\n" pr_info("Redirect from %pI4 on %s about %pI4 ignored\n"
" Advised path = %pI4 -> %pI4\n", " Advised path = %pI4 -> %pI4\n",
&old_gw, dev->name, &new_gw, &old_gw, dev->name, &new_gw,
&saddr, &daddr); &saddr, &daddr);
#endif #endif
; ;
} }
...@@ -1618,8 +1617,8 @@ void ip_rt_send_redirect(struct sk_buff *skb) ...@@ -1618,8 +1617,8 @@ void ip_rt_send_redirect(struct sk_buff *skb)
if (log_martians && if (log_martians &&
peer->rate_tokens == ip_rt_redirect_number && peer->rate_tokens == ip_rt_redirect_number &&
net_ratelimit()) net_ratelimit())
printk(KERN_WARNING "host %pI4/if%d ignores redirects for %pI4 to %pI4.\n", pr_warn("host %pI4/if%d ignores redirects for %pI4 to %pI4\n",
&ip_hdr(skb)->saddr, rt->rt_iif, &ip_hdr(skb)->saddr, rt->rt_iif,
&rt->rt_dst, &rt->rt_gateway); &rt->rt_dst, &rt->rt_gateway);
#endif #endif
} }
...@@ -2105,18 +2104,13 @@ static void ip_handle_martian_source(struct net_device *dev, ...@@ -2105,18 +2104,13 @@ static void ip_handle_martian_source(struct net_device *dev,
* RFC1812 recommendation, if source is martian, * RFC1812 recommendation, if source is martian,
* the only hint is MAC header. * the only hint is MAC header.
*/ */
printk(KERN_WARNING "martian source %pI4 from %pI4, on dev %s\n", pr_warn("martian source %pI4 from %pI4, on dev %s\n",
&daddr, &saddr, dev->name); &daddr, &saddr, dev->name);
if (dev->hard_header_len && skb_mac_header_was_set(skb)) { if (dev->hard_header_len && skb_mac_header_was_set(skb)) {
int i; print_hex_dump(KERN_WARNING, "ll header: ",
const unsigned char *p = skb_mac_header(skb); DUMP_PREFIX_OFFSET, 16, 1,
printk(KERN_WARNING "ll header: "); skb_mac_header(skb),
for (i = 0; i < dev->hard_header_len; i++, p++) { dev->hard_header_len, true);
printk("%02x", *p);
if (i < (dev->hard_header_len - 1))
printk(":");
}
printk("\n");
} }
} }
#endif #endif
...@@ -2140,8 +2134,7 @@ static int __mkroute_input(struct sk_buff *skb, ...@@ -2140,8 +2134,7 @@ static int __mkroute_input(struct sk_buff *skb,
out_dev = __in_dev_get_rcu(FIB_RES_DEV(*res)); out_dev = __in_dev_get_rcu(FIB_RES_DEV(*res));
if (out_dev == NULL) { if (out_dev == NULL) {
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_CRIT "Bug in ip_route_input" \ pr_crit("Bug in ip_route_input_slow(). Please report.\n");
"_slow(). Please, report\n");
return -EINVAL; return -EINVAL;
} }
...@@ -2413,7 +2406,7 @@ out: return err; ...@@ -2413,7 +2406,7 @@ out: return err;
RT_CACHE_STAT_INC(in_martian_dst); RT_CACHE_STAT_INC(in_martian_dst);
#ifdef CONFIG_IP_ROUTE_VERBOSE #ifdef CONFIG_IP_ROUTE_VERBOSE
if (IN_DEV_LOG_MARTIANS(in_dev) && net_ratelimit()) if (IN_DEV_LOG_MARTIANS(in_dev) && net_ratelimit())
printk(KERN_WARNING "martian destination %pI4 from %pI4, dev %s\n", pr_warn("martian destination %pI4 from %pI4, dev %s\n",
&daddr, &saddr, dev->name); &daddr, &saddr, dev->name);
#endif #endif
...@@ -3490,7 +3483,7 @@ int __init ip_rt_init(void) ...@@ -3490,7 +3483,7 @@ int __init ip_rt_init(void)
net_random() % ip_rt_gc_interval + ip_rt_gc_interval); net_random() % ip_rt_gc_interval + ip_rt_gc_interval);
if (ip_rt_proc_init()) if (ip_rt_proc_init())
printk(KERN_ERR "Unable to create route proc files\n"); pr_err("Unable to create route proc files\n");
#ifdef CONFIG_XFRM #ifdef CONFIG_XFRM
xfrm_init(); xfrm_init();
xfrm4_init(ip_rt_max_size); xfrm4_init(ip_rt_max_size);
......
...@@ -1675,7 +1675,7 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, ...@@ -1675,7 +1675,7 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
if (tp->ucopy.dma_cookie < 0) { if (tp->ucopy.dma_cookie < 0) {
printk(KERN_ALERT "dma_cookie < 0\n"); pr_alert("dma_cookie < 0\n");
/* Exception. Bailout! */ /* Exception. Bailout! */
if (!copied) if (!copied)
...@@ -3311,9 +3311,8 @@ void __init tcp_init(void) ...@@ -3311,9 +3311,8 @@ void __init tcp_init(void)
sysctl_tcp_rmem[1] = 87380; sysctl_tcp_rmem[1] = 87380;
sysctl_tcp_rmem[2] = max(87380, max_share); sysctl_tcp_rmem[2] = max(87380, max_share);
printk(KERN_INFO "TCP: Hash tables configured " pr_info("TCP: Hash tables configured (established %u bind %u)\n",
"(established %u bind %u)\n", tcp_hashinfo.ehash_mask + 1, tcp_hashinfo.bhash_size);
tcp_hashinfo.ehash_mask + 1, tcp_hashinfo.bhash_size);
tcp_register_congestion_control(&tcp_reno); tcp_register_congestion_control(&tcp_reno);
......
...@@ -41,18 +41,17 @@ int tcp_register_congestion_control(struct tcp_congestion_ops *ca) ...@@ -41,18 +41,17 @@ int tcp_register_congestion_control(struct tcp_congestion_ops *ca)
/* all algorithms must implement ssthresh and cong_avoid ops */ /* all algorithms must implement ssthresh and cong_avoid ops */
if (!ca->ssthresh || !ca->cong_avoid) { if (!ca->ssthresh || !ca->cong_avoid) {
printk(KERN_ERR "TCP %s does not implement required ops\n", pr_err("TCP %s does not implement required ops\n", ca->name);
ca->name);
return -EINVAL; return -EINVAL;
} }
spin_lock(&tcp_cong_list_lock); spin_lock(&tcp_cong_list_lock);
if (tcp_ca_find(ca->name)) { if (tcp_ca_find(ca->name)) {
printk(KERN_NOTICE "TCP %s already registered\n", ca->name); pr_notice("TCP %s already registered\n", ca->name);
ret = -EEXIST; ret = -EEXIST;
} else { } else {
list_add_tail_rcu(&ca->list, &tcp_cong_list); list_add_tail_rcu(&ca->list, &tcp_cong_list);
printk(KERN_INFO "TCP %s registered\n", ca->name); pr_info("TCP %s registered\n", ca->name);
} }
spin_unlock(&tcp_cong_list_lock); spin_unlock(&tcp_cong_list_lock);
......
...@@ -3867,9 +3867,9 @@ void tcp_parse_options(const struct sk_buff *skb, struct tcp_options_received *o ...@@ -3867,9 +3867,9 @@ void tcp_parse_options(const struct sk_buff *skb, struct tcp_options_received *o
opt_rx->wscale_ok = 1; opt_rx->wscale_ok = 1;
if (snd_wscale > 14) { if (snd_wscale > 14) {
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_INFO "tcp_parse_options: Illegal window " pr_info("%s: Illegal window scaling value %d >14 received\n",
"scaling value %d >14 received.\n", __func__,
snd_wscale); snd_wscale);
snd_wscale = 14; snd_wscale = 14;
} }
opt_rx->snd_wscale = snd_wscale; opt_rx->snd_wscale = snd_wscale;
...@@ -4191,7 +4191,7 @@ static void tcp_fin(struct sock *sk) ...@@ -4191,7 +4191,7 @@ static void tcp_fin(struct sock *sk)
/* Only TCP_LISTEN and TCP_CLOSE are left, in these /* Only TCP_LISTEN and TCP_CLOSE are left, in these
* cases we should never reach this piece of code. * cases we should never reach this piece of code.
*/ */
printk(KERN_ERR "%s: Impossible, sk->sk_state=%d\n", pr_err("%s: Impossible, sk->sk_state=%d\n",
__func__, sk->sk_state); __func__, sk->sk_state);
break; break;
} }
......
...@@ -1227,10 +1227,10 @@ static int tcp_v4_inbound_md5_hash(struct sock *sk, const struct sk_buff *skb) ...@@ -1227,10 +1227,10 @@ static int tcp_v4_inbound_md5_hash(struct sock *sk, const struct sk_buff *skb)
if (genhash || memcmp(hash_location, newhash, 16) != 0) { if (genhash || memcmp(hash_location, newhash, 16) != 0) {
if (net_ratelimit()) { if (net_ratelimit()) {
printk(KERN_INFO "MD5 Hash failed for (%pI4, %d)->(%pI4, %d)%s\n", pr_info("MD5 Hash failed for (%pI4, %d)->(%pI4, %d)%s\n",
&iph->saddr, ntohs(th->source), &iph->saddr, ntohs(th->source),
&iph->daddr, ntohs(th->dest), &iph->daddr, ntohs(th->dest),
genhash ? " tcp_v4_calc_md5_hash failed" : ""); genhash ? " tcp_v4_calc_md5_hash failed" : "");
} }
return 1; return 1;
} }
......
...@@ -164,12 +164,12 @@ static const struct net_protocol tunnel64_protocol = { ...@@ -164,12 +164,12 @@ static const struct net_protocol tunnel64_protocol = {
static int __init tunnel4_init(void) static int __init tunnel4_init(void)
{ {
if (inet_add_protocol(&tunnel4_protocol, IPPROTO_IPIP)) { if (inet_add_protocol(&tunnel4_protocol, IPPROTO_IPIP)) {
printk(KERN_ERR "tunnel4 init: can't add protocol\n"); pr_err("%s: can't add protocol\n", __func__);
return -EAGAIN; return -EAGAIN;
} }
#if IS_ENABLED(CONFIG_IPV6) #if IS_ENABLED(CONFIG_IPV6)
if (inet_add_protocol(&tunnel64_protocol, IPPROTO_IPV6)) { if (inet_add_protocol(&tunnel64_protocol, IPPROTO_IPV6)) {
printk(KERN_ERR "tunnel64 init: can't add protocol\n"); pr_err("tunnel64 init: can't add protocol\n");
inet_del_protocol(&tunnel4_protocol, IPPROTO_IPIP); inet_del_protocol(&tunnel4_protocol, IPPROTO_IPIP);
return -EAGAIN; return -EAGAIN;
} }
...@@ -181,10 +181,10 @@ static void __exit tunnel4_fini(void) ...@@ -181,10 +181,10 @@ static void __exit tunnel4_fini(void)
{ {
#if IS_ENABLED(CONFIG_IPV6) #if IS_ENABLED(CONFIG_IPV6)
if (inet_del_protocol(&tunnel64_protocol, IPPROTO_IPV6)) if (inet_del_protocol(&tunnel64_protocol, IPPROTO_IPV6))
printk(KERN_ERR "tunnel64 close: can't remove protocol\n"); pr_err("tunnel64 close: can't remove protocol\n");
#endif #endif
if (inet_del_protocol(&tunnel4_protocol, IPPROTO_IPIP)) if (inet_del_protocol(&tunnel4_protocol, IPPROTO_IPIP))
printk(KERN_ERR "tunnel4 close: can't remove protocol\n"); pr_err("tunnel4 close: can't remove protocol\n");
} }
module_init(tunnel4_init); module_init(tunnel4_init);
......
...@@ -129,11 +129,11 @@ void __init udplite4_register(void) ...@@ -129,11 +129,11 @@ void __init udplite4_register(void)
inet_register_protosw(&udplite4_protosw); inet_register_protosw(&udplite4_protosw);
if (udplite4_proc_init()) if (udplite4_proc_init())
printk(KERN_ERR "%s: Cannot register /proc!\n", __func__); pr_err("%s: Cannot register /proc!\n", __func__);
return; return;
out_unregister_proto: out_unregister_proto:
proto_unregister(&udplite_prot); proto_unregister(&udplite_prot);
out_register_err: out_register_err:
printk(KERN_CRIT "%s: Cannot add UDP-Lite protocol.\n", __func__); pr_crit("%s: Cannot add UDP-Lite protocol\n", __func__);
} }
...@@ -75,18 +75,18 @@ static struct xfrm_tunnel xfrm64_tunnel_handler __read_mostly = { ...@@ -75,18 +75,18 @@ static struct xfrm_tunnel xfrm64_tunnel_handler __read_mostly = {
static int __init ipip_init(void) static int __init ipip_init(void)
{ {
if (xfrm_register_type(&ipip_type, AF_INET) < 0) { if (xfrm_register_type(&ipip_type, AF_INET) < 0) {
printk(KERN_INFO "ipip init: can't add xfrm type\n"); pr_info("%s: can't add xfrm type\n", __func__);
return -EAGAIN; return -EAGAIN;
} }
if (xfrm4_tunnel_register(&xfrm_tunnel_handler, AF_INET)) { if (xfrm4_tunnel_register(&xfrm_tunnel_handler, AF_INET)) {
printk(KERN_INFO "ipip init: can't add xfrm handler for AF_INET\n"); pr_info("%s: can't add xfrm handler for AF_INET\n", __func__);
xfrm_unregister_type(&ipip_type, AF_INET); xfrm_unregister_type(&ipip_type, AF_INET);
return -EAGAIN; return -EAGAIN;
} }
#if IS_ENABLED(CONFIG_IPV6) #if IS_ENABLED(CONFIG_IPV6)
if (xfrm4_tunnel_register(&xfrm64_tunnel_handler, AF_INET6)) { if (xfrm4_tunnel_register(&xfrm64_tunnel_handler, AF_INET6)) {
printk(KERN_INFO "ipip init: can't add xfrm handler for AF_INET6\n"); pr_info("%s: can't add xfrm handler for AF_INET6\n", __func__);
xfrm4_tunnel_deregister(&xfrm_tunnel_handler, AF_INET); xfrm4_tunnel_deregister(&xfrm_tunnel_handler, AF_INET);
xfrm_unregister_type(&ipip_type, AF_INET); xfrm_unregister_type(&ipip_type, AF_INET);
return -EAGAIN; return -EAGAIN;
...@@ -99,12 +99,14 @@ static void __exit ipip_fini(void) ...@@ -99,12 +99,14 @@ static void __exit ipip_fini(void)
{ {
#if IS_ENABLED(CONFIG_IPV6) #if IS_ENABLED(CONFIG_IPV6)
if (xfrm4_tunnel_deregister(&xfrm64_tunnel_handler, AF_INET6)) if (xfrm4_tunnel_deregister(&xfrm64_tunnel_handler, AF_INET6))
printk(KERN_INFO "ipip close: can't remove xfrm handler for AF_INET6\n"); pr_info("%s: can't remove xfrm handler for AF_INET6\n",
__func__);
#endif #endif
if (xfrm4_tunnel_deregister(&xfrm_tunnel_handler, AF_INET)) if (xfrm4_tunnel_deregister(&xfrm_tunnel_handler, AF_INET))
printk(KERN_INFO "ipip close: can't remove xfrm handler for AF_INET\n"); pr_info("%s: can't remove xfrm handler for AF_INET\n",
__func__);
if (xfrm_unregister_type(&ipip_type, AF_INET) < 0) if (xfrm_unregister_type(&ipip_type, AF_INET) < 0)
printk(KERN_INFO "ipip close: can't remove xfrm type\n"); pr_info("%s: can't remove xfrm type\n", __func__);
} }
module_init(ipip_init); module_init(ipip_init);
......
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