Community discussions

MikroTik App
 
User avatar
horhay
newbie
Topic Author
Posts: 29
Joined: Sat Jun 20, 2015 7:19 pm
Location: Ontario, Canada
Contact:

Quickly clone firewall rules via API written in C.

Sun Jan 21, 2018 8:24 pm

I have a need in my work to copy firewall rules from a master router to several dozen other routers. So I wrote this program.

It copies all firewall FILTER, MANGLE and ADDRESS-LIST entries from the hard coded "MASTER" router to the router specified on the command line.

I started with the C API from the wiki by webasdf. I fixed the memory management and added several other routines.

This might be a good example for someone looking to get into programming the API in C.

h0rhay
You do not have the required permissions to view the files attached to this post.
 
dcowsill
just joined
Posts: 4
Joined: Wed Nov 08, 2017 5:03 am
Location: Canada

Re: Quickly clone firewall rules via API written in C.

Tue Jan 23, 2018 3:59 am

Awesome work. That is some well-documented code.
 
User avatar
horhay
newbie
Topic Author
Posts: 29
Joined: Sat Jun 20, 2015 7:19 pm
Location: Ontario, Canada
Contact:

Re: Quickly clone firewall rules via API written in C.

Fri Jan 26, 2018 6:30 pm

I'm looking for a new project if anyone needs anything written using the API.
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2400
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: Quickly clone firewall rules via API written in C.

Fri Jan 26, 2018 10:43 pm

Have you considered simply making a generic, cross platform, full featured (ideally focused to ease of use for the developer) API client with bindings for various other languages (e.g. for a PHP extension, a Node module, an unmanaged .NET assembly, etc.)?

Current implementations aren't... that... so a new one that is would be awesome.
 
User avatar
horhay
newbie
Topic Author
Posts: 29
Joined: Sat Jun 20, 2015 7:19 pm
Location: Ontario, Canada
Contact:

Re: Quickly clone firewall rules via API written in C.

Sat Jan 27, 2018 4:22 am

Sorry. I'm just an old C programmer. Great idea but beyond my abilities. I'm hoping someone needs a program to login to a router and do something. Produce a report or change settings or check something and give a different return value so it can be used in bash scripts. Poll some parameter and dump it to a mysql database.

Who is online

Users browsing this forum: gxg and 73 guests