LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-22-2018, 09:45 AM   #1
Blueleaf
LQ Newbie
 
Registered: Nov 2010
Posts: 8

Rep: Reputation: 0
I have no idea how to implement this patch or how to even go about it.


I am hoping someone can point me in the right direction.

The story so far…
I have a Raspberry Pi 3 running Raspbian Stretch Lite and Avhai.
I followed this guide to get Avhai successfully up and running and reflecting mDNS across my Vlans.
https://chrisreinking.com/need-bonjo...avahi-gateway/

However I need to restrict Avhai to only reflect traffic for Airplay. I have a handful of Apple Tvs that are sitting on Vlan 1 that need to be accessible via AirPlay on Vlan 2.

After some digging I found this patch below which does exactly this.
https://github.com/lathiat/avahi/pull/62

But here is my challenge.
I have no idea how to implement this patch or how to even go about it.
I am not familiar with Git at all.

I am hoping someone can guide me/ point me in the right direction on how to go about installing this patch.

I have very limited Linux knowledge, but I am very eager to learn and with your help I hope to get this up and running and expand my Linux horizons.

Thank you.
 
Old 07-22-2018, 02:54 PM   #2
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
Here's the page with the patch: http://jrudd.org/2014/08/avahi-refle...ltering-patch/

To patch a file use 'patch'. I'm not sure how these patches relate to the files. But if you're in the top directory of the archive, you usually do:
Code:
patch -p1 < patch.file
 
Old 07-23-2018, 09:44 AM   #3
Blueleaf
LQ Newbie
 
Registered: Nov 2010
Posts: 8

Original Poster
Rep: Reputation: 0
Thank you for pointing me in the right direction.
I was able to copy the patch files to the pi via ssh, by following this tutorial.
https://www.youtube.com/watch?v=fmMg6cyww14

Then I ran the following command per your suggestion.
Code:
patch -p1 < airplay.service.patch
This resulted in the following
Code:
patch -p1 < airplay-service.patch
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/service-type-database/service-types b/service-type-database/service-types
|index 6e7e2cd..54719af 100644
|--- a/service-type-database/service-types
|+++ b/service-type-database/service-types
--------------------------
File to patch:

No knowing what to do next I exited the ssh session and ran the other patch thinking maybe I need to run that one first.
Here is the result.


Code:
patch -p1 < 0001-Filtering-Reflector-Advertisements.patch
can't find file to patch at input line 30
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|From 0e9f40ff16f2d1582b3e1200a7a35f83f216f4f2 Mon Sep 17 00:00:00 2001
|From: James Rudd <James.Rudd@sbhs.nsw.edu.au>
|Date: Mon, 25 Aug 2014 16:23:33 +1000
|Subject: [[PATCH] Filtering Reflector Advertisements] Filtering Reflector
| Advertisements
|
|Allows Avahi-Daemon to  filter which advertisements are added to the cache to be reflected to  different networks.
|It checks incoming service names against a list defined  in avahi-daemon.conf [reflector] reflect-filters.
|The list can be types of  services or can contain hostnames to match.
|For example we only allow AirPlay  and AirTunes to be reflected between VLANs, so have  "_airplay._tcp.local,_raop._tcp.local" set.
|
|The patch will block the PTR and SRV advertisements but will still allow A records for machine name lookup.
|All locally published services are still published even if they do not match the filter.
|
|The filter also blocks local programs from seeing advertised programs so it is recommend to only enable it on a dedicated bonjour reflector server.
|
|Signed-off-by: James Rudd <James.Rudd@sbhs.nsw.edu.au>
|---
| avahi-core/core.h              |  1 +
| avahi-core/server.c            | 42 +++++++++++++++++++++++++++++++++++++++++-
| avahi-daemon/avahi-daemon.conf |  1 +
| avahi-daemon/main.c            | 12 ++++++++++++
| man/avahi-daemon.conf.5.xml.in | 10 ++++++++++
| 5 files changed, 65 insertions(+), 1 deletion(-)
|
|diff --git a/avahi-core/core.h b/avahi-core/core.h
|index f50c612..1ebd27a 100644
|--- a/avahi-core/core.h
|+++ b/avahi-core/core.h
--------------------------
File to patch:

I am not sure what to do from here.
 
Old 07-23-2018, 02:47 PM   #4
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
In the beginning of the patch file there is a path to a file. Depending on how you store the files to be patched, you may need to trim the path using the -p option. See the man page for patch.
 
Old 07-24-2018, 08:50 AM   #5
Blueleaf
LQ Newbie
 
Registered: Nov 2010
Posts: 8

Original Poster
Rep: Reputation: 0
I am not sure what files to patch.
How do I find out which files are the correct ones to patch?
 
