Skip to content

Commit

Permalink
Add module announcing mesh legacy IP address of gateway
Browse files Browse the repository at this point in the history
Required for ddhcpd gateway legacy IP address selection
  • Loading branch information
TobleMiner authored and rubo77 committed Jul 26, 2018
1 parent 55ce8b5 commit 01de2c5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
8 changes: 8 additions & 0 deletions providers/gateway/address.py
@@ -0,0 +1,8 @@
import providers

class Source(providers.DataSource):
def required_args(self):
return ['mesh_ipv4']

def call(self, mesh_ipv4):
return { "ipv4": mesh_ipv4 }
1 change: 1 addition & 0 deletions providers/gateway/node_id.py
5 changes: 4 additions & 1 deletion respondd.py
Expand Up @@ -59,12 +59,15 @@ def handle(self):
parser.add_argument('-b', dest='batadv_iface',
default='bat0', metavar='<iface>',
help='batman-adv interface (default: bat0)')
parser.add_argument('-m', dest='mesh_ipv4',
metavar='<mesh_ipv4>',
help='mesh ipv4 address')
args = parser.parse_args()

socketserver.ThreadingUDPServer.address_family = socket.AF_INET6
server = socketserver.ThreadingUDPServer(
("", args.port),
get_handler(get_providers(args.directory), {'batadv_dev': args.batadv_iface})
get_handler(get_providers(args.directory), {'batadv_dev': args.batadv_iface, 'mesh_ipv4': args.mesh_ipv4})
)

if args.mcast_ifaces:
Expand Down
2 changes: 1 addition & 1 deletion respondd.service
Expand Up @@ -3,7 +3,7 @@ Description=Respondd
After=network.target

[Service]
ExecStart=/opt/mesh-announce/respondd.py -d /opt/mesh-announce/providers -i <your-clientbridge-if> -i <your-mesh-vpn-if> -b <your-batman-if>
ExecStart=/opt/mesh-announce/respondd.py -d /opt/mesh-announce/providers -i <your-clientbridge-if> -i <your-mesh-vpn-if> -b <your-batman-if> -m <mesh ipv4 address>
Restart=always
Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

Expand Down

4 comments on commit 01de2c5

@genofire
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Why u hardcode that parameters und dies not read from any interface?
  • why u did not really hardcode by create a single module without forward a parameter (and add a .gitignore)?

@rubo77
Copy link
Contributor

@rubo77 rubo77 commented on 01de2c5 Oct 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, you mean -m , seems like, we could use an interface name here instead of an IP. Not sure if the mesh-IP always is surely ascertainable?

@TobleMiner
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@genofire There might be multiple IPv4 addresses on a single interface. At the moment there is no way to for mesh-announce to know which one is the ip address that should be used for routing.

@rubo77
Copy link
Contributor

@rubo77 rubo77 commented on 01de2c5 Oct 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the option could accept an interface too. (In case you are sure, there is only one IP on that interface)

Please sign in to comment.