Pulseaudio sound streaming for multiple users on tcp using Guacamole VNC - vnc

Ubuntu 14.04. I have PulseAudio running as daemon, and configured to do streaming. In /etc/pulse/default.pa I have added the following, to accept TCP connections:
load-module module-native-protocol-tcp auth-ip-acl=192.168.1.0/24 auth-anonymous=1
Guacamole's VNC support obtains audio through a connection to the PulseAudio server. See relevant article on Guacamole Audio support (via PulseAudio).
I can get sound to stream from one VNC desktop, but not more than one, despite enabling for multiple VNC connections (these are different connections) in /etc/guacamole/user-mapping.xml. For example:
<!-- First user -->
<authorize username="user1" password="abcd">
<connection name="vnc">
<protocol>vnc</protocol>
<param name="hostname">localhost</param>
<param name="port">5903</param>
<param name="password">abcd</param>
<param name="enable-audio">true</param>
<param name="audio-servername">localhost</param>
</connection>
</authorize>
<!-- Second user -->
<authorize username="user2" password="abcd">
<!-- First authorized connection -->
<connection name="vnc">
<protocol>vnc</protocol>
<param name="hostname">localhost</param>
<param name="port">5904</param>
<param name="password">abcd</param>
<param name="enable-audio">true</param>
<param name="audio-servername">localhost</param>
</connection>
</authorize>
PulseAudio is accepting connections on port 4713.
$ netstat -ln | grep 4713
tcp 0 0 0.0.0.0:4713 0.0.0.0:* LISTEN
tcp6 0 0 :::4713 :::* LISTEN
Does PulseAudio handle multiple Guacamole VNC users?
Since Guacamole logs to /var/log/syslog, I've isolated the logs for two instances of connections. These are the logs.
First connection is a user called guacamole_guest, and it has no sound.
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Protocol "vnc" selected
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Connection ID is "$299e5678-59de-4dbd-9408-ad256785f732"
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: VNC server supports protocol version 3.8 (viewer 3.8)
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: We have 2 security types to read
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: 0) Received security type 2
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Selecting security type 2 (0/2 in the list)
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: 1) Received security type 16
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Selected Security Scheme 2
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: VNC authentication succeeded
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Desktop name "guacamole_guest's X desktop (lubuntu-ThinkCentre-M58p:3)"
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Connected to VNC server, using protocol version 3.8
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: VNC server default format:
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: 32 bits per pixel.
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Least significant byte first in each pixel.
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: TRUE colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Audio will be encoded as audio/ogg
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Starting audio stream
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Connecting to PulseAudio...
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Starting client
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Authorizing PulseAudio connection...
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Sending client name...
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: PulseAudio now ready
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Will use default sink: "auto_null"
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Starting streaming from "Dummy Output"
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: PulseAudio stream being created...
Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: PulseAudio stream now ready
Oct 23 02:31:33 lubuntu-ThinkCentre-M58p guacd[18848]: Client disconnected
Oct 23 02:31:33 lubuntu-ThinkCentre-M58p guacd[18848]: Audio stream finished
Oct 23 02:31:33 lubuntu-ThinkCentre-M58p kernel: [1207939.582306] guacd[18848]: segfault at 67452305 ip b6b7ce15 sp bfd99cc0 error 4 in libguac-client-vnc.so.0.0.0[b6b73000+e000]
Second user is called lubuntu. It has sound.
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Protocol "vnc" selected
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Connection ID is "$6344d2fb-c5fe-4073-82d7-88dea358b8f6"
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: VNC server supports protocol version 3.8 (viewer 3.8)
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: We have 2 security types to read
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: 0) Received security type 2
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Selecting security type 2 (0/2 in the list)
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: 1) Received security type 16
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Selected Security Scheme 2
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: VNC authentication succeeded
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Desktop name "lubuntu's X desktop (lubuntu-ThinkCentre-M58p:2)"
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Connected to VNC server, using protocol version 3.8
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: VNC server default format:
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: 32 bits per pixel.
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Least significant byte first in each pixel.
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: TRUE colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Audio will be encoded as audio/ogg
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Starting audio stream
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Connecting to PulseAudio...
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Authorizing PulseAudio connection...
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Sending client name...
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Starting client
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: PulseAudio now ready
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Will use default sink: "auto_null"
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Starting streaming from "Dummy Output"
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: PulseAudio stream being created...
Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: PulseAudio stream now ready
Oct 23 02:31:43 lubuntu-ThinkCentre-M58p guacd[18871]: Client disconnected
Oct 23 02:31:43 lubuntu-ThinkCentre-M58p guacd[18871]: Audio stream finished
Oct 23 02:31:43 lubuntu-ThinkCentre-M58p kernel: [1207949.566374] guacd[18871]: segfault at 67452305 ip b6b7ce15 sp bfd99cc0 error 4 in libguac-client-vnc.so.0.0.0[b6b73000+e000]
On the surface they look the same. Not sure where to proceed. The segfaults don't look good, but they happen in both cases.

Does PulseAudio handle multiple Guacamole VNC users?
PulseAudio will not be aware of Guacamole's VNC connections. Guacamole will combine the audio stream from PulseAudio with the graphical stream from VNC, but the VNC and PulseAudio connections are otherwise completely independent.
Guacamole can handle PulseAudio streams for different users/connections, but those streams will have to come from different hosts. This is because Guacamole will perform the following when connecting to PulseAudio on behalf of a VNC connection:
Establish a TCP connection to the PulseAudio server described by audio-servername.
Create a monitor source around the default sink and streams the received audio packets.
Since the PulseAudio server at localhost will be the same PulseAudio server in both of your connections, and there is only one default sink, you will hear the audio from the same sink in both cases.
First connection is a user called guacamole_guest, and it has no sound. ... Second user is called lubuntu. It has sound.
While interesting, the fact that you hear audio in only one of your connections likely has more to do with how the audio is being routed within PulseAudio. I'm sure there is a reason, but figuring that reason out will not lead to a solution to your problem. The two PulseAudio connections associated with your two VNC connections are guaranteed to be identical in your case.
If you wish to host multiple users' desktops on the same hardware, I would recommend instead housing each user's desktop within a virtual machine, using something like VirtualBox or KVM. This will provide you with better isolation between users, as well as a unique network address for their corresponding PulseAudio servers.
The segfaults don't look good, but they happen in both cases.
Indeed, guacd definitely should not be segfaulting. If you can reproduce the segfault reliably, the best thing to do would be to produce a bug report for the project. In the case of a segfault, the instructions for doing this are somewhat involved, but are necessary to determine where and how the segfault is occurring:
Ensure guacd is dead (so we can start it again under a debugger).
$ killall guacd
guacd: no process found
$
Load guacd under gdb, preloading the plugin for the failing protocol.
$ LD_PRELOAD=/usr/local/lib/libguac-client-vnc.so gdb /usr/local/sbin/guacd
GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 Free Software Foundation, Inc.
...
(gdb)
Tell gdb to follow the next child process (guacd creates a new child process to isolate and handle each new connection).
(gdb) set follow-fork-mode child
(gdb)
Run guacd within gdb, using -L debug to enable debug level logging within guacd.
(gdb) run -L debug
Starting program: /usr/local/sbin/guacd
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
guacd[29589]: INFO: Guacamole proxy daemon (guacd) version 0.9.8 started
guacd[29589]: DEBUG: Unable to bind socket to host ::1, port 4822: Address family not supported by protocol
guacd[29589]: DEBUG: Successfully bound socket to host 127.0.0.1, port 4822
guacd[29589]: INFO: Listening on host 127.0.0.1, port 4822
...
Reproduce the problem. Once it happens, you'll be taken back to a gdb prompt. Get a backtrace from gdb:
(gdb) bt
Send the resulting backtrace along with a description of how to reproduce the problem within a new issue in the JIRA of the Guacamole project.