Old 07-24-2018, 05:49 PM   #6
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
The patch itself lists which files to patch. That is all automated. You just have to get the -p value correct. Did you open one of the patch files and look at it? That might help you understand. And read the man page for patch.
 
Old 07-27-2018, 05:57 PM   #7
Blueleaf
LQ Newbie
 
Registered: Nov 2010
Posts: 8

Original Poster
Rep: Reputation: 0
Here are the contents of the airplay-service.patch file.
Code:
diff --git a/service-type-database/service-types b/service-type-database/service-types
index 6e7e2cd..54719af 100644
--- a/service-type-database/service-types
+++ b/service-type-database/service-types
@@ -139,6 +139,7 @@ _realplayfavs._tcp:RealPlayer Shared Favorites
 _realplayfavs._tcp[it]:RealPlayer - Preferiti Condivisi
 
 _raop._tcp:AirTunes Remote Audio
+_airplay._tcp:AirPlay Remote Video
 
 _rtsp._tcp:RTSP Realtime Streaming Server
 _rtp._udp:RTP Realtime Streaming Server
I am not sure what p switch I should use I have tried -p1, -n, etc but they all return the same error.
Code:
sudo patch -p1 < airplay-service.patch
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/service-type-database/service-types b/service-type-database/service-types
|index 6e7e2cd..54719af 100644
|--- a/service-type-database/service-types
|+++ b/service-type-database/service-types
--------------------------
File to patch:
Also on the main page for the patch I see where James talks about compiling and modifying a makefile. Is this something I need to do?
 
Old 07-27-2018, 07:13 PM   #8
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
The following is a path to a file the patch will patch.
Quote:
a/service-type-database/service-types
'a' is the top directory. So, the patch will be looking in 'service-type-database' directory for the file 'service-types' in order to patch it. '-p1' will strip off the first '/', leaving 'service-type-database/service-types'. So, if your directly above the service-type-database directory, you would use '-p1'. If you're in service-type-database directory, you would use '-p2'.

If you store the files in a different directory structure, you would go to the directory with the file to be patched and use '-p2'.
 
1 members found this post helpful.
Old 07-30-2018, 02:53 PM   #9
Blueleaf
LQ Newbie
 
Registered: Nov 2010
Posts: 8

Original Poster
Rep: Reputation: 0
So I wasn't able to find the "a" directory.
But I did find the service-types directory in the usr folder and was able to patch it.


Code:
pi@Avahi:~ $ sudo patch -p1 < airplay-service.patch
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/service-type-database/service-types b/service-type-database/service-types
|index 6e7e2cd..54719af 100644
|--- a/service-type-database/service-types
|+++ b/service-type-database/service-types
--------------------------
File to patch: /usr/share/avahi/service-types
patching file /usr/share/avahi/service-types
pi@Avahi:~ $

My next challenge is finding a file called core.h so I can run the second patch
Code:
patch -p1 < 0001-Filtering-Reflector-Advertisements.patch
So far I have not been able to locate it.

Last edited by Blueleaf; 07-30-2018 at 03:02 PM.
 
Old 08-02-2018, 10:10 AM   #10
Blueleaf
LQ Newbie
 
Registered: Nov 2010
Posts: 8

Original Poster
Rep: Reputation: 0
Update.

I feel like I am missing some fundamental aspect of this entire process.

However I was able to accomplish my end goal of filtering the mDns without having to patch the Avahi system by filtering traffic via the firewall.

As I am learning more about git I may be able to create my own local repo rather than trying to patch Avahi.
 
Old 08-02-2018, 12:36 PM   #11
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
To patch means usually update / change source code with a file that contains updated code, the patch file

So first you have to download the source code directory tree in a working directory.
Then you use the patch program with the patch file in the working directory.

After patch succeeds, the source code is changed. Now you have to compile the code (and optionnally make a package) using appropriate scripts, like configure, make etc

Last edited by keefaz; 08-02-2018 at 12:38 PM.
 
  


Reply

Tags
avahi, newbie, patching, raspberry pi



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to download patch packages to a local drive first, then patch the system thesunlover Linux - Server 4 11-07-2012 06:18 AM
Good idea/bad idea: interface colors introuble General 5 10-30-2006 01:33 PM
LXer: Freespire: Great Idea? Awful Idea? LXer Syndicated Linux News 1 05-04-2006 06:10 AM
mp3 jukebox idea (different idea then I have seen) supradrvr Linux - Software 8 03-27-2006 07:58 PM
How to Apply patch for Mass Storage device to work? (uss725-2.4.20-rc2.patch) cevjr Linux - Hardware 3 04-20-2004 11:14 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration