Deleted Added
full compact
control_client.c (224144) control_client.c (225519)
1/*-
2 * Copyright (C) 2011 Hiroki Sato <hrs@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
21 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
24 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
1/*-
2 * Copyright (C) 2011 Hiroki Sato <hrs@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
21 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
24 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * $FreeBSD: head/usr.sbin/rtadvd/control_client.c 224144 2011-07-17 19:24:54Z hrs $
26 * $FreeBSD: head/usr.sbin/rtadvd/control_client.c 225519 2011-09-12 23:52:55Z hrs $
27 *
28 */
29
30#include <sys/queue.h>
31#include <sys/types.h>
32#include <sys/socket.h>
33#include <sys/stat.h>
34#include <sys/un.h>

--- 15 unchanged lines hidden (view full) ---

50
51#include "pathnames.h"
52#include "rtadvd.h"
53#include "if.h"
54#include "control.h"
55#include "control_client.h"
56
57int
27 *
28 */
29
30#include <sys/queue.h>
31#include <sys/types.h>
32#include <sys/socket.h>
33#include <sys/stat.h>
34#include <sys/un.h>

--- 15 unchanged lines hidden (view full) ---

50
51#include "pathnames.h"
52#include "rtadvd.h"
53#include "if.h"
54#include "control.h"
55#include "control_client.h"
56
57int
58cmsg_handler_client(int fd, int state, char *buf_orig)
58cm_handler_client(int fd, int state, char *buf_orig)
59{
60 char buf[CM_MSG_MAXLEN];
61 struct ctrl_msg_hdr *cm;
62 struct ctrl_msg_hdr *cm_orig;
63 int error;
64 char *msg;
65 char *msg_orig;
66

--- 19 unchanged lines hidden (view full) ---

86 syslog(LOG_DEBUG, "<%s> state = %d", __func__, state);
87
88 switch (state) {
89 case CM_STATE_INIT:
90 state = CM_STATE_EOM;
91 break;
92 case CM_STATE_MSG_DISPATCH:
93 cm->cm_version = CM_VERSION;
59{
60 char buf[CM_MSG_MAXLEN];
61 struct ctrl_msg_hdr *cm;
62 struct ctrl_msg_hdr *cm_orig;
63 int error;
64 char *msg;
65 char *msg_orig;
66

--- 19 unchanged lines hidden (view full) ---

86 syslog(LOG_DEBUG, "<%s> state = %d", __func__, state);
87
88 switch (state) {
89 case CM_STATE_INIT:
90 state = CM_STATE_EOM;
91 break;
92 case CM_STATE_MSG_DISPATCH:
93 cm->cm_version = CM_VERSION;
94 error = cmsg_send(fd, buf);
94 error = cm_send(fd, buf);
95 if (error)
96 syslog(LOG_WARNING,
95 if (error)
96 syslog(LOG_WARNING,
97 "<%s> cmsg_send()", __func__);
97 "<%s> cm_send()", __func__);
98 state = CM_STATE_ACK_WAIT;
99 break;
100 case CM_STATE_ACK_WAIT:
98 state = CM_STATE_ACK_WAIT;
99 break;
100 case CM_STATE_ACK_WAIT:
101 error = cmsg_recv(fd, buf);
101 error = cm_recv(fd, buf);
102 if (error) {
103 syslog(LOG_ERR,
102 if (error) {
103 syslog(LOG_ERR,
104 "<%s> cmsg_recv()", __func__);
104 "<%s> cm_recv()", __func__);
105 close(fd);
106 return (-1);
107 }
108 switch (cm->cm_type) {
109 case CM_TYPE_ACK:
110 syslog(LOG_DEBUG,
111 "<%s> CM_TYPE_ACK", __func__);
112 break;

--- 19 unchanged lines hidden ---
105 close(fd);
106 return (-1);
107 }
108 switch (cm->cm_type) {
109 case CM_TYPE_ACK:
110 syslog(LOG_DEBUG,
111 "<%s> CM_TYPE_ACK", __func__);
112 break;

--- 19 unchanged lines hidden ---