Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

netfilter: Use pr_cont where appropriate

Logging output was changed when simple printks without KERN_CONT
are now emitted on a new line and KERN_CONT is required to continue
lines so use pr_cont.

Miscellanea:

o realign arguments
o use print_hex_dump instead of a local variant

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

authored by

Joe Perches and committed by
Pablo Neira Ayuso
13fa745d 3206cade

+19 -30
+17 -17
net/bridge/netfilter/ebt_log.c
··· 62 62 pptr = skb_header_pointer(skb, offset, 63 63 sizeof(_ports), &_ports); 64 64 if (pptr == NULL) { 65 - printk(" INCOMPLETE TCP/UDP header"); 65 + pr_cont(" INCOMPLETE TCP/UDP header"); 66 66 return; 67 67 } 68 - printk(" SPT=%u DPT=%u", ntohs(pptr->src), ntohs(pptr->dst)); 68 + pr_cont(" SPT=%u DPT=%u", ntohs(pptr->src), ntohs(pptr->dst)); 69 69 } 70 70 } 71 71 ··· 100 100 101 101 ih = skb_header_pointer(skb, 0, sizeof(_iph), &_iph); 102 102 if (ih == NULL) { 103 - printk(" INCOMPLETE IP header"); 103 + pr_cont(" INCOMPLETE IP header"); 104 104 goto out; 105 105 } 106 - printk(" IP SRC=%pI4 IP DST=%pI4, IP tos=0x%02X, IP proto=%d", 107 - &ih->saddr, &ih->daddr, ih->tos, ih->protocol); 106 + pr_cont(" IP SRC=%pI4 IP DST=%pI4, IP tos=0x%02X, IP proto=%d", 107 + &ih->saddr, &ih->daddr, ih->tos, ih->protocol); 108 108 print_ports(skb, ih->protocol, ih->ihl*4); 109 109 goto out; 110 110 } ··· 120 120 121 121 ih = skb_header_pointer(skb, 0, sizeof(_iph), &_iph); 122 122 if (ih == NULL) { 123 - printk(" INCOMPLETE IPv6 header"); 123 + pr_cont(" INCOMPLETE IPv6 header"); 124 124 goto out; 125 125 } 126 - printk(" IPv6 SRC=%pI6 IPv6 DST=%pI6, IPv6 priority=0x%01X, Next Header=%d", 127 - &ih->saddr, &ih->daddr, ih->priority, ih->nexthdr); 126 + pr_cont(" IPv6 SRC=%pI6 IPv6 DST=%pI6, IPv6 priority=0x%01X, Next Header=%d", 127 + &ih->saddr, &ih->daddr, ih->priority, ih->nexthdr); 128 128 nexthdr = ih->nexthdr; 129 129 offset_ph = ipv6_skip_exthdr(skb, sizeof(_iph), &nexthdr, &frag_off); 130 130 if (offset_ph == -1) ··· 142 142 143 143 ah = skb_header_pointer(skb, 0, sizeof(_arph), &_arph); 144 144 if (ah == NULL) { 145 - printk(" INCOMPLETE ARP header"); 145 + pr_cont(" INCOMPLETE ARP header"); 146 146 goto out; 147 147 } 148 - printk(" ARP HTYPE=%d, PTYPE=0x%04x, OPCODE=%d", 149 - ntohs(ah->ar_hrd), ntohs(ah->ar_pro), 150 - ntohs(ah->ar_op)); 148 + pr_cont(" ARP HTYPE=%d, PTYPE=0x%04x, OPCODE=%d", 149 + ntohs(ah->ar_hrd), ntohs(ah->ar_pro), 150 + ntohs(ah->ar_op)); 151 151 152 152 /* If it's for Ethernet and the lengths are OK, 153 153 * then log the ARP payload ··· 161 161 ap = skb_header_pointer(skb, sizeof(_arph), 162 162 sizeof(_arpp), &_arpp); 163 163 if (ap == NULL) { 164 - printk(" INCOMPLETE ARP payload"); 164 + pr_cont(" INCOMPLETE ARP payload"); 165 165 goto out; 166 166 } 167 - printk(" ARP MAC SRC=%pM ARP IP SRC=%pI4 ARP MAC DST=%pM ARP IP DST=%pI4", 168 - ap->mac_src, ap->ip_src, ap->mac_dst, ap->ip_dst); 167 + pr_cont(" ARP MAC SRC=%pM ARP IP SRC=%pI4 ARP MAC DST=%pM ARP IP DST=%pI4", 168 + ap->mac_src, ap->ip_src, 169 + ap->mac_dst, ap->ip_dst); 169 170 } 170 171 } 171 172 out: 172 - printk("\n"); 173 + pr_cont("\n"); 173 174 spin_unlock_bh(&ebt_log_lock); 174 - 175 175 } 176 176 177 177 static unsigned int
+2 -13
net/ipv4/netfilter/nf_nat_snmp_basic.c
··· 998 998 * 999 999 *****************************************************************************/ 1000 1000 1001 - static void hex_dump(const unsigned char *buf, size_t len) 1002 - { 1003 - size_t i; 1004 - 1005 - for (i = 0; i < len; i++) { 1006 - if (i && !(i % 16)) 1007 - printk("\n"); 1008 - printk("%02x ", *(buf + i)); 1009 - } 1010 - printk("\n"); 1011 - } 1012 - 1013 1001 /* 1014 1002 * Parse and mangle SNMP message according to mapping. 1015 1003 * (And this is the fucking 'basic' method). ··· 1014 1026 struct snmp_object *obj; 1015 1027 1016 1028 if (debug > 1) 1017 - hex_dump(msg, len); 1029 + print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_NONE, 16, 1, 1030 + msg, len, 0); 1018 1031 1019 1032 asn1_open(&ctx, msg, len); 1020 1033