chiark / gitweb /
netlink: Break out sender_name
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 3 May 2014 11:19:42 +0000 (12:19 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 3 May 2014 15:34:24 +0000 (16:34 +0100)
We are going to want to add another call site.

No functional change.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
netlink.c

index 41968e4..e53c339 100644 (file)
--- a/netlink.c
+++ b/netlink.c
@@ -237,6 +237,11 @@ struct icmphdr {
 
 static const union icmpinfofield icmp_noinfo;
     
+static const char *sender_name(struct netlink_client *sender /* or NULL */)
+{
+    return sender?sender->name:"(local)";
+}
+
 static void netlink_packet_deliver(struct netlink *st,
                                   struct netlink_client *client,
                                   struct buffer_if *buf);
@@ -615,7 +620,7 @@ static void netlink_packet_deliver(struct netlink *st,
 {
     if (buf->size < (int)sizeof(struct iphdr)) {
        Message(M_ERR,"%s: trying to deliver a too-short packet"
-               " from %s!\n",st->name, sender?sender->name:"(local)");
+               " from %s!\n",st->name, sender_name(sender));
        BUF_FREE(buf);
        return;
     }