Related

Linux Bluez RFCOMM: Connection Refused

The connection to a Bluetooth device via RFCOMM fails on Linux/Bluez with Connection refused at the call of
connect(s, (struct sockaddr *)&addr, sizeof(addr));.
The device was successfully paired. An RFCOMM connection to that device from Android or Windows can be successfully established, so the problem seems to be locaed with Bluez diver and/or blueotoothd.
With Linux/Bluez the bluetoothctl and Wireshark traces show that it fist connects and then after about 2 seconds a disconnection is done. The reason for the disconnection is not clear.
The same problem happens with different Linux releases, on PC with USB Bluetooth (Linux ubuntu 4.15.0-33-generic #36~16.04.1-Ubuntu SMP Wed Aug 15 17:21:05 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux) or Raspberry Pi 3 (Jessie, Stretch).
I have checked numerous other thread having the same/similar problem. Most have no or no clear answer.
The Wireshark trace screenshot shows the disconnect after 2.2 seconds.
The corresponding bluetoothd syslog output:
Aug 31 16:43:54 ubuntu bluetoothd[926]: src/adapter.c:connected_callback() hci0 device F6:65:0A:E5:DE:E1 connected eir_len 22
Aug 31 16:43:54 ubuntu bluetoothd[926]: src/device.c:device_create() dst F6:65:0A:E5:DE:E1
Aug 31 16:43:54 ubuntu bluetoothd[926]: src/device.c:device_new() address F6:65:0A:E5:DE:E1
Aug 31 16:43:55 ubuntu bluetoothd[926]: src/device.c:device_new() Creating device /org/bluez/hci0/dev_F6_65_0A_E5_DE_E1
Aug 31 16:43:57 ubuntu bluetoothd[926]: src/adapter.c:dev_disconnected() Device F6:65:0A:E5:DE:E1 disconnected, reason 3
Aug 31 16:43:57 ubuntu bluetoothd[926]: src/adapter.c:adapter_remove_connection()
Aug 31 16:43:57 ubuntu bluetoothd[926]: src/adapter.c:adapter_remove_connection() Removing temporary device /org/bluez/hci0/dev_F6_65_0A_E5_DE_E1
Aug 31 16:43:57 ubuntu bluetoothd[926]: src/device.c:device_remove() Removing device /org/bluez/hci0/dev_F6_65_0A_E5_DE_E1
Aug 31 16:43:57 ubuntu bluetoothd[926]: src/device.c:btd_device_unref() Freeing device /org/bluez/hci0/dev_F6_65_0A_E5_DE_E1
Aug 31 16:43:57 ubuntu bluetoothd[926]: src/device.c:device_free() 0x563aa2a270a0
Aug 31 16:43:57 ubuntu bluetoothd[926]: plugins/policy.c:disconnect_cb() reason 3
Aug 31 16:43:57 ubuntu bluetoothd[926]: src/adapter.c:bonding_attempt_complete() hci0 bdaddr F6:65:0A:E5:DE:E1 type 0 status 0xe
Aug 31 16:43:57 ubuntu bluetoothd[926]: src/adapter.c:resume_discovery()
reason 3 points to MGMT_DEV_DISCONN_REMOTE in include/net/bluetooth/mgmt.h of the kernel sources. This would mean that it is the device who initiates the disconnect. But the highlighted line in the Wireshark trace shows that it is the host that initiates the disconnection.
Many thanks for any help in advance.
The incorrect RFCOMM channel was used. It instantly works when the correct RFCOMM channel is used.
sdptool records F6:65:0A:E5:DE:E1 shows on which channel the RFCOMM is:
Service Name: Serial Port
Service RecHandle: 0x10000
Service Class ID List:
"Serial Port" (0x1101)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 5

Failing to start systemd service

I have written the following systemd service to login at the wireless at boot:
[Unit]
Description=Wireless network connectivity (%i)
Wants=network.target
Before=network.target
BindsTo=sys-subsystem-net-devices-%i-device
After=sys-subsystem-net-devices-%i-device
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/ip link set dev %i up
ExecStart=/usr/bin/wpa_supplicant -B -i %i -c /etc/wpa_supplicant/wpa_supplicant.conf
ExecStart=/usr/bin/dhcpcd %i
ExecStop=/usr/bin/ip link set dev %i down
[Install]
WantedBy=multi-user.target
I then enable it but I get the following error every time I boot my computer:
[abc#arch ~]$ systemctl --failed
UNIT LOAD ACTIVE SUB DESCRIPTION
● network-wireless#wlp3s0.service loaded failed failed Wireless network connectivity (wlp3s0)
However if I manually start this service after boot with:
systemctl start network-wireless#xlp3s0
the service starts as expected.
This is the content of wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel
network={
ssid="TeliaGateway30-91-8F-1C-B2-29"
#psk="A80871A90A"
psk=b4d8a1e9ad665eed0178fea6f141134e795e15183a661848b371a41bb73a6844
}
Why is this services starting ok when starting it manually but not at boot and how can I change it to start at boot?
EDIT: Added error output:
This is what error im getting:
[abc#arch ~]$ journalctl -b -u network-wireless#wlp3s0.service
-- Logs begin at Sat 2015-08-22 12:50:42 CEST, end at Sun 2015-08-23 22:15:26 CEST. --
Aug 23 21:23:36 arch systemd[1]: Starting Wireless network connectivity (wlp3s0)...
Aug 23 21:23:36 arch ip[274]: Cannot find device "wlp3s0"
Aug 23 21:23:36 arch systemd[1]: network-wireless#wlp3s0.service: Main process exited, code=exited, status=1/FAILURE
Aug 23 21:23:36 arch systemd[1]: Failed to start Wireless network connectivity (wlp3s0).
Aug 23 21:23:37 arch systemd[1]: network-wireless#wlp3s0.service: Unit entered failed state.
Aug 23 21:23:37 arch systemd[1]: network-wireless#wlp3s0.service: Failed with result 'exit-code'.
Aug 23 21:25:11 arch systemd[1]: Starting Wireless network connectivity (wlp3s0)...
Aug 23 21:25:11 arch dhcpcd[424]: wlp3s0: waiting for carrier
Aug 23 21:25:16 arch dhcpcd[424]: wlp3s0: carrier acquired
Aug 23 21:25:16 arch dhcpcd[424]: DUID 00:01:00:01:1d:6b:6b:e6:10:0d:7f:b7:30:f3
Aug 23 21:25:16 arch dhcpcd[424]: wlp3s0: IAID c1:c4:73:e0
Aug 23 21:25:16 arch dhcpcd[424]: wlp3s0: soliciting an IPv6 router
Aug 23 21:25:16 arch dhcpcd[424]: wlp3s0: rebinding lease of 192.168.1.85
Aug 23 21:25:21 arch dhcpcd[424]: wlp3s0: leased 192.168.1.85 for 3600 seconds
Aug 23 21:25:21 arch dhcpcd[424]: wlp3s0: adding route to 192.168.1.0/24
Aug 23 21:25:21 arch dhcpcd[424]: wlp3s0: adding default route via 192.168.1.1
Aug 23 21:25:21 arch dhcpcd[424]: forked to background, child pid 477
Aug 23 21:25:21 arch dhcpcd[424]: wlp3s0: waiting for carrier
Aug 23 21:25:21 arch dhcpcd[424]: wlp3s0: carrier acquired
Aug 23 21:25:21 arch dhcpcd[424]: DUID 00:01:00:01:1d:6b:6b:e6:10:0d:7f:b7:30:f3
Aug 23 21:25:21 arch dhcpcd[424]: wlp3s0: IAID c1:c4:73:e0
Aug 23 21:25:21 arch dhcpcd[424]: wlp3s0: soliciting an IPv6 router
Aug 23 21:25:21 arch dhcpcd[424]: wlp3s0: rebinding lease of 192.168.1.85
Aug 23 21:25:21 arch dhcpcd[424]: wlp3s0: leased 192.168.1.85 for 3600 seconds
Aug 23 21:25:21 arch dhcpcd[424]: wlp3s0: adding route to 192.168.1.0/24
Aug 23 21:25:21 arch dhcpcd[424]: wlp3s0: adding default route via 192.168.1.1
Aug 23 21:25:21 arch dhcpcd[424]: forked to background, child pid 477
Aug 23 21:25:21 arch systemd[1]: Started Wireless network connectivity (wlp3s0).
Aug 23 21:25:28 arch dhcpcd[477]: wlp3s0: no IPv6 Routers available
Aug 23 22:15:09 arch dhcpcd[477]: wlp3s0: carrier lost
Aug 23 22:15:09 arch dhcpcd[477]: wlp3s0: deleting route to 192.168.1.0/24
Aug 23 22:15:09 arch dhcpcd[477]: wlp3s0: deleting default route via 192.168.1.1
Aug 23 22:15:13 arch dhcpcd[477]: wlp3s0: carrier acquired
Aug 23 22:15:14 arch dhcpcd[477]: wlp3s0: IAID c1:c4:73:e0
Aug 23 22:15:14 arch dhcpcd[477]: wlp3s0: soliciting an IPv6 router
Aug 23 22:15:14 arch dhcpcd[477]: wlp3s0: rebinding lease of 192.168.1.85
Aug 23 22:15:19 arch dhcpcd[477]: wlp3s0: leased 192.168.1.85 for 3600 seconds
Aug 23 22:15:19 arch dhcpcd[477]: wlp3s0: adding route to 192.168.1.0/24
Aug 23 22:15:19 arch dhcpcd[477]: wlp3s0: adding default route via 192.168.1.1
Aug 23 22:15:19 arch dhcpcd[477]: wlp3s0: removing route to 192.168.1.0/24
Aug 23 22:15:26 arch dhcpcd[477]: wlp3s0: no IPv6 Routers available
EDIT:
I have found one potetential error, it seems as if the network interface changes name from wlan0 during boot, however i have tried starting the service with wlan0 but with no change in the result.
The reason the service stops at boot is because the ip command cannot find the interface. According to the man page for systemd services that is enough reason to fail the service.
As you noticed yourself the interface gets renamed or is not ready yet at boot.
You can check if you need to add an After= statement
You can check with the systemd-analyze command if the ordering at boot is correct
You could split up the service and make it more robust. Most daemons can start fine even if the interface is not ready yet.
Personally I would make dhcpd and wpa_supplicant separate services and use systemd's networkd or an udev rule to bring up the interface (if that is even needed). There are a lot examples of unit files for wpa_supplicant and dhcpd online maybe have look at those?

Live streaming on azure with FMLE

I am trying to stream to the new azure live channel.
I have followed the guide on http://azure.microsoft.com/blog/2014/09/18/azure-media-services-rtmp-support-and-live-encoders/
this is my FMLE setup: http://i.stack.imgur.com/U8rlk.png
but for some reason I am getting disconnected by the azure service. I am using Flash Media Live encoder 3.2 and this is what the log looks like:
Thu Oct 09 2014 16:33:30 : Video Encoding Started
Thu Oct 09 2014 16:33:39 : Primary - Network Status: NetConnection.Connect.Closed status
Thu Oct 09 2014 16:33:45 : Primary - Disconnected
Thu Oct 09 2014 16:33:48 : Primary - Re-establishing connection, attempt 1
Thu Oct 09 2014 16:33:48 : Primary - Reconnected
Thu Oct 09 2014 16:33:48 : Primary - Network Command: onBWDone
Thu Oct 09 2014 16:33:48 : Primary - Stream[mystream9] Status: Success
Thu Oct 09 2014 16:33:48 : Primary - Stream[mystream9] Status: NetStream.Publish.Start
Thu Oct 09 2014 16:33:56 : Primary - Network Status: NetConnection.Connect.Closed status
Thu Oct 09 2014 16:33:58 : Video Encoding Stopped
Thu Oct 09 2014 16:33:58 : Session Stopped
Thu Oct 09 2014 16:34:01 : Primary - Disconnected
Thu Oct 09 2014 16:34:01 : Audio source does not support the selected sample rate and/or channels. Re-sampling the audio to desired setting.
Thu Oct 09 2014 16:34:02 : Primary - Re-establishing connection, attempt 1
Thu Oct 09 2014 16:34:02 : Primary - Reconnected
Thu Oct 09 2014 16:34:05 : Primary - Network Status: NetConnection.Connect.Closed status
Thu Oct 09 2014 16:34:05 : Primary - Disconnected
Edit:
Oh well I decided not to go for azure live streaming. Reasons are many. They let you only output to mpeg-dash which frankly is not ready for the world as of now. There are few players who support that out of box. Because of the smooth streaming crap from microsoft, we the encoders, are forced into limiting our encoding options. Alot of encoding software today dont have all the option that is required to stream such as frame alignment, grouping of pictures etc. Its kinda sad that I can stream with h264 but not x264 which is opensource and better.

How to detect Openwrt kern.info and daemon.info events?

My background is mostly Windows programming in C and C++. Recently I've had the chance to work with some embedded Linux systems also, but I'm still new at this.
Right now I'm working on a utility for Openwrt that needs to react to network and system events that occur during normal operation.
I've been able to use Hotplug for some events, but others still elude me. I can parse the output of the system log using logread, but that seems primitive and hackish.
In particular I'd like to get a callback similar to what hotplug does for some of the 'kern.info kernel' and 'daemon.info' events. For example:
Mar 31 19:42:32 OpenWrt kern.info kernel: [ 369.540000] device wlan0 left promiscuous mode
Mar 31 19:42:32 OpenWrt kern.info kernel: [ 369.540000] br-lan: port 2(wlan0) entered disabled state
Mar 31 19:42:32 OpenWrt kern.info kernel: [ 369.730000] device wlan1 left promiscuous mode
Mar 31 19:42:32 OpenWrt kern.info kernel: [ 369.730000] br-lan: port 3(wlan1) entered disabled state
Mar 31 19:42:34 OpenWrt kern.info kernel: [ 371.360000] device wlan0 entered promiscuous mode
Mar 31 19:45:56 OpenWrt daemon.info hostapd: wlan0: STA 04:f7:e4:00:00:00 IEEE 802.11: authenticated
Mar 31 19:45:56 OpenWrt daemon.info hostapd: wlan0: STA 04:f7:e4:00:00:00 IEEE 802.11: associated (aid 1)
Mar 31 19:45:56 OpenWrt daemon.info hostapd: wlan0: STA 04:f7:e4:00:00:00 WPA: pairwise key handshake completed (WPA)
Mar 31 19:45:56 OpenWrt daemon.info hostapd: wlan0: STA 04:f7:e4:00:00:00 WPA: group key handshake completed (WPA)
Mar 31 19:45:56 OpenWrt daemon.info dnsmasq-dhcp[5005]: DHCPREQUEST(br-lan) 10.1.1.51 04:f7:e4:00:00:00
Mar 31 19:45:56 OpenWrt daemon.info dnsmasq-dhcp[5005]: DHCPNAK(br-lan) 10.1.1.51 04:f7:e4:00:00:00 wrong network
Mar 31 19:46:00 OpenWrt daemon.info dnsmasq-dhcp[5005]: DHCPDISCOVER(br-lan) 04:f7:e4:00:00:00
Mar 31 19:46:00 OpenWrt daemon.info dnsmasq-dhcp[5005]: DHCPOFFER(br-lan) 192.168.1.198 04:f7:e4:1c:09:00
Mar 31 19:46:00 OpenWrt daemon.info dnsmasq-dhcp[5005]: DHCPDISCOVER(br-lan) 04:f7:e4:1c:09:00
Mar 31 19:46:00 OpenWrt daemon.info dnsmasq-dhcp[5005]: DHCPOFFER(br-lan) 192.168.1.198 04:f7:e4:1c:09:00
Mar 31 19:46:01 OpenWrt daemon.info dnsmasq-dhcp[5005]: DHCPREQUEST(br-lan) 192.168.1.198 04:f7:e4:1c:09:00
Mar 31 19:46:01 OpenWrt daemon.info dnsmasq-dhcp[5005]: DHCPACK(br-lan) 192.168.1.198 04:f7:e4:1c:09:00 My-iPhone
Log entries like the DHCPOFFER (as seen in your example) are generated individually by the corresponding process (for example, by udhcpc) using the Unix syslog mechanism (kind-of like the Windows Event Logging API)
By default on OpenWRT logging is handled by the syslogd process provided by the busybox package. This is fairly primitive and simply sends messages to the circular buffer you see using logread and/or to a UDP socket.
You can upgrade logging on OpenWRT to use the syslog-ng package. This has a much more advanced configuration and you should be able to use this to send filtered log events to a script that you can write to do what you need with them.
opkg install syslog-ng
syslog-ng is a GPL product but the documentation is now buried beneath a commercial web site, one would hope you can get it from the source code , via http://freecode.com/projects/syslog-ng. Note that OpenWRT seems to provide version 1.6.12 which I had trouble finding the documentation for when I implemented it on my OpenWRT devices, but eventually I found it via the wayback machine: https://web.archive.org/web/20070406054439/http://www.balabit.com/products/syslog_ng/reference-1.6/syslog-ng.html/x731.html (for example)
A configuration file fragment that would pull out those DHCP messages and send them to a standalone log file would look a bit like:
source src { unix-stream("/dev/log"); internal(); };
destination dhcp_messages { file("/var/log/dhcpmessages"); };
filter f_dhcp { match("dnsmasq-dhcp"); };
log {
source(src);
filter(f_dhcp);
destination(dhcp_messages);
};
You might probably find the pipe() or program() destination drivers the most useful for your application. For example, using a program() driver you could send selected messages to a shell script that parses them and saves them into a sqlite database.

Cann't receive REMOTE host log messages with Chainsaw (localhost messages just OK)

I did a logger with programmatically configured SocketAppender for Chainsaw. I successfully receive messages in the SimpleReceiver of Chainsaw from code running on localhost, but from remote host i'm just getting like
63 Fri Sep 23 14:44:08 MSD
2011 INFO org.apache.log4j.chainsaw.messages.MessageCenter Connection
received from
my.host.com:50299 Chainsaw-WorkerThread log chainsaw
68 Fri Sep 23 15:12:22 MSD
2011 INFO org.apache.log4j.chainsaw.messages.MessageCenter Connection
lost! :: null Chainsaw-WorkerThread
log chainsaw 69 Fri Sep 23 15:12:22 MSD
2011 DEBUG org.apache.log4j.net.SocketReceiver accepted
socket Chainsaw-WorkerThread log chainsaw
70 Fri Sep 23 15:12:22 MSD
2011 DEBUG org.apache.log4j.net.SocketReceiver socket not null -
creating and starting
socketnode Chainsaw-WorkerThread log chainsaw
71 Fri Sep 23 15:12:22 MSD
2011 DEBUG org.apache.log4j.net.SocketReceiver w*aiting to accept
socket* Chainsaw-WorkerThread log chainsaw
but no tab with log messages from remote host. What's wrong? No firewall is running.
Tested with v2 and v2.1-trunk-today.
Solved yesterday. Log level in big app's plugin wasn't set correctly.

Resources